Plugins + Marketplace:Claude Code 一切扩展的载体
原文:https://code.claude.com/docs/en/plugins(开发指南) 配套:
/en/discover-plugins、/en/plugin-marketplaces、/en/plugins-reference官方定位:Create plugins to extend Claude Code with skills, agents, hooks, and MCP servers. 官方 marketplace:github.com/anthropics/claude-plugins-official
🔥 影响力卡片
| 维度 | 数据 |
|---|---|
| 官方 marketplace 体量 | 172 个 plugin(本机 marketplace.json 计数,2026-05-13) |
| 分类分布 | development 78 · productivity 33 · database 16 · security 10 · monitoring 8 · deployment 5(其他次要) |
| 内置 + 外部分布 | 35 个 Anthropic 自家 + 15 个企业级 external(asana / context7 / discord / firebase / github / gitlab / linear / playwright / serena / terraform / telegram / iMessage 等)+ 122 个第三方厂商 |
| 你本机已装 | superpowers@claude-plugins-official 5.1.0 + understand-anything@understand-anything 2.3.2(后者用了第三方 marketplace github.com/Lum1104/Understand-Anything) |
| 引入早期版本 | /plugin 命令早就有(本机 changelog 全段在持续迭代);v2.1.129 新加 --plugin-url 远程加载;v2.1.128 --plugin-dir 支持 .zip |
| 提交入口 | claude.ai/settings/plugins/submit 或 platform.claude.com/plugins/submit |
🎯 为什么必读
1. 这是 Claude Code 跟其他 AI 编码工具最显著的差别点。
Cursor / Windsurf 都是闭环 IDE;Aider / OpenCode 是开源但生态小;只有 Claude Code 有一个双层架构:CLI + 浏览器 + IDE 共享一套插件协议(marketplace + plugin.json)。这意味着:
- Anthropic 自己做基础(skills / hooks / subagents / MCP)
- 第三方厂商(Adobe / Airtable / Linear / Salesforce / Endor Labs / 42Crunch)直接发自己的 plugin
- 个人开发者 5 分钟造一个 plugin 装上
2. plugin 是”所有扩展机制的总线”。
很多人以为 “plugin” 跟 “skill” 是两个独立功能。错。plugin 是容器,里面装的是:
| 子组件 | 干啥 |
|---|---|
skills/ | 模型自动调用的”技能”(本系列就是 skills 的产物) |
commands/ | 用户输入 slash 调用的命令(老格式) |
agents/ | 自定义 subagent(独立 system prompt + 工具集) |
hooks/hooks.json | 事件触发器(写文件后 / commit 前等) |
.mcp.json | MCP server 配置(接入外部 API) |
.lsp.json | LSP server 配置(实时语法/类型补全) |
monitors/monitors.json | 后台观察器(尾巴跟踪 log,推送给 Claude) |
bin/ | 加到 Bash PATH 的可执行文件 |
settings.json | 默认 settings 覆盖 |
装一个 plugin = 同时引入上面任意若干组件。这是 plugin 真正的力量。
3. Marketplace 模型是去中心化的 — 但官方那条权威性强。
- 官方 marketplace = anthropics 自己维护的 GitHub repo,包括内部 + 经过 Anthropic 引荐的第三方
- 任何 GitHub repo 都可以是 marketplace(只需根目录有
.claude-plugin/marketplace.json) - 团队可以自建 private marketplace,内部分发
一句话总结
plugin = 一个目录 +
.claude-plugin/plugin.json清单,里面可以塞 8 种子组件;marketplace = 一个 GitHub repo +.claude-plugin/marketplace.json索引,列若干 plugin 的源。整个 Claude Code 的扩展生态都建在这两层之上。
💎 金句墙
★ “Plugins let you extend Claude Code with custom functionality that can be shared across projects and teams.” “Plugin 让你能用自定义功能扩展 Claude Code,跨项目和团队共享。” —— 🟢 关键词是 “shared” — 不是单机定制,是可以分发给他人的
★ “Plugin skills are always namespaced (like
/my-plugin:hello) to prevent conflicts when multiple plugins have skills with the same name.” “Plugin 的 skill 永远带命名空间,避免多个 plugin 有同名 skill 时冲突。” —— 🟢 这一句决定了 plugin 生态规模能上去 — 你可以装 50 个 plugin 不会撞名
★ “To keep a plugin internal to your team, host the marketplace in a private repository.” “想让 plugin 留在团队内部?把 marketplace 托管到 private repo 就行。” —— 🟢 私有 marketplace 是企业采纳的关键 — 闭源、不上 npm、走 GitHub 私库就够
★ “
claude plugin details <name>to show a plugin’s component inventory and projected per-session token cost.” (changelog v2.1.139) “claude plugin details <name>显示 plugin 的组件清单和预计每 session token 开销。” —— 🟢 v2.1.139 新加的命令,直接面对”plugin 装多了 context 爆炸”的最大痛点
📋 核心精读
1. 装一个 plugin 的 5 种方法
# A. 官方 marketplace 已经知名的
claude plugin install <name>@<marketplace>
# 例: claude plugin install superpowers@claude-plugins-official
# B. 加自定义 marketplace 后再装
# (在 /plugin UI 里添加 marketplace github repo,再 install)
# C. 本地开发态加载(无需安装)
claude --plugin-dir ./my-plugin
claude --plugin-dir ./my-plugin.zip # v2.1.128+ 支持 zip
# D. 从 URL 拉 zip 单次加载(v2.1.129+)
claude --plugin-url https://example.com/my-plugin.zip
# E. 多个一起加载
claude --plugin-dir ./a --plugin-dir ./b
claude --plugin-url "https://x.com/a.zip https://x.com/b.zip"
/plugin 是交互式 UI 面板,日常用这个最方便。
2. plugin 目录结构(必背)
my-plugin/
├── .claude-plugin/
│ └── plugin.json # 清单 — 必须在这里,别放其他东西
├── skills/
│ └── my-skill/
│ └── SKILL.md # 一个 skill 一个文件夹
├── commands/ # 老格式 slash 命令(skills 之前的方式)
├── agents/
│ └── my-agent.md # 自定义 subagent
├── hooks/
│ └── hooks.json # 钩子配置
├── .mcp.json # MCP server 列表
├── .lsp.json # LSP server 列表
├── monitors/
│ └── monitors.json # 后台观察器
├── bin/ # 加到 PATH 的可执行
└── settings.json # 默认 settings 覆盖
最常见的错误(docs 单独警告):
❌ 不要把
commands/、agents/、skills/、hooks/放进.claude-plugin/里!只有plugin.json放在.claude-plugin/,其他全部在 plugin 根目录。
3. plugin.json 最小可行清单
{
"name": "my-first-plugin",
"description": "A greeting plugin to learn the basics",
"version": "1.0.0",
"author": { "name": "Your Name" }
}
name 字段决定命名空间 — skills/hello 会变成 /my-first-plugin:hello。
version 字段是版本管理的关键:
- 设了:用户只在你
version字段 bump 后才收到更新 - 没设(git 分发场景):每次 commit 都算新版
4. 官方 marketplace 速览(172 个 plugin 里值得知道的)
A. 安全 / 代码质量(10 个)
42crunch-api-security-testing— API 安全审计 → 修复aikido— SAST + secrets + IaC 漏洞扫描ai-plugins(Endor Labs)— 软件供应链扫描security-guidance— Anthropic 自家最佳实践
B. 开发框架 / LSP(35 个内部 + 各语言 LSP plugin)
typescript-lsp、pyright-lsp、gopls-lsp、rust-analyzer-lsp、ruby-lsp、clangd-lsp、jdtls-lsp、kotlin-lsp、swift-lsp、php-lsp、lua-lsp、csharp-lsp— 所有主流语言都有官方 LSP plugin!code-review、pr-review-toolkit、feature-dev、code-modernization、code-simplifier— 开发流程类commit-commands、hookify、session-report— 工程纪律frontend-design— 前端审美一键审查plugin-dev、mcp-server-dev、skill-creator、agent-sdk-dev— meta 类(写 plugin 的 plugin)
C. 第三方服务(external_plugins,15 个)
| Plugin | 干啥 |
|---|---|
asana | Asana 任务 |
context7 | 实时获取最新库文档(很多人用) |
discord | Discord channel |
firebase | Firebase 项目 |
github | GitHub PR / issue(深度集成) |
gitlab | 同上 GitLab |
greptile | 跨 repo 语义搜索 |
imessage | iMessage 联动(macOS) |
laravel-boost | Laravel 项目脚手架 |
linear | Linear 任务 |
playwright | 浏览器自动化(跟 Chrome 扩展平行) |
serena | 多步任务编排 |
telegram | Telegram 推送 |
terraform | IaC |
fakechat | 假聊天(测试用) |
D. 厂商类(部分举例,来自 marketplace.json):
adobe-for-creativity(Adobe 自家)— Photoshop/Illustrator APIairtable(Airtable 自家)— 数据库 + 视图agentforce-adlc(Salesforce)— Agentforce 全 lifecycle- 等等
E. 学习类 / 风格类
learning-output-style— 教学风输出explanatory-output-style— 详细解释math-olympiad— 奥赛风格
5. 你已经装的两个 plugin 是什么(本机案例研究)
# 本机 ~/.claude/plugins/installed_plugins.json:
superpowers@claude-plugins-official 5.1.0 # 装于 2026-04-02,更新到 2026-05-05
understand-anything@understand-anything 2.3.2 # 装于 2026-04-29
superpowers(Anthropic 半官方,通过 marketplace 分发):
- 22+ skills:
brainstorming、writing-skills、writing-plans、test-driven-development、debugging、receiving-code-review、requesting-code-review、dispatching-parallel-agents、subagent-driven-development、executing-plans、using-git-worktrees、verification-before-completion等 - 是 “process skills” 套件 — 教 Claude 怎么做事(TDD 怎么走、调试怎么走)
- 你正在用的
content-curation-auto是这一类的延伸(虽然不在 superpowers 里)
understand-anything(社区 plugin,Lum1104/Understand-Anything 维护):
- 8 个 skill:
understand、understand-chat、understand-diff、understand-domain、understand-knowledge、understand-onboard、understand-dashboard、understand-explain - 7 个 specialist subagent:
project-scanner、file-analyzer、architecture-analyzer、article-analyzer、assemble-reviewer、graph-reviewer、domain-analyzer、tour-builder、knowledge-graph-guide - 干啥:自动给一个 codebase 生成可视化的 knowledge graph
6. 自己造 plugin — 5 分钟走完
# 1. 建 plugin 目录
mkdir my-first-plugin
mkdir my-first-plugin/.claude-plugin
mkdir -p my-first-plugin/skills/hello
# 2. 写 manifest
cat > my-first-plugin/.claude-plugin/plugin.json <<'EOF'
{
"name": "my-first-plugin",
"description": "A test plugin",
"version": "1.0.0"
}
EOF
# 3. 写 skill
cat > my-first-plugin/skills/hello/SKILL.md <<'EOF'
---
description: Greet the user with a personalized message
---
Greet the user named "$ARGUMENTS" warmly and ask how you can help.
EOF
# 4. 加载测试
claude --plugin-dir ./my-first-plugin
# 然后在 session 里:
> /my-first-plugin:hello Alex
7. 把它发出去 — 三种分发方式
A. 个人/团队私库(最常见):
- 把 plugin 推到 GitHub repo(可以 public 也可以 private)
- 在 repo 根加
.claude-plugin/marketplace.json列你的 plugin - 别人在
/pluginUI 里加你的 marketplace,就能装
B. 提交到 Anthropic 官方 marketplace:
claude.ai/settings/plugins/submit填表- 评审通过后进
anthropics/claude-plugins-official的 plugin 列表
C. 在你自己的 CLI 里提示用户安装(Recommend your plugin from your CLI):
- 文档地址:
/en/plugin-hints - 让你的工具自己唤起 Claude Code 装 plugin
8. 真实坑(从 v2.1.128-139 的修复列表反推)
| 坑 | 现象 | 解 |
|---|---|---|
| 文件结构错 | skills/agents/hooks 被错放到 .claude-plugin/ 里 | docs 警告页明确指出,只 plugin.json 放那 |
version 不设 → 每次 commit 都”更新” | 用户每次启动都触发 update 检查 | 一定显式设 version |
MCP server 配置 ${user_config.X} 引用空字段 | plugin 加载失败 | 把 optional 字段标好,不要留空 |
| 巨型 plugin 占 context | 装 5+ plugin 后 context 占用倍增 | 用 claude plugin details <name> 看 token cost(v2.1.139+ 才有) |
| Windows plugin 缓存不全 | MCP server 起不来 | 全删 ~/.claude/plugins/cache/ 重装 |
| disable 后 hooks 失败 | cache 清理时被删 | upgrade 到 v2.1.136+ |
skills 配置里设 skills: ... 字段反而隐藏默认 skills 目录 | plugin 加载后 skill 不见了 | 别在 plugin.json 里加 skills 字段(让默认目录工作) |
9. 命令速查表
| 命令 | 用 |
|---|---|
/plugin | 交互式管理面板 |
/reload-plugins | 改了本地 plugin 立即重载(无需重启) |
claude plugin install <name>@<marketplace> | 安装 |
claude plugin details <name> | 看组件清单 + token cost |
claude plugin update | 更新所有 |
claude plugin update <name> | 更新指定 |
claude plugin prune | 移除孤立 plugin 依赖(v2.1.128+) |
claude plugin validate | 校验 plugin.json / marketplace.json 格式 |
claude plugin uninstall --prune | 卸载 + 级联清依赖 |
claude --plugin-dir ./path | 本地加载(开发) |
claude --plugin-url https://... | 远程 zip 加载(单次) |
🟢 译者总评 — 给独立开发者的建议
1. 把 marketplace 当成”AI 时代的 brew formula”。
你装 macOS 软件的工作流是:brew search → brew install <name>。/plugin UI 让 Claude Code 完全同款。这意味着:未来你想给 Claude Code 加任何能力,先去看 marketplace 有没有,有就直接装。
2. 但不要装得太多 — 每个 plugin 都吃 context window
claude plugin details <name> 看每个 plugin 的预计 token 开销。建议:
- 常驻:
superpowers(过程类 skill 是 daily driver) - 按项目装:
typescript-lsp/pyright-lsp等 LSP plugins(语法相关) - 按需装:
linear/github/context7(外部服务集成) - 写代码时装:
code-review、feature-dev、pr-review-toolkit
3. 自己造一个私人 plugin
独立开发者最该自己造的就是私人 plugin:把自己反复用的工作流(README 模板、deployment 检查清单、新建项目脚手架、frontend 审美规则)装进 5-8 个 skill,做成 plugin 结构。
为什么是 plugin 而不是散装 skill?统一管理 + 跨机同步:本地 --plugin-dir 用熟了之后,发到自己 GitHub 当 marketplace,换电脑装一行命令就回到熟悉的工作环境。
比想象的简单。如果已经在 ~/.claude/skills/ 写过 SKILL.md,只需要把它装进 plugin 结构(加一个 .claude-plugin/plugin.json 描述文件)即可。
4. 警惕”看见 plugin 就装”的冲动
172 个 plugin 大多数日常用不到几个。挑装原则:
- ✅ Anthropic 自家(高质量保证)
- ✅ 你常用服务的厂商自家(Adobe、Airtable、Linear、Salesforce)
- ✅ 中立的开发工具(LSP plugins、code-review)
- ⚠️ 个人维护的小 plugin → 看 star、看更新频率、看作者历史
- ❌ 三个月没更新的 → 装了等于把废代码塞进 context
🔗 延伸阅读
- 同系列下篇:
05-skills-system.md(Skill 是 plugin 里最重要的子组件,单独深挖) - 同系列:
06-hooks.md、07-mcp-ecosystem.md、08-subagents.md— plugin 其他三种子组件 - 官方:
/en/plugins-reference— 完整 plugin.json / marketplace.json schema - 官方:
/en/plugin-marketplaces— 自建 marketplace 完整指南 - 第三方榜单参考:https://github.com/davila7/claude-code-templates(社区维护的 plugin 列表,跟 Anthropic 官方 marketplace 互补)
🔗 调研来源(可校验)
- 主原文:
https://code.claude.com/docs/en/plugins - 本机已装 plugin 状态:
~/.claude/plugins/installed_plugins.json - 官方 marketplace 全量清单:
~/.claude/plugins/marketplaces/claude-plugins-official/.claude-plugin/marketplace.json(172 plugin) - 内部 vs 外部 vs 第三方分布:本机
plugins/(35) +external_plugins/(15) + marketplace.json 引用(122) - changelog 提及 plugin 共 40+ 次(本机
raw/scan/CHANGELOG.md) - v2.1.139 新加的
claude plugin details命令出现在 changelog 第 8 行