Agent skill

Plugin Migration

by ncatbot in ncatbot/NcatBot

将 NcatBot 4.4/4.5 版本插件迁移到 5.0。包括导入路径、注册方式、Config/Data API、事件类型、消息构造的全面映射。Use when: 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级。

MITAuto-check passed

Install Plugin Migration

skills CLI
$ npx skills add ncatbot/NcatBot --skill plugin-migration -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ncatbot/NcatBot plugin-migration --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ncatbot/NcatBot.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/plugin-migration .claude/skills/plugin-migration && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
plugin-migration
GitHub stars
115
Token cost
~1.2k tokens
SKILL.md length
337 words
Files
4 (incl. references)
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

将 NcatBot 4.4/4.5 版本插件迁移到 5.0。包括导入路径、注册方式、Config/Data API、事件类型、消息构造的全面映射。Use when: 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级。

  • Works in 4 steps: :版本识别 → :代码扫描 → :逐项迁移 → …
  • : 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级
  • SKILL.md covers 协作技能, 工作流, 迁移实践要点 and 参考文件
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Plugin Migration is an agent skill from ncatbot/NcatBot. 将 NcatBot 4.4/4.5 版本插件迁移到 5.0。包括导入路径、注册方式、Config/Data API、事件类型、消息构造的全面映射。Use when: 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级。

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/api-mapping.md`, `references/checklist.md` and `references/import-mapping.md`).

The repository describes itself as: NapCat Python SDK;快速开发你的 QQ 机器人. The licence is MIT.

When your agent uses it

  • : 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级

Example prompts

  • “/plugin-migration”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. :版本识别
  2. :代码扫描
  3. :逐项迁移
  4. :清单验证

What it can do on your machine

Read from SKILL.md and the folder at commit c26300a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Plugin Migration loads about 1.2k tokens when it runs, and up to ~7.9k if it reads all its reference files. Until then it costs about 41 tokens; SKILL.md has 337 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ncatbot/NcatBot at commit c26300a, republished under its MIT licence (© ncatbot). 337 words, ~1,209 tokens.

Download SKILL.mdSave it as .claude/skills/plugin-migration/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
plugin-migration
description
将 NcatBot 4.4/4.5 版本插件迁移到 5.0。包括导入路径、注册方式、Config/Data API、事件类型、消息构造的全面映射。Use when: 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级。
license
MIT

技能指令

你是 NcatBot 插件迁移助手。帮助用户将 4.4/4.5 版本的插件迁移到 5.2.0+ 版本。

协作技能

需要做什么委托给
理解 5.0 框架用法、APIframework-usage
定位框架内部实现细节codebase-nav
验证迁移后的插件testing-framework
修改框架本体(如发现兼容问题)framework-dev

工作流

text
1. 版本识别 → 2. 代码扫描 → 3. 逐项迁移 → 4. 清单验证
Step 1:版本识别

读取插件源码,根据以下特征判断来源版本:

特征版本
from ncatbot.plugin_system import NcatBotPlugin, filter_registry4.4
register_user_func() / register_admin_func()4.4
register_handler("event_type", handler)4.4
@command_registry.command("cmd")4.4
@filter_registry.group_filter / @filter_registry.private_filter4.4
from ncatbot.plugin_system.builtin_mixin import NcatBotPlugin4.5
self.register_config("key", default, description=..., value_type=...)4.5
方法名即命令名(无装饰器,方法名自动注册为命令)4.5
self.data['config']['key'] 嵌套访问配置4.5
self.event_bus.publish_async()4.4
on_change_xxx 配置变更回调方法4.5
dependencies = {} 类属性4.4 / 4.5

部分插件可能混用 4.4 和 4.5 的模式。按出现的特征逐条迁移即可。

Step 2:代码扫描

列出插件中需要迁移的所有项目,按类别分组:

  1. 导入路径 — 所有 import 语句
  2. 注册方式 — 命令/事件/过滤器的注册
  3. Config API — 配置的注册和访问
  4. 消息构造 — MessageArray、Image 等消息段
  5. 事件类型 — MessageEvent、GroupMessageEvent 等
  6. BotAPI 调用 — self.api.xxx()
  7. 元数据 — 类属性、manifest
  8. 生命周期 — on_load/on_close 中的逻辑
  9. 其它 — 未归类的变更
Step 3:逐项迁移

按照 references 中的映射表执行变更。核心原则:一次改一类,改完立即验证。

建议顺序:

  1. 创建/更新 manifest.toml(→ checklist.md)
  2. 更新全部导入路径(→ import-mapping.md)
  3. 迁移命令/事件注册(→ api-mapping.md § 注册方式)
  4. 迁移 Config API(→ api-mapping.md § Config)
  5. 更新消息构造(→ api-mapping.md § 消息段)
  6. 细化事件类型与类型判断(→ api-mapping.md § 事件类型)
  7. 迁移 BotAPI 调用(self.api.xxx() → self.api.qq.xxx() → api-mapping.md § BotAPI)
  8. 清理废弃代码(dependencies 类属性、未使用导入、print → LOG)
  9. 更新 __init__.py
Step 4:清单验证

使用 checklist.md 逐项验证迁移结果。

验证手段:

  1. get_errors 检查语法/类型错误
  2. 编写验证脚本确认 manifest 可解析、入口类可导入、handler 已注册
  3. 如有测试环境,使用 testing-framework 技能运行冒烟测试

迁移实践要点

以下要点来自 Lolicon4xx 插件的实际迁移实践:

易错点
  1. Image(path) → Image(file=path):5.0 的 Image 是 Pydantic model,不接受位置参数,必须用关键字参数 file=。
  2. self.data['config']['key'] ≠ self.get_config('key'):4.5 中 data 结构嵌套了 config,5.0 中 config 和 data 完全分离。
  3. on_change_xxx 配置回调不存在于 5.0:5.0 ConfigMixin 没有配置变更回调机制,需自行处理。
  4. dependencies = {} 类属性需移除:依赖声明移至 manifest.toml 的 [dependencies]。
  5. name/version 类属性须与 manifest.toml 一致:两处都要声明,且值必须相同。
  6. 事件参数命名惯例:4.5 常用 msg,5.0 推荐 event。
  7. 类型判断改用 isinstance:hasattr(msg, "group_id") → isinstance(event, GroupMessageEvent)。
  8. self.api.xxx() → self.api.qq.xxx():5.2.0+ 采用多平台架构,BotAPIClient 是纯路由器,QQ API 必须通过 self.api.qq 访问(如 self.api.qq.post_group_msg(...))。直接调用 self.api.post_group_msg(...) 会 AttributeError。
  9. registrar.on_command() vs registrar.qq.on_group_command():前者是跨平台装饰器(群+私聊均触发),后者仅限 QQ 群消息。QQ 专用插件推荐使用 registrar.qq.* 系列。
不需要改的
  1. self.api.qq.post_group_forward_msg() — 5.2 多平台架构下必须通过 api.qq 访问(注意:旧代码中的 self.api.post_group_forward_msg() 需要改为 self.api.qq.post_group_forward_msg())
  2. ForwardConstructor 的 attach_image()/attach_text()/attach_message() — 接口未变,仅导入路径变更。.to_forward() 和 .build() 均可用(互为别名),5.2.0+ 示例中多使用 .build()
  3. MessageArray 的生成器构造 — MessageArray(Image(file=x) for x in imgs) 仍有效
  4. event.reply() 方法 — 签名基本一致(5.2.0+ 新增 video 和 at_sender 参数)
  5. self.api 的注入 — 框架自动注入 BotAPIClient 实例,但 5.2.0+ 使用方式变为 self.api.qq.xxx() 而非直接 self.api.xxx()

参考文件

文件内容
import-mapping.md完整的 4.4/4.5 → 5.0 导入路径映射
api-mapping.md注册方式、Config、消息构造、BotAPI、事件类型的全面映射
checklist.md迁移完成后的逐项验证清单
可参考的实际插件
路径说明
docs/docs/examples/common/01_hello_world/main.py最简插件:registrar.on_group_command() + event.reply() 用法
docs/docs/examples/qq/01_event_registration/main.pyQQ 事件注册:on_command / on_message / on_notice / priority
docs/docs/examples/qq/02_command_binding/main.py命令参数绑定:str / int / At / Optional / aliases
plugins/version_notifier/实际运行的跨平台插件,含 manifest.toml
plugins/Lolicon/从 4.5 迁移而来的实际插件

© ncatbot, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in .agents/skills/plugin-migration of ncatbot/NcatBot.

  • SKILL.md
  • references/api-mapping.md
  • references/checklist.md
  • references/import-mapping.md

Open the folder on GitHubat commit c26300a

Compare with similar skills

Plugin Migration next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Plugin Migration compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Plugin Migration this skillncatbot/NcatBot115—~1.2kAutomated safety check: PassMIT
Reversible MigrationJuliusBrussee/caveman110k1 repos~196Automated safety check: PassApache-2.0
Database Migrationsaffaan-m/ECC274k4 repos~3kAutomated safety check: PassMIT
Database Migrationsaffaan-m/ECC274k1 repos~2.4kAutomated safety check: PassMIT
Safe Database Migration Patternsaffaan-m/ECC274k—~3.3kAutomated safety check: PassMIT
Migrate Createruvnet/ruflo74k—~583Automated safety check: NotesMIT

Similar skills

  • Reversible Migration

    JuliusBrussee/caveman

    Implement reversible compatibility-safe transitions. Use for schema, data, API, protocol, configuration, or dependency migrations requiring rollback and…

    110k GitHub starsUsed in 1 repo~196 tokens
    DevelopmentAuto-check passed
  • Safe, reversible database migration patterns: forward-only production changes, expand-contract zero-downtime renames, concurrent indexes, batched backfills, and per-tool workflows for PostgreSQL…

    274k GitHub starsUsed in 4 repos~3k tokens
    DatabasesAuto-check passed
  • Şema değişiklikleri, veri migration'ları, rollback'ler ve PostgreSQL, MySQL ve yaygın ORM'ler (Prisma, Drizzle, Django, TypeORM, golang-migrate) arasında sıfır kesinti deployment'ları için…

    274k GitHub starsUsed in 1 repo~2.4k tokens
    DatabasesAuto-check passed
  • Rules and examples for safe, reversible schema changes in production: zero-downtime column and index changes, large data backfills and ORM migration workflows.

    274k GitHub stars~3.3k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Migrate Create

    ruvnet/ruflo

    Create a new sequentially numbered database migration with up/down SQL files

    74k GitHub stars~583 tokensUpdated today
    DatabasesAuto-check: notes
  • Migration

    kortix-ai/suna

    How to change the database schema in this repo. An agent skill from kortix-ai/suna.

    20k GitHub stars~1.2k tokensUpdated today
    DatabasesAuto-check passed

More from ncatbot/NcatBot

All 12 skills in this repo
  • Code Nav

    ncatbot/NcatBot

    定位 NcatBot 代码实现:锁定模块目录、找到关键类/函数、追踪调用链。当文档不够时才读代码,用搜索而非遍历。Use when: 找代码实现、哪个文件、哪个类、追踪调用链、定位 bug 行号、代码在哪、模块目录、源码定位。

    115 GitHub stars~460 tokensUpdated 3 days ago
    Auto-check passed
  • Docs Maintenance

    ncatbot/NcatBot

    维护 NcatBot 项目文档、示例、Skills 知识资产。编写/编辑文档、修复文档问题、文档结构规范审查。Use when: 写文档、改文档、新增文档、修复断链、修复索引、修复代码块标注、文档规范、文档模板、文档结构设计、docs maintenance。

    115 GitHub stars~722 tokensUpdated 3 days ago
    Auto-check passed
  • Docs Sync

    ncatbot/NcatBot

    整体/局部防腐检查:Docs 内部链接断裂、README 索引不同步、guide↔reference 内容不一致、examples 导入过时、Code↔Docs API 对齐。逐文件检查,最大化并发 subagent。Use when: docs 防腐、docs 链接、docs 断链、断链检查、docs 审计、docs audit、code docs 对齐、reference 过时、guide…

    115 GitHub stars~1.3k tokensUpdated 3 days ago
    Auto-check passed
  • Framework Usage

    ncatbot/NcatBot

    使用 NcatBot 框架开发 QQ 机器人或跨平台 Bot。当用户需要快速体验、创建插件、注册事件处理、发送消息、调用 Bot API、使用 Mixin/Hook、使用 CLI 工具、编写插件测试、或调试运行问题时触发此技能。Use when: 开发…

    115 GitHub stars~1.2k tokensUpdated 3 days ago
    Auto-check passed
  • Release

    ncatbot/NcatBot

    发布 NcatBot 新版本到 PyPI 和 GitHub Release,或仅编排 Commit 推送到 main。从工作区变更编排 commit 到最终发布的全链路流程。Use when: 发版、release、发布、changelog、版本号、pick commits、挑选提交、release notes、编排 commit、push、推送。

    115 GitHub stars~513 tokensUpdated 3 days ago
    Auto-check passed
  • Skills Sync

    ncatbot/NcatBot

    检查、报告、修复 Skills 间链接内容不同步,以及 Skills↔Docs 内容链接不同步。逐文件检查,最大化并发 subagent。Use when: skill 同步、skill 断链、skill 引用、skill 过时、skill audit、skills 一致性、skill 检查、skill↔docs。

    115 GitHub stars~694 tokensUpdated 3 days ago
    Auto-check passed

Questions about Plugin Migration

What does Plugin Migration do?

将 NcatBot 4.4/4.5 版本插件迁移到 5.0。包括导入路径、注册方式、Config/Data API、事件类型、消息构造的全面映射。Use when: 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级。. Plugin Migration is an agent skill from ncatbot/NcatBot.

When should I use Plugin Migration?

Plugin Migration fits situations like: : 迁移插件、升级插件、4 转 5、老版本、旧版本、migration、upgrade、plugin migration、版本升级.

How do I install Plugin Migration in Claude Code?

Run `npx skills add ncatbot/NcatBot --skill plugin-migration -a claude-code`. Or copy the skill folder (.agents/skills/plugin-migration in ncatbot/NcatBot) into .claude/skills/plugin-migration in your project. Claude Code loads it when a task matches its description.

How do I install Plugin Migration in Codex?

Run `npx skills add ncatbot/NcatBot --skill plugin-migration -a codex`. Or copy the skill folder (.agents/skills/plugin-migration in ncatbot/NcatBot) into .agents/skills/plugin-migration in your project. Codex loads it when a task matches its description.

Can I use Plugin Migration in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ncatbot/NcatBot --skill plugin-migration -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/plugin-migration, .gemini/skills/plugin-migration, .github/skills/plugin-migration and .opencode/skills/plugin-migration in your project.

What does Plugin Migration need to run?

SKILL.md names no scripts, command-line tools or credentials: Plugin Migration is instructions for the agent only.

Does Plugin Migration access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Plugin Migration safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Plugin Migration use?

Plugin Migration is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Plugin Migration use?

About 1.2k tokens (SKILL.md is roughly 4.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 6.7k tokens, read only when the agent opens those files.

What are the alternatives to Plugin Migration?

Skills that share tags, products or a category with Plugin Migration: Reversible Migration (JuliusBrussee/caveman, 110k stars), Database Migrations (affaan-m/ECC, 274k stars), Database Migrations (affaan-m/ECC, 274k stars) and Safe Database Migration Patterns (affaan-m/ECC, 274k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Plugin Migration?

ncatbot (a GitHub organization) maintains it in ncatbot/NcatBot, which has 115 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 4, 2026.

Source: ncatbot/NcatBot on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.