Claude Code中英文系列教程21:通过市场发现并安装插件

4 阅读17分钟

Find and install plugins from marketplaces to extend Claude Code with new commands, agents, and capabilities. 从市场查找并安装插件,以扩展 Claude Code 的新命令、agents代理和功能。

Plugins extend Claude Code with skills, agents, hooks, and MCP servers. Plugin marketplaces are catalogs that help you discover and install these extensions without building them yourself. 插件通过技能、代理、钩子和 MCP 服务器扩展 Claude Code。插件市场是帮助你发现和安装这些扩展而无需自行构建的目录。

一,How marketplaces work 市场机制如何运作

A marketplace is a catalog of plugins that someone else has created and shared. Using a marketplace is a two-step process: 市场是其他人创建并共享的插件目录。使用市场分两步:

1,Add the marketplace 添加市场

This registers the catalog with Claude Code so you can browse what’s available. 这会将目录注册到 Claude Code 中,以便你浏览可用内容。

2,Install individual plugins 安装单个插件

Browse the catalog and install the plugins you want. 浏览目录并安装你想要的插件。

Think of it like adding an app store: adding the store gives you access to browse its collection, but you still choose which apps to download individually. 这就像添加一个应用商店:添加商店让你可以浏览其收藏,但你仍然需要选择要单独下载哪些应用。

二,Official Anthropic marketplace 官方 Anthropic 市场

The official Anthropic marketplace (claude-plugins-official) is automatically available when you start Claude Code. Run /plugin and go to the Discover tab to browse what’s available. 官方 Anthropic 市场( claude-plugins-official )在启动 Claude Code 时自动可用。运行 /plugin 并前往发现标签页浏览可用的插件。

To install a plugin from the official marketplace: 从官方市场安装插件:

/plugin install plugin-name@claude-plugins-official

The official marketplace is maintained by Anthropic. To distribute your own plugins, create your own marketplace and share it with users. 官方市场由 Anthropic 维护。若要分发自己的插件,请创建自己的市场并与用户共享。

The official marketplace includes several categories of plugins: 官方市场包含多个插件类别:

2.1 Code intelligence 代码智能

Code intelligence plugins enable Claude Code’s built-in LSP tool, giving Claude the ability to jump to definitions, find references, and see type errors immediately after edits. These plugins configure Language Server Protocol connections, the same technology that powers VS Code’s code intelligence. 代码智能插件启用 Claude Code 的内置 LSP 工具,使 Claude 能够跳转到定义、查找引用,并在编辑后立即查看类型错误。 这些插件配置 语言服务器协议 连接,即 VS Code 代码智能背后的技术。

These plugins require the language server binary to be installed on your system. If you already have a language server installed, Claude may prompt you to install the corresponding plugin when you open a project. 这些插件需要语言服务器二进制文件已安装在你的系统上。如果你已经安装了语言服务器,Claude 在打开项目时可能会提示你安装相应的插件。

下面是不同语言对应的插件名和必需的二进制文件。

C/C++,插件名 clangd-lsp, 需要有 clangd 二进制文件

C# ->csharp-lsp ->csharp-ls

Go ->gopls-lsp ->gopls

Java ->jdtls-lsp-> jdtls

Kotlin ->kotlin-lsp ->kotlin-language-server

Lua-> lua-lsp-> lua-language-server

PHP ->php-lsp ->intelephense

Python ->pyright-lsp ->pyright-langserver

Rust ->rust-analyzer-lsp ->rust-analyzer

Swift ->swift-lsp ->sourcekit-lsp

TypeScript-> typescript-lsp ->typescript-language-server

You can also create your own LSP plugin for other languages. 你也可以为其他语言创建自己的 LSP 插件。

If you see Executable not found in PATHinthe/pluginErrorstabafterinstallingaplugin,installtherequiredbinaryfromthetableabove.如果在安装插件后,在/plugin错误标签中看到ExecutablenotfoundinPATH in the /plugin Errors tab after installing a plugin, install the required binary from the table above. 如果在安装插件后,在 /plugin 错误标签中看到 Executable not found in PATH ,请参考上面各语言所需要的二进制文件,安装所需的二进制文件。

2.1.1 What Claude gains from code intelligence plugins 代码智能插件为 Claude 带来的优势

Once a code intelligence plugin is installed and its language server binary is available, Claude gains two capabilities: 一旦安装了代码智能插件,并且其语言服务器二进制文件可用,Claude 将获得两种能力:

1,Automatic diagnostics: after every file edit Claude makes, the language server analyzes the changes and reports errors and warnings back automatically. Claude sees type errors, missing imports, and syntax issues without needing to run a compiler or linter. If Claude introduces an error, it notices and fixes the issue in the same turn. This requires no configuration beyond installing the plugin. You can see diagnostics inline by pressing Ctrl+O when the “diagnostics found” indicator appears. 自动诊断:在 Claude 对每个文件进行编辑后,语言服务器会分析更改并自动报告错误和警告。 Claude 能够看到类型错误、缺失的导入和语法问题,而无需运行编译器或代码检查工具。 如果 Claude 引入了错误,它会注意到并在同一轮次中修复该问题。这除了安装插件外无需额外配置。 当出现“发现诊断信息”指示器时,你可以通过按 Ctrl+O 查看诊断信息。

2,Code navigation: Claude can use the language server to jump to definitions, find references, get type info on hover, list symbols, find implementations, and trace call hierarchies. These operations give Claude more precise navigation than grep-based search, though availability may vary by language and environment. 代码导航:Claude 可以使用语言服务器跳转到定义、查找引用、在悬停时获取类型信息、列出符号、查找实现以及追踪调用层次。这些操作比基于 grep 的搜索为 Claude 提供了更精确的导航,尽管其可用性可能因语言和环境而异。

2.1.2 Code intelligence issues 代码智能常见问题

Language server not starting: verify the binary is installed and available in your PATH.Checkthe/pluginErrorstabfordetails.语言服务器未启动:请验证二进制文件是否已安装且可在你的PATH. Check the /plugin Errors tab for details. 语言服务器未启动:请验证二进制文件是否已安装且可在你的 PATH 中找到。查看 /plugin 错误选项卡以获取详细信息。

High memory usage: language servers like rust-analyzer and pyright can consume significant memory on large projects. If you experience memory issues, disable the plugin with /plugin disable and rely on Claude’s built-in search tools instead. 高内存使用:像 rust-analyzer 和 pyright 这样的语言服务器在大项目上可能会消耗大量内存。如果你遇到内存问题,请使用 /plugin disable 禁用插件,并改用 Claude 的内置搜索工具。

False positive diagnostics in monorepos: language servers may report unresolved import errors for internal packages if the workspace isn’t configured correctly. These don’t affect Claude’s ability to edit code. 单仓库中的误报诊断:如果工作区配置不正确,语言服务器可能会报告内部包的未解析的导入错误。这不会影响 Claude 的代码编辑能力。

2.2 External integrations 外部集成

These plugins bundle pre-configured MCP servers so you can connect Claude to external services without manual setup: 这些插件捆绑了预配置的 MCP 服务器,因此你无需手动设置即可将 Claude 连接到外部服务:

Source control: github, gitlab #版本控制 Project management: atlassian (Jira/Confluence), asana, linear, notion #项目管理 Design: figma #设计 Infrastructure: vercel, firebase, supabase #基础设施 Communication: slack #通信 Monitoring: sentry #监控

2.3 Development workflows 开发工作流

Plugins that add commands and agents for common development tasks: 添加了命令和代理的能处理常见开发任务的插件:

commit-commands: Git commit workflows including commit, push, and PR creation 提交命令:Git 提交工作流,包括提交、推送和 PR 创建

pr-review-toolkit: Specialized agents for reviewing pull requests PR 审查工具包:专门用于审查PR的agents

agent-sdk-dev: Tools for building with the Claude Agent SDK 代理 SDK 开发:使用 Claude 代理 SDK 构建的工具

plugin-dev: Toolkit for creating your own plugins 插件开发:创建你自己的插件的工具包

2.4 Output styles 输出样式

Customize how Claude responds: 自定义 Claude 的响应方式:

1,explanatory-output-style: Educational insights about implementation choices 解释性输出样式:关于实现选择的启发性见解

2,learning-output-style: Interactive learning mode for skill building 学习性输出样式:技能构建的互动学习模式

三,Try it: add the demo marketplace 体验:添加演示市场

Anthropic also maintains a demo plugins marketplace (claude-code-plugins) with example plugins that show what’s possible with the plugin system. Unlike the official marketplace, you need to add this one manually. Anthropic 还维护一个演示插件市场( claude-code-plugins ),其中包含示例插件,展示了插件系统的功能。与官方市场不同,你需要手动添加这个市场。

1,Add the marketplace 添加市场

From within Claude Code, run the plugin marketplace add command for the anthropics/claude-code marketplace: 在 Claude Code 中,运行 plugin marketplace add 命令来添加 anthropics/claude-code 市场:

/plugin marketplace add anthropics/claude-code

This downloads the marketplace catalog and makes its plugins available to you. 这将下载市场目录,并使该市场的插件可供你使用。

2,Browse available plugins 浏览可用插件

Run /plugin to open the plugin manager. This opens a tabbed interface with four tabs you can cycle through using Tab (or Shift+Tab to go backward): 运行 /plugin 打开插件管理器。这将打开一个带有四个选项卡的界面,你可以使用 Tab(或按 Shift+Tab 向后导航)在这些选项卡之间循环切换:

a,Discover: browse available plugins from all your marketplaces 发现:浏览来自所有市场中心的可用插件

b,Installed: view and manage your installed plugins 已安装:查看和管理你的已安装插件

c,Marketplaces: add, remove, or update your added marketplaces 市场:添加、删除或更新你已添加的市场

d,Errors: view any plugin loading errors 错误:查看任何插件加载错误

Go to the Discover tab to see plugins from the marketplace you just added. 可前往“发现”标签页查看你刚刚添加的市场中的插件。

3,Install a plugin 安装插件

Select a plugin to view its details, then choose an installation scope: 选择一个插件以查看其详细信息,然后选择安装范围:

3.1 User scope: install for yourself across all projects 用户范围:在所有项目中为你自己安装

3.2 Project scope: install for all collaborators on this repository 项目范围:为该存储库上的所有协作者安装

3.3 Local scope: install for yourself in this repository only 本地范围:仅在此存储库中为你自己安装

For example, select commit-commands (a plugin that adds git workflow commands) and install it to your user scope. 例如,选择 commit-commands(一个添加 git 工作流命令的插件),并安装到你的用户范围内。

You can also install directly from the command line: 你也可以直接从命令行安装:

/plugin install commit-commands@anthropics-claude-code

4,Use your new plugin 使用你的新插件

After installing, the plugin’s commands are immediately available. Plugin commands are namespaced by the plugin name, so commit-commands provides commands like /commit-commands:commit. 安装后,插件的命令立即可用。插件命令以插件名称为命名空间,因此 commit-commands 提供如 /commit-commands:commit 等命令。

Try it out by making a change to a file and running: 通过修改文件并运行以下命令来尝试使用:

/commit-commands:commit

This stages your changes, generates a commit message, and creates the commit. 这会暂存你的更改,生成提交信息,并创建提交。

Each plugin works differently. Check the plugin’s description in the Discover tab or its homepage to learn what commands and capabilities it provides. 每个插件的工作方式不同。查看发现标签页中的插件描述或其主页,以了解它提供的命令和功能。

四,Add marketplaces 添加市场

Use the /plugin marketplace add command to add marketplaces from different sources. 使用 /plugin marketplace add 命令从不同来源添加市场。

Shortcuts: You can use /plugin market instead of /plugin marketplace, and rm instead of remove. 快捷方式:你可以使用 /plugin market 代替 /plugin marketplace ,使用 rm 代替 remove 。

GitHub repositories: owner/repo format (for example, anthropics/claude-code) #GitHub 仓库: owner/repo 格式(例如, anthropics/claude-code )

Git URLs: any git repository URL (GitLab, Bitbucket, self-hosted) Git URL:任何 Git 仓库 URL(GitLab、Bitbucket、自托管)

Local paths: directories or direct paths to marketplace.json files 本地路径:目录或直接指向 marketplace.json 文件的路径

Remote URLs: direct URLs to hosted marketplace.json files 远程 URL:指向托管 marketplace.json 文件的直接 URL

4.1 Add from GitHub 添加来自 GitHub的插件

Add a GitHub repository that contains a .claude-plugin/marketplace.json file using the owner/repo format—where owner is the GitHub username or organization and repo is the repository name. 添加一个包含 .claude-plugin/marketplace.json 文件(使用 owner/repo 格式)的 GitHub 仓库,其中 owner 是 GitHub 用户名或组织, repo 是仓库名称。

For example, anthropics/claude-code refers to the claude-code repository owned by anthropics: 例如, anthropics/claude-code 指的是由 anthropics 拥有的 claude-code 仓库:

/plugin marketplace add anthropics/claude-code

4.2 Add from other Git hosts 添加来自其他 Git 主机

Add any git repository by providing the full URL. This works with any Git host, including GitLab, Bitbucket, and self-hosted servers: 通过提供完整 URL 添加任何 git 仓库。这适用于任何 Git 主机,包括 GitLab、Bitbucket 和自托管服务器:

Using HTTPS: 使用 HTTPS:

/plugin marketplace add gitlab.com/company/plu…

Using SSH: 使用 SSH:

/plugin marketplace add git@gitlab.com:company/plugins.git

To add a specific branch or tag, append # followed by the ref: 要添加特定分支或标签,请追加 # 后跟引用:

/plugin marketplace add gitlab.com/company/plu…

4.3 Add from local paths 从本地路径添加

Add a local directory that contains a .claude-plugin/marketplace.json file: 添加包含 .claude-plugin/marketplace.json 文件的本地目录:

/plugin marketplace add ./my-marketplace

You can also add a direct path to a marketplace.json file: 你也可以添加指向 marketplace.json 文件的直接路径:

/plugin marketplace add ./path/to/marketplace.json

4.4 Add from remote URLs 从远程 URL 添加

Add a remote marketplace.json file via URL: 通过 URL 添加远程 marketplace.json 文件:

/plugin marketplace add example.com/marketplace…

URL-based marketplaces have some limitations compared to Git-based marketplaces. 基于 URL 的市场与基于 Git 的市场相比存在一些限制。

五,Install plugins 安装插件

Once you’ve added marketplaces, you can install plugins directly (installs to user scope by default): 添加市场后,你可以直接安装插件(默认安装到用户范围):

/plugin install plugin-name@marketplace-name

To choose a different installation scope, use the interactive UI: run /plugin, go to the Discover tab, and press Enter on a plugin. You’ll see options for: 要选择不同的安装范围,请使用交互式界面:运行 /plugin ,进入发现标签页,并在插件上按下回车键。你将看到以下3个选项:

User scope (default): install for yourself across all projects 用户范围(默认):在所有项目中为你自己安装

Project scope: install for all collaborators on this repository (adds to .claude/settings.json) 项目范围:为该仓库的所有协作者安装(添加到 .claude/settings.json )

Local scope: install for yourself in this repository only (not shared with collaborators) 本地范围:仅在本仓库中为你自己安装(不与协作者共享)

You may also see plugins with managed scope—these are installed by administrators via managed settings and cannot be modified. 你也可能看到具有managed范围的插件——这些插件由管理员通过managed受到管理的设置安装,并且无法修改。

Run /plugin and go to the Installed tab to see your plugins grouped by scope. 运行 /plugin 并转到已安装选项卡,可以以按scope范围查看你的插件。

Make sure you trust a plugin before installing it. Anthropic does not control what MCP servers, files, or other software are included in plugins and cannot verify that they work as intended. Check each plugin’s homepage for more information. 在安装插件前,请确保你信任该插件。Anthropic 无法控制插件中包含的 MCP 服务器、文件或其他软件,也无法验证它们是否按预期工作。请访问每个插件的官网获取更多信息。

六,Manage installed plugins 管理已安装插件

Run /plugin and go to the Installed tab to view, enable, disable, or uninstall your plugins. Type to filter the list by plugin name or description. 运行 /plugin 并前往已安装标签页查看、启用、禁用或卸载你的插件。通过输入插件名称或描述筛选列表。

You can also manage plugins with direct commands. 你也可以直接通过命令管理插件。

Disable a plugin without uninstalling: 禁用插件但不卸载:

/plugin disable plugin-name@marketplace-name

Re-enable a disabled plugin: 重新启用已禁用的插件:

/plugin enable plugin-name@marketplace-name

Completely remove a plugin: 完全删除插件:

/plugin uninstall plugin-name@marketplace-name

The --scope option lets you target a specific scope with CLI commands: --scope 选项允许你使用 CLI 命令并针对特定范围进行操作:

claude plugin install formatter@your-org --scope project claude plugin uninstall formatter@your-org --scope project

七,Manage marketplaces 管理市场 You can manage marketplaces through the interactive /plugin interface or with CLI commands. 你可以通过交互式 /plugin 界面或使用 CLI 命令来管理市场。

7.1 Use the interactive interface 使用交互式界面

Run /plugin and go to the Marketplaces tab to: 通过运行 /plugin 并转到市场列表标签页:

View all your added marketplaces with their sources and status 查看所有已添加的市场列表及其来源和状态

Add new marketplaces 添加新的市场列表

Update marketplace listings to fetch the latest plugins 更新市场列表以获取最新插件

Remove marketplaces you no longer need 删除不再需要的市场

7.2 Use CLI commands 使用命令行指令

You can also manage marketplaces with direct commands. 你也可以直接使用命令管理市场

List all configured marketplaces: 列出所有配置的市场:

/plugin marketplace list

Refresh plugin listings from a marketplace: 从市场刷新插件列表:

/plugin marketplace update marketplace-name

Remove a marketplace: 移除市场: /plugin marketplace remove marketplace-name

Removing a marketplace will uninstall any plugins you installed from it. 移除市场将卸载你从该市场安装的任何插件。

7.3 Configure auto-updates 配置自动更新

Claude Code can automatically update marketplaces and their installed plugins at startup. When auto-update is enabled for a marketplace, Claude Code refreshes the marketplace data and updates installed plugins to their latest versions. If any plugins were updated, you’ll see a notification suggesting you restart Claude Code. Claude Code 可以在启动时自动更新市场及其已安装的插件。当为某个市场启用自动更新时,Claude Code 会刷新市场数据并更新已安装的插件到最新版本。如果有插件被更新,你会看到一个通知建议你重启 Claude Code。

Toggle auto-update for individual marketplaces through the UI: 通过 UI 切换单个市场的自动更新:

1,Run /plugin to open the plugin manager 运行 /plugin 打开插件管理器

2,Select Marketplaces 选择市场

3,Choose a marketplace from the list 从列表中选择一个市场

4,Select Enable auto-update or Disable auto-update 选择启用自动更新或禁用自动更新

Official Anthropic marketplaces have auto-update enabled by default. Third-party and local development marketplaces have auto-update disabled by default. 官方 Anthropic 市场默认启用自动更新。第三方和本地开发市场默认禁用自动更新。

To disable all automatic updates entirely for both Claude Code and all plugins, set the DISABLE_AUTOUPDATER environment variable. 要完全禁用 Claude Code 和所有插件的自动更新,请设置 DISABLE_AUTOUPDATER 环境变量。

To keep plugin auto-updates enabled while disabling Claude Code auto-updates, set FORCE_AUTOUPDATE_PLUGINS=true along with DISABLE_AUTOUPDATER: 要在禁用 Claude Code 自动更新的同时保持插件自动更新,请同时设置 FORCE_AUTOUPDATE_PLUGINS=true 和 DISABLE_AUTOUPDATER :

export DISABLE_AUTOUPDATER=true export FORCE_AUTOUPDATE_PLUGINS=true

This is useful when you want to manage Claude Code updates manually but still receive automatic plugin updates. 当你希望手动管理 Claude Code 更新但仍想接收自动插件更新时,这会很有用。

八,Configure team marketplaces 配置团队市场

Team admins can set up automatic marketplace installation for projects by adding marketplace configuration to .claude/settings.json. When team members trust the repository folder, Claude Code prompts them to install these marketplaces and plugins. 团队管理员可以通过在 .claude/settings.json 中添加市场配置来为项目设置自动市场安装。 当团队成员信任仓库文件夹时,Claude Code 会提示他们安装这些市场和插件。

九,Troubleshooting 故障排除

9.1 /plugin command not recognized 未识别的命令 /plugin

If you see “unknown command” or the /plugin command doesn’t appear: 如果你看到“未知命令”或 /plugin 命令未出现:

1,Check your version: Run claude --version. Plugins require version 1.0.33 or later. 检查你的版本:运行 claude --version 。插件需要版本 1.0.33 或更高版本。

2,Update Claude Code: 更新 Claude Code: Homebrew: brew upgrade claude-code npm: npm update -g @anthropic-ai/claude-code Native installer: Re-run the install command from Setup 本地安装器:从设置中重新运行安装命令

3,Restart Claude Code: After updating, restart your terminal and run claude again. 重启 Claude Code:更新后,重启你的终端并再次运行 claude

9.2 Common issues 常见问题

1,Marketplace not loading: Verify the URL is accessible and that .claude-plugin/marketplace.json exists at the path 市场未加载:验证 URL 是否可访问,并确认 .claude-plugin/marketplace.json 是否存在于该路径

2,Plugin installation failures: Check that plugin source URLs are accessible and repositories are public (or you have access) 插件安装失败:请确认插件源 URL 可访问且存储库是公开的(或你有访问权限)

3,Files not found after installation: Plugins are copied to a cache, so paths referencing files outside the plugin directory won’t work 安装后文件未找到:插件会被复制到缓存中,因此引用插件目录以外的文件的路径将无效

4,Plugin skills not appearing: Clear the cache with rm -rf ~/.claude/plugins/cache, restart Claude Code, and reinstall the plugin. 插件技能未显示:使用 rm -rf ~/.claude/plugins/cache 清除缓存,重启 Claude Code,并重新安装插件。

小结 agent-sdk-dev:Tools for building with the Claude Agent SDK #使用Claude Agent SDK进行构建的工具包

learning-output-style: Interactive learning mode for skill building 学习性输出样式:构建skills时的交互学习模式

/commit-commands:commit 插件可能提供一些有用的命令

可以创建自己的市场

大家有推荐的好的插件吗?