autobangumi-plugin
Skill8.3k starsChanged 3 years agoMITView on GitHub
Write, test, pack and debug AutoBangumi (AB) 4.0 plugins with the ab_sdk Python SDK and the ab-plugin CLI. Use when the user asks to "write an AutoBangumi plugin", "add a downloader / notifier / search site / rename strategy / RSS site to AutoBangumi", "hook into AutoBangumi", mentions ab_sdk, ab-plugin, plugin.toml, @provider, @hook, @subscribe, secret_field, or wants a custom rename template, webhook on torrent.organized, nfo writer, private tracker Cookie, or a plugin web component for the AutoBangumi WebUI.
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Write the plugin: one Plugin[Options] subclass, config_model = Options, decorated methods.
- Very specific: line 15
Test first: uv run pytest.
- Very specific: line 76
No native extensions (.so, .pyd, .dylib, .dll).
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AutoBangumi plugin authoring
AB plugins are Python packages (optional Web Component UI) that run inside the AB process. They import only ab_sdk, never module.*. SDK is 0.x during 4.0: pin sdk = ">=0.5,<1" in the manifest.
Workflow
- Pick the extension point (table below). If unsure, read
references/extension-points.md. - Scaffold:
ab-plugin new <id> --kind rename|notifier|search(ids: lowercase, digits, hyphens;coreandlocalare reserved). For other points, copy the closest example fromexamples/plugins/in the AB repo. - Write the plugin: one
Plugin[Options]subclass,config_model = Options, decorated methods. - Test first:
uv run pytest. Provider points have contract suites inab_sdk.testing(subclass, implementcreate()). Other behavior:create_plugin(Cls, options)plusasyncio.run. ab-plugin validate .thenab-plugin dev .(links intoconfig/plugins/local/, enables hot reload; restart AB once) thenab-plugin pack ..
Install the tooling from the GitHub release wheel (autobangumi_sdk-<ver>-py3-none-any.whl), not PyPI.
Skeleton
from pydantic import BaseModel, Field
from ab_sdk import Plugin, points, provider, hook, subscribe, secret_field
class Options(BaseModel):
url: str = Field("", title="URL") # title/description become the WebUI form labels
token: str = secret_field(title="Token") # password box; masked on read
class MyPlugin(Plugin[Options]):
config_model = Options # self.config is a validated Options
@provider(points.NOTIFIER, id="my-push") # Provider: the thing the user selects by id
def channel(self): ...
@hook(points.TORRENT_FILTER, priority=50) # Hook: runs in the AB pipeline
def check(self, torrent, release, bangumi): ...
@subscribe("torrent.organized", timeout=600) # Event subscriber ("*" = all events)
async def on_organized(self, event): ...self.ctx: plugin_id, config, log, kv (async get/set/delete, JSON values), data_dir, bus (publish, subscribe).
Extension points
| Point constant | Kind | Returns / signature |
DOWNLOADER | provider | DownloaderFactory: (DownloaderConnection) -> client with capabilities, auth, logout, add_torrents |
NOTIFIER | provider | NotifierFactory: (NotifierSettings) -> Notifier (send -> bool, test -> (bool, str)) |
LLM_PROVIDER | provider | LLMProviderAdapter subclass; id must equal info.id |
SEARCH_SITE | provider | SearchSite(url_with_%s, parser="tmdb"|"mikan") |
SCHEDULED_TASK | provider | ScheduledTask(run, interval, initial_delay, enabled) |
METADATA_PROVIDER | provider | object with async enrich(MetadataRequest) -> Metadata | None |
RENAME_STRATEGY | provider | object with target_name(RenameInput) -> str; raise RenameSkipped for bad input |
MEDIA_FILES | provider | classify(path) -> "media"|"subtitle"|"ignore" |
CONFLICT_POLICY | provider | decide(ConflictRequest) -> ConflictDecision("hold"|"replace", reason) |
API_ROUTER | provider | fastapi.APIRouter, mounted at /api/v1/plugins/<id>/, login required |
MCP_TOOL / MCP_RESOURCE | provider | McpTool / McpResource |
TORRENT_FILTER | filter hook | (torrent, release, bangumi) -> Verdict |
TITLE_PARSED | transform hook | (release) -> release | None |
TORRENT_ADDING | transform hook | (AddRequest) -> AddRequest | None |
HTTP_REQUEST | transform hook | (HttpRequest) -> HttpRequest | None (headers only) |
MESSAGE_TEMPLATE | transform hook | (RenderedMessage, event, channel) -> RenderedMessage | None |
Details, imports and field lists: references/extension-points.md.
Rules that prevent most bugs
- Hooks get frozen snapshots. Return
dataclasses.replace(obj, ...); returnNonefor "no change". A wrong return type counts as a failure. - Five consecutive failures trip the circuit breaker and disable the plugin.
RenameSkippedis not a failure. Never fall back to another naming method after a failure. - Filter hooks fail open (a crash accepts the torrent). Notifier
sendreturnsFalseon a backend refusal; it does not raise. - Events: plugin event
kindmust start with<plugin-id>.. SubclassSystemEventto make a notifiable event.torrent.organizedis delivered at least once: make handlers idempotent. Event paths are downloader-side paths; map them to local paths before touching the disk (for example apath_mapoption ofdownloader/from/torows, as in the built-in hardlink plugin). - Blocking work (file IO, copies) goes in
asyncio.to_thread;target_nameis sync with no timeout, so no IO there. - Validate config deeply in
field_validatorso bad values give HTTP 422 at save time. - No native extensions (
.so,.pyd,.dylib,.dll). Third-party pure-Python deps go invendor/; AB does not run pip for catalog or local plugins. - Plugin routes cannot use the paths
web/,install,catalog. - Local and pip plugins are unsigned: the user must turn on "Allow unsigned plugins". Only maintainers sign the catalog (
scripts/build_plugin_catalog.py).
References
references/extension-points.md: imports, dataclass fields and gotchas per extension point.references/testing.md: contract suites,create_plugin,ab-plugincommands, the manifest.references/frontend.md:[[plugin.ui]], slots,AbHost, CSP, build template.- Examples (in the AB repo):
examples/plugins/haswebhook-on-event,custom-rss-site,template-rename,nfo-writer,manual-pick,run-command,strm-writer, and the notifiersntfy-notifier,slack-notifier,synology-chat-notifier,apprise-notifier,onebot-notifier,wpush-notifier.
Trending
Quiet this year.thin dataabout the whole repository
Who's talking about EstrellaXD/Auto_Bangumi
- DaoCloud/public-image-mirror“estrellaxd/auto_bangumi”GitHub · Apr 18, 2025
- xushier/HD-Icons“AutoBangumi 图标申请”GitHub · Aug 25, 2023
- Rewrite0/Auto_Bangumi_WebUI“[Feature Request] Apply and restart.”GitHub · Jun 4, 2023
- Rewrite0/Auto_Bangumi_WebUI“[Feature Request] Wecom Notification in config page”GitHub · Jun 4, 2023
- oss-compass/compass-projects-information“Updated single-repositories/github/EstrellaXD/Auto_Bangumi.yml”GitHub · Mar 25, 2023
The biggest 5 of 5 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

