agentleFS
EstrellaXDEstrellaXD/Auto_Bangumi/skills/autobangumi-plugin/SKILL.md

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
  1. Very specific:

    Write the plugin: one Plugin[Options] subclass, config_model = Options, decorated methods.

    line 14
  2. Very specific:

    Test first: uv run pytest.

    line 15
  3. Very specific:

    No native extensions (.so, .pyd, .dylib, .dll).

    line 76

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Pick the extension point (table below). If unsure, read references/extension-points.md.
  2. Scaffold: ab-plugin new <id> --kind rename|notifier|search (ids: lowercase, digits, hyphens; core and local are reserved). For other points, copy the closest example from examples/plugins/ in the AB repo.
  3. Write the plugin: one Plugin[Options] subclass, config_model = Options, decorated methods.
  4. Test first: uv run pytest. Provider points have contract suites in ab_sdk.testing (subclass, implement create()). Other behavior: create_plugin(Cls, options) plus asyncio.run.
  5. ab-plugin validate . then ab-plugin dev . (links into config/plugins/local/, enables hot reload; restart AB once) then ab-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 constantKindReturns / signature
DOWNLOADERproviderDownloaderFactory: (DownloaderConnection) -> client with capabilities, auth, logout, add_torrents
NOTIFIERproviderNotifierFactory: (NotifierSettings) -> Notifier (send -> bool, test -> (bool, str))
LLM_PROVIDERproviderLLMProviderAdapter subclass; id must equal info.id
SEARCH_SITEproviderSearchSite(url_with_%s, parser="tmdb"|"mikan")
SCHEDULED_TASKproviderScheduledTask(run, interval, initial_delay, enabled)
METADATA_PROVIDERproviderobject with async enrich(MetadataRequest) -> Metadata | None
RENAME_STRATEGYproviderobject with target_name(RenameInput) -> str; raise RenameSkipped for bad input
MEDIA_FILESproviderclassify(path) -> "media"|"subtitle"|"ignore"
CONFLICT_POLICYproviderdecide(ConflictRequest) -> ConflictDecision("hold"|"replace", reason)
API_ROUTERproviderfastapi.APIRouter, mounted at /api/v1/plugins/<id>/, login required
MCP_TOOL / MCP_RESOURCEproviderMcpTool / McpResource
TORRENT_FILTERfilter hook(torrent, release, bangumi) -> Verdict
TITLE_PARSEDtransform hook(release) -> release | None
TORRENT_ADDINGtransform hook(AddRequest) -> AddRequest | None
HTTP_REQUESTtransform hook(HttpRequest) -> HttpRequest | None (headers only)
MESSAGE_TEMPLATEtransform 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, ...); return None for "no change". A wrong return type counts as a failure.
  • Five consecutive failures trip the circuit breaker and disable the plugin. RenameSkipped is not a failure. Never fall back to another naming method after a failure.
  • Filter hooks fail open (a crash accepts the torrent). Notifier send returns False on a backend refusal; it does not raise.
  • Events: plugin event kind must start with <plugin-id>.. Subclass SystemEvent to make a notifiable event. torrent.organized is delivered at least once: make handlers idempotent. Event paths are downloader-side paths; map them to local paths before touching the disk (for example a path_map option of downloader/from/to rows, as in the built-in hardlink plugin).
  • Blocking work (file IO, copies) goes in asyncio.to_thread; target_name is sync with no timeout, so no IO there.
  • Validate config deeply in field_validator so bad values give HTTP 422 at save time.
  • No native extensions (.so, .pyd, .dylib, .dll). Third-party pure-Python deps go in vendor/; 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-plugin commands, the manifest.
  • references/frontend.md: [[plugin.ui]], slots, AbHost, CSP, build template.
  • Examples (in the AB repo): examples/plugins/ has webhook-on-event, custom-rss-site, template-rename, nfo-writer, manual-pick, run-command, strm-writer, and the notifiers ntfy-notifier, slack-notifier, synology-chat-notifier, apprise-notifier, onebot-notifier, wpush-notifier.

Download now (ZIP)

Trending

Quiet this year.thin dataabout the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 0 mentionsMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 0 mentionsJun 2026: 0 mentionsJul 2026: 0 mentionsAug 2026: 0 mentionsSep 2026: 0 mentionsOct 2026: 0 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the EstrellaXD/Auto_Bangumi repository that our weekly crawl found: only 5 in all, so this is a hint, not a trend. There is no adoption data for this file yet.
  • In this repositoryOne other file it gives its agents.

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.