# AutoBangumi Plugins

Writes, tests and packs AutoBangumi plugins with the ab_sdk and ab-plugin CLI.

- Repository: https://github.com/EstrellaXD/Auto_Bangumi (8316 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-10-26
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add EstrellaXD/Auto_Bangumi --skill autobangumi-plugin -g -a claude-code -y`
Codex: `npx skills add EstrellaXD/Auto_Bangumi --skill autobangumi-plugin -g -a codex -y`
Cursor: `npx skills add EstrellaXD/Auto_Bangumi --skill autobangumi-plugin -g -a cursor -y`
Gemini CLI: `npx skills add EstrellaXD/Auto_Bangumi --skill autobangumi-plugin -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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

```python
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): ...
```

The rest: https://github.com/EstrellaXD/Auto_Bangumi/blob/HEAD/skills/autobangumi-plugin/SKILL.md
