用途
validate-plugin 用于校验一个插件是否遵循正确的 Claude Code 插件格式。它适合在创建或修改插件之后运行,以便在发布前捕获结构性问题。
主要能力(执行的检查项)
- 目录结构:插件根目录下存在 .claude-plugin/plugin.json。
- plugin.json schema:必填字段齐全(name、description、version)。
- Skills 自动发现:每个 skills/<name>/SKILL.md 都是有效技能(Claude Code 从目录自动发现;plugin.json 中不得列出 skills 数组)。
- Commands 自动发现:每个 commands/<name>.md 都是有效命令(自动发现;plugin.json 中不得有 commands 数组)。
- Agents 自动发现:每个 agents/<name>.md 都是有效 agent(自动发现;plugin.json 中不得有 agents 数组)。
- plugin.json 中不得存在遗留数组:plugin.json 中出现 skills、commands 或 agents 数组属于校验错误(它们会导致 Claude Code 拒绝该插件)。
- SKILL.md frontmatter:每个技能包含 name、description 和 allowed-tools(不允许通配符)。
- Agent frontmatter:每个 agent 包含 name、description 和 model。
- 文件位置正确:skills/commands/agents 不位于 .claude-plugin/ 内。
- MCP 工具引用:allowed-tools 中的工具是合法的 mcp__plugin_ruflo-core_ruflo__* 标识符。
使用方式(步骤)
- 读取插件的 plugin.json,断言其中不存在 skills / commands / agents 数组。
- 用 glob 匹配 skills//SKILL.md、commands/.md、agents/*.md,并校验各自的 frontmatter。
- 对每个 SKILL.md,验证 frontmatter 具有必填字段,且 allowed-tools 不含通配符。
- 对每个 agent 的 .md 文件,验证 frontmatter 具有必填字段。
- 逐项报告每项检查的通过/失败,并给出可操作的修复建议。
适用场景
在创建或修改 Claude Code 插件之后、发布之前运行,用于发现结构性问题。
限制
资料未提供关于收费、价格、平台支持范围或具体效果的信息,暂未提供。