claude-code-plugin
FreeNo executable scriptsNot checkedClaude Code Plugin 開發、發布、安裝、更新與 Marketplace 管理完整指南
by miles990★ 26 GitHub starsAbout this skill
Claude Code Plugin 完整指南
建立、發布、安裝、更新、同步 Claude Code Plugin 的完整指南
適用場景
- 開發新的 Claude Code Plugin
- 發布 Plugin 到 Marketplace
- 安裝和更新 Plugin
- 管理 Plugin 版本
- 同步最新版本
- 建立自訂 Marketplace
Part 1: Plugin 架構
目錄結構
my-plugin/
├── .claude-plugin/
│ ├── plugin.json # Plugin manifest(必要)
│ └── marketplace.json # Marketplace 索引(選用)
├── commands/ # Slash 命令(在根目錄!)
│ └── my-command.md
├── skills/ # Agent Skills
│ └── my-skill/
│ └── SKILL.md
├── hooks/
│ └── hooks.json # Hook 配置
├── agents/ # Subagent 定義
├── .mcp.json # MCP 伺服器配置
├── CHANGELOG.md
└── README.md
⚠️ 重要:commands/、skills/、hooks/ 必須在根目錄,不要放進 .claude-plugin/
plugin.json 規範
{
"name": "my-plugin",
"version": "1.0.0",
"description": "Plugin 功能描述",
"author": {
"name": "作者名稱",
"email": "[email protected]"
},
"license": "MIT",
"keywords": ["keyword1", "keyword2"]
}
四大組件
| 組件 | 用途 | 觸發方式 | 檔案格式 |
|---|---|---|---|
| Commands | 用戶執行的斜線命令 | /command 手動 |
Markdown |
| Skills | 教 Claude 如何做事 | 自動根據上下文 | SKILL.md |
| Hooks | 事件驅動自動化 | 系統事件觸發 | JSON + Shell |
| MCP | 提供工具能力 | Claude 呼叫 | .mcp.json |
Part 2: 發布 Plugin
方式一:GitHub Marketplace(推薦)
Step 1: 建立 marketplace.json
{
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
"name": "my-marketplace",
"description": "我的 Plugin 集合",
"owner": {
"name": "username",
"email": "[email protected]"
},
"plugins": [
{
"name": "my-plugin",
"version": "1.0.0",
"source": "./",
"description": "Plugin 描述",
"category": "development"
}
]
}
Step 2: 推送到 GitHub
git add .
git commit -m "feat: add Plugin marketplace format"
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin main
git push origin v1.0.0
Step 3: 用戶安裝
# 添加 marketplace
/plugin marketplace add owner/repo
# 安裝 plugin
/plugin install my-plugin@my-marketplace
方式二:npm 發布
# 1. 在 package.json 中命名(加 claude-plugin- 前綴)
{
"name": "claude-plugin-my-plugin",
"version": "1.0.0"
}
# 2. 發布
npm publish
# 3. 用戶安裝
npm install -g claude-plugin-my-plugin
方式三:直接分享
# 用戶下載後本地安裝
/plugin install /path/to/my-plugin
Part 3: 安裝 Plugin
從 Marketplace 安裝
# 1. 先添加 marketplace(只需一次)
/plugin marketplace add owner/repo
# 2. 列出可用 plugins
/plugin marketplace list
# 3. 安裝 plugin
/plugin install plugin-name@marketplace-name
從 GitHub 直接安裝
# 完整路徑安裝
/plugin install github:owner/repo#path/to/plugin
# 範例
/plugin install github:miles990/evolve-plugin
本地安裝
# 從本地目錄安裝
/plugin install /path/to/my-plugin
查看已安裝
# 列出所有已安裝的 plugins
/plugin list
# 查看詳細資訊
/plugin info plugin-name@marketplace
解除安裝
# 解除安裝特定 plugin
/plugin uninstall plugin-name@marketplace
# 範例
/plugin uninstall evolve@evolve-plugin
# 強制解除安裝(忽略相依性)
/plugin uninstall plugin-name@marketplace --force
解除安裝注意事項:
- 解除安裝不會移除 marketplace,只移除已安裝的 plugin
- 如果其他 plugin 依賴此 plugin,會警告
- 解除安裝後可隨時重新安裝
Part 4: 更新 Plugin
檢查更新
# 檢查所有 plugins 是否有更新
/plugin update --check
# 檢查特定 plugin
/plugin update --check plugin-name@marketplace
執行更新
# 更新特定 plugin
/plugin update plugin-name@marketplace
# 更新所有 plugins
/plugin update --all
自動版本檢查流程
本地版本 → 遠端版本 → 比較
↓ ↓
plugin.json GitHub API / marketplace.json
↓
若遠端較新 → 提示用戶更新
手動版本檢查
# 取得本地版本
cat ~/.claude/plugins/installed_plugins.json | jq '.plugins["plugin@marketplace"][0].version'
# 取得遠端版本
curl -s https://raw.githubusercontent.com/owner/repo/main/.claude-plugin/plugin.json | jq -r '.version'
Part 5: 版本控管
版本位置(必須同步)
| 位置 | 說明 |
|---|---|
.claude-plugin/plugin.json |
Plugin manifest |
.claude-plugin/marketplace.json |
Marketplace 索引 |
skills/*/SKILL.md |
Skill 版本(如適用) |
CHANGELOG.md |
變更記錄 |
| Git tag | 發布標記 |
語意化版本
MAJOR.MINOR.PATCH
│ │ └── Bug fixes(修復)
│ └── 新功能(向後相容)
└── 破壞性變更(不相容)
發布檢查清單
# 更新所有版本位置
- [ ] plugin.json → version
- [ ] marketplace.json → plugins[].version
- [ ] SKILL.md → version: (如適用)
- [ ] CHANGELOG.md → 新條目
- [ ] README.md → 版本徽章
# Git 操作
git add .
git commit -m "chore: bump version to vX.Y.Z"
git tag -a vX.Y.Z -m "Release vX.Y.Z: 描述"
git push origin main
git push origin vX.Y.Z
CHANGELOG.md 格式
## [1.1.0] - 2026-01-16
### Added
- 新功能描述
### Changed
- 變更描述
### Fixed
- 修復描述
### Security
- 安全修復
Part 6: 同步最新版本
從主 repo 同步到獨立 plugin repo
當 plugin 是從主專案分離出來時:
# 1. 複製 skills 目錄
cp -r /path/to/main-project/skills /path/to/plugin-repo/
# 2. 更新版本
# 編輯 plugin.json, marketplace.json
# 3. 提交並推送
cd /path/to/plugin-repo
git add -A
git commit -m "chore: sync with main-project vX.Y.Z"
git push origin main
Install claude-code-plugin in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the claude-code-plugin skill do?
Claude Code Plugin 開發、發布、安裝、更新與 Marketplace 管理完整指南
How do I install the claude-code-plugin skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the claude-code-plugin skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic