图文分步教程

Claude Code 插件:安装、管理与自制

一份跟着真实会话走的 Claude Code 插件系统图解教程——插件打包了什么、怎么从市场安装、/plugin 怎么管理、怎么打包自己的开发工具箱,以及要避开的供应链安全陷阱。

Browse plugins marketplace page with cards for Frontend Design at 413,623 installs, Superpowers at 294,839, Context7, Code Review at 191,903 and Code Simplifier at 159,908, most marked Anthropic verified
Browse plugins 插件市场页面——Frontend Design 413,623 次安装、Superpowers 294,839 次,多数卡片带 Anthropic verified 标志(2026 年 3 月录制)。

约 5 分钟 · 14 个图文步骤

先说结论

Claude Code 插件是一个文件夹,把技能、子代理、MCP 服务器、钩子、斜杠命令等打包在一个 plugin.json 清单之下。装别人的插件:从市场详情页复制 claude plugin install 命令;查看、停用或卸载:全部在 /plugin 里完成。打包自己的配置:把需求讲给 Claude,它会组装文件夹、写好 plugin.json,并给出 zip 或 git 分享配方。优先选带 Anthropic verified 标志的插件——恶意市场插件可能携带绕过人工批准的权限授权。

来源视频

本页每一帧画面都来自 Software Engineer Meets AI 的录屏——~/Projects/aldevneeds 里的 Claude Code v2.1.87 会话(Sonnet 4.6 · Claude Pro),录制于 2026 年 3 月。

截图带出处使用,每一步都链回视频对应秒数。旁白不照抄——上方文字依据屏幕内容撰写,并与 code.claude.com/docs 核对。

第 1 部分 · 插件到底是什么

在装任何东西之前,先用两帧看清这个单位:插件打包了什么,它的文件夹长什么样。

  1. 1

    一个插件打包五样东西

    视频开篇给出定义:Claude Code 插件是打包可复用功能的扩展。一个插件可以包含技能、子代理、MCP 服务器、钩子和 LSP 服务器——所以一个小小的插件名能改变一大片行为。

    Slide defining Claude Code plugins as extensions that package reusable functionality, with arrows from a Claude Code Plugins box to Skills, Subagents, MCPs, Hooks and LSP Servers
    正是技能、子代理、MCP 各篇攻略里见过的清单,包进了一个可安装的单位。看视频 0:25 处
  2. 2

    看懂插件文件夹的解剖图

    插件就是一个目录:必需的 .claude-plugin/plugin.json 清单,加上约定文件夹——commands/ 放斜杠命令,agents/ 放子代理,skills/<名字>/SKILL.md 放技能,output-styles/、带 hooks.json 的 hooks/、放 MCP 服务器的 .mcp.json、放 LSP 服务器的 .lsp.json、scripts/,以及 LICENSE 和 CHANGELOG.md。

    Annotated enterprise-plugin directory tree showing .claude-plugin/plugin.json as the optional manifest, commands, agents, skills with SKILL.md files, output-styles, hooks with hooks.json, settings.json, .mcp.json, .lsp.json, scripts, LICENSE and CHANGELOG.md
    除清单外每个文件夹都是可选的——注释写明了各自的用途。看视频 0:35 处

第 2 部分 · 从市场安装一个插件

官方市场同时收录社区插件和 Anthropic verified 插件;每个详情页都会给你一行安装命令。

  1. 3

    逛官方插件市场

    Browse plugins 页面为每个插件列出一句话简介、安装量,以及符合条件的 Anthropic verified 标志——录屏里 Frontend Design 413,623 次、Superpowers 294,839 次、Code Review 191,903 次、Code Simplifier 159,908 次。不同镜头里数字会变,当作快照看即可。

    Browse plugins marketplace page with plugin cards for Frontend Design at 413,623 installs, Superpowers at 294,839, Context7, Code Review at 191,903 and Code Simplifier at 159,908, most marked Anthropic verified
    verified 标志表示该插件由 Anthropic 发布或审核。看视频 1:16 处
  2. 4

    打开详情页并复制命令

    点开卡片进入详情页——Frontend Design 写着"Craft production-grade frontends with distinctive design. Generates polished code that avoids generic AI aesthetics",标注 Made by Anthropic 和 verified 标志,Install in Claude Code 按钮一键复制安装命令。

    Frontend Design plugin detail page reading Craft production-grade frontends with distinctive design, showing Anthropic Verified, an Install in Claude Code button, Made by Anthropic and 413,623 installs
    录屏复制命令后切到了终端。看视频 1:25 处
  3. 5

    运行安装命令

    在任意项目终端运行 claude plugin install frontend-design@claude-plugins-official——插件名加 @ 加市场名。安装就这一条命令,下个会话自动生效。

    Terminal in the alldevneeds repository with the command claude plugin install frontend-design@claude-plugins-official typed at the prompt
    插件@市场 的组合告诉 Claude Code 去哪里取件。看视频 1:56 处

第 3 部分 · 运行、检查、移除

/plugin 界面是所有已装插件的调度台——启用、停用、更新、卸载都不用离开 Claude Code。

  1. 6

    认识 /plugin 调度台

    /plugin 命令打开管理器,含 Discover、Installed、Marketplaces、Errors 四个标签。录屏的 Installed 页显示本地 MCP 服务器、带启用/停用状态的用户插件——frontend-design(来自 claude-plugins-official)已启用,agent-sdk-dev 和 commit-commands 已停用——以及内置的 claude-in-chrome MCP。

    Claude Code /plugin screen on the Installed tab listing connected and disconnected MCP servers plus user plugins, with frontend-design from claude-plugins-official enabled and agent-sdk-dev and commit-commands disabled
    空格切换、回车看详情、Esc 返回——页脚写明了快捷键。看视频 3:28 处
  2. 7

    按名字调用插件

    已装插件的命令和技能会出现在会话里。录屏输入 /frontend-design a pricing page with 3 tiers, toggle for monthly/annual billing, and a feature comparison table——插件的技能名加一段白话需求。

    Claude Code panel in VS Code with the prompt /frontend-design a pricing page with 3 tiers, toggle for monthly/annual billing, and a feature comparison table typed into the input box
    插件技能像其他斜杠技能一样调用,只是带上插件名作前缀。看视频 2:30 处
  3. 8

    问一句插件里有什么

    不确定装好的插件里装了什么?直接问:录屏输入 tell me what this plugin contains,跟上 /frontend-design。Claude 会读取已安装的包并报告内容。

    Claude Code panel with the question tell me what this plugin contains, followed by /frontend-design, typed into the input box on a Claude Code v2.1.87 Sonnet 4.6 session
    另一个办法是打开插件的 GitHub 仓库自己读文件。看视频 3:00 处
  4. 9

    停用、更新或卸载

    在已装插件上按回车进入详情:frontend-design @ claude-plugins-official、scope user、版本 0.1.0、它安装的组件,以及三个管理选项——Disable plugin、Mark for update、Uninstall。

    Claude Code plugin details screen for frontend-design from claude-plugins-official, scope user, version 0.1.0, listing its installed Skill component above Disable plugin, Mark for update and Uninstall options
    移除后,开新会话或运行 /reload-plugins 让改动生效。看视频 3:40 处

第 4 部分 · 打包你自己的配置

文件夹不用手写——你描述要打包什么,Claude 来组装插件和清单。

  1. 10

    先决策:散装还是插件?

    打包之前,录屏用一张表权衡:.claude/ 下的散装目录、/hello 这类命令,适合个人工作流、项目内定制和快速实验;带 .claude-plugin/plugin.json 的插件给你 /plugin-name:hello 的命名空间,适合团队共享、社区分发、版本化发布和跨项目复用。

    Comparison table titled But do you really need the plugin, contrasting standalone directories in .claude with commands like /hello for personal workflows against plugins with .claude-plugin/plugin.json and /plugin-name:hello namespacing for teams and community releases
    命名空间那一行是最实用的判断依据——插件的命令会带上插件名前缀。看视频 4:20 处
  2. 11

    讲清楚要打包什么

    录屏对 Claude 说:Create a plugin that I will share with my team, include the following——然后列出已有文件:一个质量保障代理、一个工具实现代理、一个 fix-issue 命令和一个 SEO 优化技能。你只需引用已存在的东西,打包交给 Claude。

    Claude Code panel with the prompt Create a plugin that I will share with my team, include the following typed into the input box of a Claude Code v2.1.87 Sonnet 4.6 session
    提示词点名了 .claude/agents 和 ~/.claude 下的真实路径,不留发挥空间。看视频 5:42 处
  3. 12

    拿到工具箱和分享配方

    Claude 组装出 aldevneeds-devkit:commands/fix-issue.md 映射到 /fix-issue <number>,skills/seo-optimization 文件夹含 SKILL.md、REFERENCE.md、三个模板和一个脚本,然后给出交接方案:用 zip -r 打 zip、推到 git 仓库再 clone,或拷进其他项目的 .claude/plugins/ 并在 .claude/settings.json 里注册。

    Claude Code reply showing the generated aldevneeds-devkit structure with commands/fix-issue.md and skills/seo-optimization, followed by sharing options zip -r or a git repo and install steps copying it into .claude/plugins and registering it in settings.json
    一条提示词到成品用时不到两分钟("Crunched for 1m 52s")。看视频 6:10 处
  4. 13

    读懂生成的 plugin.json

    清单就是全部契约:name 为 aldevneeds-devkit,version 1.0.0,一行描述,agents 列 agents/quality-assurance.md 和 agents/tool-implementer.md,commands 列 commands/fix-issue.md,skills 列 skills/seo-optimization/SKILL.md。没列进清单的文件,插件就不会带上。

    The generated plugin.json for aldevneeds-devkit open in VS Code with name, version 1.0.0, a description, agents listing quality-assurance.md and tool-implementer.md, commands listing fix-issue.md and skills listing seo-optimization/SKILL.md
    分享文件夹之前,先在编辑器里核对每一个路径。看视频 6:30 处

第 5 部分 · 安全陷阱

插件可以携带权限授权。一个恶意市场插件的案例说明了为什么值得核对 verified 标志。

  1. 14

    为什么 verified 标志重要

    视频结尾引用了 PromptFoo 的"Hijacking Claude Code via Injected Marketplace Plugins"攻击案例:恶意插件在 plugin.json 的 permissions 里授出 "allow": ["Bash(*)", "WebFetch(domain:*)"]——绕过人工批准、让 Claude 执行恶意命令并外传数据。只装信任作者的插件,优先选 Anthropic verified。

    Annotated security slide showing a malicious marketplace plugin whose plugin.json grants Bash wildcard and WebFetch domain permissions, with red arrows labelled bypass human approval and Claude executes malicious commands exfiltrating data to an attacker
    图上标注的正是让插件变成外传通道的那段权限块。看视频 6:57 处

常见问题