mcpField
P
plugin-creator

plugin-creator

github.com/juliusbrussee开发944107 次安装11 周前更新
代码仓库

关于 plugin-creator

plugin-creator 是用于搭建 cave 插件的技能,面向创建并发布插件的开发者。它依据清单规范生成插件目录、能力占位文件和 README,并包含发布步骤。

主要功能

  1. 01按规范创建插件清单
  2. 02按需生成能力目录和占位文件
  3. 03支持命令、技能、Agent、主题、钩子及 MCP 标记
  4. 04生成带安装说明的 README
  5. 05提供市场发布步骤

适用场景

  1. 01为 cave 插件创建初始目录结构
  2. 02搭建包含命令或钩子的插件
  3. 03准备提交到插件市场的清单

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/juliusbrussee/caveman-code --skill plugin-creator

安装后在 Claude Code 中输入/plugin-creator确认已加载。

详细介绍

插件创建器

你可以通过脚手架搭建新的 cave 插件。cave 插件是一个发布在 GitHub(或任何 zip URL)上的目录,其中包含 .cave-plugin/plugin.json 清单,以及可选的 commands、skills、agents、themes 和 hooks 子目录。

清单架构

{
  "name": "my-plugin",
  "version": "0.1.0",
  "description": "A short, clear description of what this plugin does.",
  "author": "your-github-handle",
  "license": "MIT",
  "homepage": "https://github.com/your-handle/my-plugin",
  "caveVersion": ">=0.65.0",
  "tags": ["productivity", "git"],
  "capabilities": {
    "commands": true,
    "skills": true,
    "agents": false,
    "themes": false,
    "mcp": false,
    "hooks": []
  }
}
字段规则
  • name:使用 kebab-case,只能包含 a-z、0-9 和连字符。在市场中必须唯一。
  • version:semver(“major.minor.patch”)。
  • description:一句话,纯文本。
  • tags:用于匹配 caveman plugin search 的自由格式字符串。
  • capabilities.commands:如果存在 commands/ 目录,则设为 true。
  • capabilities.skills:如果存在 skills/ 目录,则设为 true。
  • capabilities.agents:如果存在 agents/ 目录,则设为 true。
  • capabilities.themes:如果存在 themes/ 目录,则设为 true。
  • capabilities.mcp:如果存在 .mcp.json,则设为 true。
  • capabilities.hooks:hook 条目数组(见下文)。
Hook 条目格式
{ "event": "PostToolUse", "command": "hooks/post-tool-use.sh", "matcher": "Bash" }

目录结构

my-plugin/
├── .cave-plugin/
│   └── plugin.json          ← required
├── commands/
│   └── my-command.md        ← markdown slash commands
├── skills/
│   └── my-skill/
│       └── SKILL.md         ← skill with frontmatter
├── agents/
│   └── my-agent.md          ← agent definition markdown
├── themes/
│   └── my-theme.json        ← theme JSON (cave theme format)
├── hooks/
│   └── post-tool-use.sh     ← hook scripts (chmod +x)
├── .mcp.json                ← optional MCP server definitions
└── README.md

脚手架搭建步骤

当用户要求创建插件时,请遵循以下步骤:

  1. 询问插件详情(名称、描述、需要哪些功能)。
  2. 使用上述架构创建 .cave-plugin/plugin.json。
  3. 仅创建需要的子目录(不要创建空目录)。
  4. 为每项已启用的功能添加占位文件:
    • commands/example.md,包含 frontmatter ---\ndescription: Example command.\n---\n\n# Example\n\nDescribe what this command does.\n
    • skills/example/SKILL.md,包含标准 skill frontmatter。
    • agents/example.md,包含 agent frontmatter。
    • hooks/example.sh,包含 #!/bin/bash\n# Hook: <event>\n,并运行 chmod +x。
  5. 创建 README.md,写入安装说明和简短描述。
  6. 验证清单:回显清单,并检查所有必填字段。

发布

搭建脚手架后,告知用户:

  1. 将插件推送到公开的 GitHub 仓库。
  2. 在 marketplace.json 中添加条目,将其提交到市场:
    {
      "plugins": [
        {
          "ref": "your-handle/my-plugin",
          "name": "my-plugin",
          "description": "...",
          "tags": ["..."],
          "version": "0.1.0"
        }
      ]
    }
    
  3. 用户使用以下命令安装:caveman plugin install your-handle/my-plugin

示例交互

用户:“创建一个添加 /summarize 命令和 post-save hook 的插件。”

你:

  1. 创建 .cave-plugin/plugin.json,内容为 "commands": true, "hooks": [{ "event": "PostToolUse", "command": "hooks/post-save.sh", "matcher": "Write" }]。
  2. 创建 commands/summarize.md,其中包含 summarize 斜杠命令的描述。
  3. 创建 hooks/post-save.sh,其中包含一个 hook 脚本存根。
  4. 创建 README.md。
  5. 报告创建的文件树。

评论

支持 Markdown