关于 create-plugin
用于生成同时适配 Claude Code 和 Codex 的插件仓库结构与文件内容,并提供 Git 和安装命令。适合需要从头搭建双平台插件的开发者。
主要功能
- 01收集仓库与插件配置
- 02按选择生成目录树
- 03输出必需文件内容
- 04提供 Git 与安装命令
适用场景
- 01搭建含 Skills 或 Agents 的插件
- 02为插件配置 Hooks 或 MCP 服务
- 03生成仓库初始化与安装步骤
MCP 相关
可按用户选择在插件中生成 `.mcp.json`,配置 MCP 服务。
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ alexsmedile/ hormozi-skills --skill create-plugin安装后在 Claude Code 中输入/create-plugin确认已加载。
详细介绍
技能:Plugin Creator(Claude Code + Codex)
目的
搭建一个 GitHub 仓库,使其同时可用作 Claude Code 和 Codex 的插件。为每个必需文件输出可直接复制的文件内容和 Git 命令。
步骤 1:收集输入信息
一次性询问用户以下问题:
- 仓库名称 — kebab-case 格式(例如
my-skills) - GitHub 用户名或组织名 —(例如
alexsmedile) - 插件描述 — 一句话
- 作者姓名
- 此插件包含什么? — 选择所有适用项:
- 技能(
skills/) - Agent(
agents/) - 钩子(
hooks/hooks.json) - MCP 服务(
.mcp.json)
- 技能(
- 许可证 — 默认值:
MIT
至少收集到仓库名称、GitHub 用户名、描述和作者姓名后,才能继续。
步骤 2:生成文件结构
根据用户的选择显示完整目录树,然后输出每个文件中可直接复制的内容。
必需文件
.claude-plugin/plugin.json
{
"name": "{{repo-name}}",
"version": "1.0.0",
"description": "{{description}}",
"author": {
"name": "{{author}}"
},
"homepage": "https://github.com/{{username}}/{{repo-name}}",
"repository": "https://github.com/{{username}}/{{repo-name}}",
"license": "{{license}}",
"keywords": []
}
skills/和agents/中的技能和 Agent 会自动发现 — 无需在plugin.json中指定路径。
.claude-plugin/marketplace.json
{
"name": "{{repo-name}}",
"owner": {
"name": "{{author}}"
},
"metadata": {
"description": "{{description}}",
"version": "1.0.0"
},
"plugins": [
{
"name": "{{repo-name}}",
"source": "./",
"description": "{{description}}",
"version": "1.0.0",
"author": {
"name": "{{author}}"
},
"homepage": "https://github.com/{{username}}/{{repo-name}}",
"repository": "https://github.com/{{username}}/{{repo-name}}",
"license": "{{license}}",
"category": "productivity"
}
]
}
.codex-plugin/plugin.json
{
"name": "{{repo-name}}",
"version": "1.0.0",
"description": "{{description}}",
"author": {
"name": "{{author}}"
},
"homepage": "https://github.com/{{username}}/{{repo-name}}",
"repository": "https://github.com/{{username}}/{{repo-name}}",
"license": "{{license}}",
"skills": "./skills/"
}
.codex-plugin/marketplace.json
{
"name": "{{repo-name}}",
"interface": {
"displayName": "{{repo-name}}"
},
"plugins": [
{
"name": "{{repo-name}}",
"source": {
"source": "local",
"path": "./"
},
"category": "Productivity"
}
]
}
.gitignore
.DS_Store
**/.DS_Store
output/*
!output/.gitkeep
output/.gitkeep
空文件 — 用于让 Git 跟踪 output/ 文件夹。
如果选择了技能:skills/example-skill/SKILL.md
---
name: example-skill
description: Replace this description with specific trigger phrases. Use when the user asks to "..."
---
# Skill: Example
Describe what this skill does and how to use it.
将
example-skill/重命名为实际的技能名称。技能的调用方式为/{{repo-name}}:example-skill。
如果选择了 Agent:agents/example-agent.md
---
name: example-agent
description: Replace with what this agent does and when to invoke it.
tools: Read, Write, Bash
model: sonnet
---
# Agent: Example
Describe the agent's role, expertise, and behavior here.
将其重命名为实际的 Agent 名称。
如果选择了钩子:hooks/hooks.json
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "echo 'File changed'"
}
]
}
]
}
}
如果选择了 MCP 服务:.mcp.json
{
"mcpServers": {
"example-server": {
"command": "${CLAUDE_PLUGIN_ROOT}/bin/server",
"args": []
}
}
}
步骤 3:关键规则
用户创建任何文件之前,清楚说明以下规则:
| 规则 | 详情 |
|---|---|
skills/ 和 agents/ 位于仓库根目录 | 切勿放在 .claude-plugin/ 或 .codex-plugin/ 内 |
| 插件名称 = 技能命名空间 | 插件 foo → 技能以 /foo:skill-name 的形式运行 |
plugin.json 会自动发现 | 除非使用自定义位置,否则无需列出 skills 或 agents 路径 |
不要在 marketplace.json 中添加 skills/agents | 在默认的 strict: true 下会导致架构验证错误 |
marketplace.json 中的 source: "./" | 指向仓库根目录 — 适用于单插件仓库 |
步骤 4:Git 设置 + 安装命令
按原样输出以下内容,并替换为用户提供的值:
# Create repo (if not exists)
gh repo create {{username}}/{{repo-name}} --public
# Init and push
git init
git add .
git commit -m "feat: initial plugin scaffold"
git remote add origin https://github.com/{{username}}/{{repo-name}}.git
git push -u origin main
在 Claude Code 中安装:
/plugin marketplace add {{username}}/{{repo-name}}
/plugin install {{repo-name}}@{{repo-name}}
更改后重新加载:
/reload-plugins
无需安装即可在本地测试:
claude --plugin-dir ./
步骤 5:安装后
技能使用命名空间:/{{repo-name}}:skill-name
Agent 会显示在 /agents 中
如需更新:推送到 GitHub,然后运行 /plugin marketplace update {{repo-name}}
每次发布时,在 plugin.json 和 marketplace.json 中递增 version — Claude Code 会使用版本号检测更新。