Plugin distribution
插件市场
自己做团队插件市场,把常用插件统一管起来。
页面信息
这页不是官方原文,而是顺着官方文档结构做的中文解释版。命令、参数、配置名这些硬东西尽量保留,解释部分则尽量讲成人能照着做的话。
如果你碰到特别敏感的配置、权限或企业环境差异,最好顺手点上面的“查看原始文档”再核一遍。
这一页先讲明白
这页讲怎么做自己的插件市场,把常用插件统一发给团队。
适合团队想把"好用的扩展包"集中管理起来。
这就像村里开个统一农具站,常用家伙都放这里,谁要用就按规矩领。
好处是插件来源更清楚,版本更统一,不用每个人各自乱找。
如果你们已经开始广泛用插件,这页很有价值。
先挑团队最常用、最稳定的几类插件收进市场。
别一开始就铺太大,先把来源、版本和审核规则定稳。
市场做起来后,重点不只是"能装",还得"可控、可更新、可追踪"。
原页关键片段:Walkthrough: create a local marketplace 1
这一段不是只让你理解意思,下面这条命令就是现在要跑的。
mkdir -p my-marketplace/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/skills/quality-review 原页关键片段:Walkthrough: create a local marketplace 2
这一段说完,最后还得写到配置里才算真的生效。
---
description: Review code for bugs, security, and performance
disable-model-invocation: true
---
Review the code I've selected or the recent changes for:
- Potential bugs or edge cases
- Security concerns
- Performance issues
- Readability improvements
Be concise and actionable. 原页关键片段:Walkthrough: create a local marketplace 3
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "quality-review-plugin",
"description": "Adds a quality-review skill for quick code reviews",
"version": "1.0.0"
} 原页关键片段:Create the marketplace file
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "company-tools",
"owner": {
"name": "DevTools Team",
"email": "devtools@example.com"
},
"plugins": [
{
"name": "code-formatter",
"source": "./plugins/formatter",
"description": "Automatic code formatting on save",
"version": "2.1.0",
"author": {
"name": "DevTools Team"
}
},
{
"name": "deployment-tools",
"source": {
"source": "github",
"repo": "company/deploy-plugin"
},
"description": "Deployment automation tools"
}
]
} 原页关键片段:Relative paths
这会儿轮到改配置了,字段名和关键字别自己乱换。
{
"name": "my-plugin",
"source": "./plugins/my-plugin"
} 原页关键片段:GitHub repositories 1
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "github-plugin",
"source": {
"source": "github",
"repo": "owner/plugin-repo"
}
} 原页关键片段:GitHub repositories 2
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "github-plugin",
"source": {
"source": "github",
"repo": "owner/plugin-repo",
"ref": "v2.0.0",
"sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
} 原页关键片段:Git repositories 1
这会儿轮到改配置了,字段名和关键字别自己乱换。
{
"name": "git-plugin",
"source": {
"source": "url",
"url": "https://gitlab.com/team/plugin.git"
}
} 原页关键片段:Git repositories 2
这会儿轮到改配置了,字段名和关键字别自己乱换。
{
"name": "git-plugin",
"source": {
"source": "url",
"url": "https://gitlab.com/team/plugin.git",
"ref": "main",
"sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
} 原页关键片段:Git subdirectories 1
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "my-plugin",
"source": {
"source": "git-subdir",
"url": "https://github.com/acme-corp/monorepo.git",
"path": "tools/claude-plugin"
}
} 原页关键片段:Git subdirectories 2
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "my-plugin",
"source": {
"source": "git-subdir",
"url": "https://github.com/acme-corp/monorepo.git",
"path": "tools/claude-plugin",
"ref": "v2.0.0",
"sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
} 原页关键片段:npm packages 1
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "my-npm-plugin",
"source": {
"source": "npm",
"package": "@acme/claude-plugin"
}
} Documentation Index
这里不是让你背"Documentation Index"这个词,而是让你看它真干活时怎么使。
Overview
看到这里,就把"Overview"当成一件真要上手的活来看。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Walkthrough: create a local marketplace
别把这段只当成标题看,它其实是在给"Walkthrough: create a local marketplace"划边界。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Walkthrough: create a local marketplace 1
这一段不是只让你理解意思,下面这条命令就是现在要跑的。
mkdir -p my-marketplace/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/skills/quality-review Walkthrough: create a local marketplace 2
这一段说完,最后还得写到配置里才算真的生效。
---
description: Review code for bugs, security, and performance
disable-model-invocation: true
---
Review the code I've selected or the recent changes for:
- Potential bugs or edge cases
- Security concerns
- Performance issues
- Readability improvements
Be concise and actionable. Walkthrough: create a local marketplace 3
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "quality-review-plugin",
"description": "Adds a quality-review skill for quick code reviews",
"version": "1.0.0"
} Walkthrough: create a local marketplace 4
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "my-plugins",
"owner": {
"name": "Your Name"
},
"plugins": [
{
"name": "quality-review-plugin",
"source": "./plugins/quality-review-plugin",
"description": "Adds a quality-review skill for quick code reviews"
}
]
} Walkthrough: create a local marketplace 5
这一步不用你自己动手配什么,把下面这句话交出去就行。
/plugin marketplace add ./my-marketplace
/plugin install quality-review-plugin@my-plugins Walkthrough: create a local marketplace 6
这一步不用你自己动手配什么,把下面这句话交出去就行。
/quality-review-plugin:quality-review Create the marketplace file
这一段是在教你把 .claude-plugin/marketplace.json in your repository root. This file defines your marketplace’s name, owner information, and a list of plugins with their sources. 真正建出来。文件放哪儿、字段怎么写、建完怎么验,都得跟着看。
Create the marketplace file
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "company-tools",
"owner": {
"name": "DevTools Team",
"email": "devtools@example.com"
},
"plugins": [
{
"name": "code-formatter",
"source": "./plugins/formatter",
"description": "Automatic code formatting on save",
"version": "2.1.0",
"author": {
"name": "DevTools Team"
}
},
{
"name": "deployment-tools",
"source": {
"source": "github",
"repo": "company/deploy-plugin"
},
"description": "Deployment automation tools"
}
]
} Marketplace schema
看到这里,就别靠猜了,字段、格式和写法都得按说明来。
Required fields
这一段就是给你查规矩的,像看说明书那样一项项对着来。
看这段时要特别盯工具和权限边界,别为了省事一把全开。
Owner fields
看到这里,就别靠猜了,字段、格式和写法都得按说明来。
Optional fields
看到这里,就别靠猜了,字段、格式和写法都得按说明来。
Plugin entries
这一块主要是在说"Plugin entries"真到手上该怎么用,哪里最容易踩坑。
如果你打算把外接能力往里挂,这里提到的 hooks、MCP、skills、memory 都要分清各自负责哪一摊。
Required fields
这一段就是给你查规矩的,像看说明书那样一项项对着来。
Optional plugin fields
看到这里,就别靠猜了,字段、格式和写法都得按说明来。
Plugin sources
看到这里,就把"Plugin sources"当成一件真要上手的活来看。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Relative paths
这一段主要是在把"Relative paths"讲实,不是只摆个标题给你看。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Relative paths
这会儿轮到改配置了,字段名和关键字别自己乱换。
{
"name": "my-plugin",
"source": "./plugins/my-plugin"
} GitHub repositories
看到这里,就把"GitHub repositories"当成一件真要上手的活来看。
GitHub repositories 1
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "github-plugin",
"source": {
"source": "github",
"repo": "owner/plugin-repo"
}
} GitHub repositories 2
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "github-plugin",
"source": {
"source": "github",
"repo": "owner/plugin-repo",
"ref": "v2.0.0",
"sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
} Git repositories
这一段主要是在把"Git repositories"讲实,不是只摆个标题给你看。
Git repositories 1
这会儿轮到改配置了,字段名和关键字别自己乱换。
{
"name": "git-plugin",
"source": {
"source": "url",
"url": "https://gitlab.com/team/plugin.git"
}
} Git repositories 2
这会儿轮到改配置了,字段名和关键字别自己乱换。
{
"name": "git-plugin",
"source": {
"source": "url",
"url": "https://gitlab.com/team/plugin.git",
"ref": "main",
"sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
} Git subdirectories
这一段是在说怎么用 git-subdir to point to a plugin that lives inside a subdirectory of a git repository. Claude Code uses a sparse, partial clone 去做 fetch only the subdirectory, minimizing bandwidth for large monorepos.。看这种内容,光知道名字没用,还是得落到手上。
Git subdirectories 1
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "my-plugin",
"source": {
"source": "git-subdir",
"url": "https://github.com/acme-corp/monorepo.git",
"path": "tools/claude-plugin"
}
} Git subdirectories 2
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "my-plugin",
"source": {
"source": "git-subdir",
"url": "https://github.com/acme-corp/monorepo.git",
"path": "tools/claude-plugin",
"ref": "v2.0.0",
"sha": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0"
}
} npm packages
这里不是让你背"npm packages"这个词,而是让你看它真干活时怎么使。
npm packages 1
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "my-npm-plugin",
"source": {
"source": "npm",
"package": "@acme/claude-plugin"
}
} npm packages 2
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "my-npm-plugin",
"source": {
"source": "npm",
"package": "@acme/claude-plugin",
"version": "2.1.0"
}
} npm packages 3
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "my-npm-plugin",
"source": {
"source": "npm",
"package": "@acme/claude-plugin",
"version": "^2.0.0",
"registry": "https://npm.example.com"
}
} Advanced plugin entries
别把这段只当成标题看,它其实是在给"Advanced plugin entries"划边界。
如果你打算把外接能力往里挂,这里提到的 hooks、MCP、skills、memory 都要分清各自负责哪一摊。
Advanced plugin entries
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "enterprise-tools",
"source": {
"source": "github",
"repo": "company/enterprise-plugin"
},
"description": "Enterprise workflow automation tools",
"version": "2.1.0",
"author": {
"name": "Enterprise Team",
"email": "enterprise@example.com"
},
"homepage": "https://docs.example.com/plugins/enterprise-tools",
"repository": "https://github.com/company/enterprise-plugin",
"license": "MIT",
"keywords": ["enterprise", "workflow", "automation"],
"category": "productivity",
"commands": [
"./commands/core/",
"./commands/enterprise/",
"./commands/experimental/preview.md"
],
"agents": ["./agents/security-reviewer.md", "./agents/compliance-checker.md"],
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh"
}
]
}
]
},
"mcpServers": {
"enterprise-db": {
"command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server",
"args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"]
}
},
"strict": false
} Strict mode
这里主要是在交代"Strict mode"这一块会碰到哪些事。
如果你打算把外接能力往里挂,这里提到的 hooks、MCP、skills、memory 都要分清各自负责哪一摊。
Host and distribute marketplaces
这一段主要是在把"Host and distribute marketplaces"讲实,不是只摆个标题给你看。
Host on GitHub (recommended)
这里不是让你背"Host on GitHub (recommended)"这个词,而是让你看它真干活时怎么使。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Host on other git services
这一块主要是在说"Host on other git services"真到手上该怎么用,哪里最容易踩坑。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Host on other git services
到这里其实就剩一句话,把下面这句发出去就行。
/plugin marketplace add https://gitlab.com/company/plugins.git Private repositories
看到这里,就把"Private repositories"当成一件真要上手的活来看。
看这段时要特别盯工具和权限边界,别为了省事一把全开。
Private repositories
先看下面这块原始片段,等会儿再回头看解释会顺得多。
export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx Test locally before distribution
看到这里,就把"Test locally before distribution"当成一件真要上手的活来看。
Test locally before distribution
这一步不用你自己动手配什么,把下面这句话交出去就行。
/plugin marketplace add ./my-local-marketplace
/plugin install test-plugin@my-local-marketplace Require marketplaces for your team
这里不是让你背"Require marketplaces for your team"这个词,而是让你看它真干活时怎么使。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Require marketplaces for your team 1
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"extraKnownMarketplaces": {
"company-tools": {
"source": {
"source": "github",
"repo": "your-org/claude-plugins"
}
}
}
} Require marketplaces for your team 2
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"enabledPlugins": {
"code-formatter@company-tools": true,
"deployment-tools@company-tools": true
}
} Pre-populate plugins for containers
这一块主要是在说"Pre-populate plugins for containers"真到手上该怎么用,哪里最容易踩坑。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Pre-populate plugins for containers 1
想把这条规矩固定住,就把下面这块老老实实写进去。
$CLAUDE_CODE_PLUGIN_SEED_DIR/
known_marketplaces.json
marketplaces/<name>/...
cache/<marketplace>/<plugin>/<version>/... Pre-populate plugins for containers 2
"Pre-populate plugins for containers"这一段里最要紧的原始写法在下面,先看它怎么落地。
CLAUDE_CODE_PLUGIN_CACHE_DIR=/opt/claude-seed claude plugin marketplace add your-org/plugins
CLAUDE_CODE_PLUGIN_CACHE_DIR=/opt/claude-seed claude plugin install my-tool@your-plugins Managed marketplace restrictions
看到这里,就把"Managed marketplace restrictions"当成一件真要上手的活来看。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Managed marketplace restrictions 1
这一段说完,最后还得写到配置里才算真的生效。
{
"strictKnownMarketplaces": []
} Managed marketplace restrictions 2
这一段说完,最后还得写到配置里才算真的生效。
{
"strictKnownMarketplaces": [
{
"source": "github",
"repo": "acme-corp/approved-plugins"
},
{
"source": "github",
"repo": "acme-corp/security-tools",
"ref": "v2.0"
},
{
"source": "url",
"url": "https://plugins.example.com/marketplace.json"
}
]
} Managed marketplace restrictions 3
这一段说完,最后还得写到配置里才算真的生效。
{
"strictKnownMarketplaces": [
{
"source": "hostPattern",
"hostPattern": "^github\\.example\\.com$"
}
]
} Managed marketplace restrictions 4
这一段说完,最后还得写到配置里才算真的生效。
{
"strictKnownMarketplaces": [
{
"source": "pathPattern",
"pathPattern": "^/opt/approved/"
}
]
} Version resolution and release channels
这里不是让你背"Version resolution and release channels"这个词,而是让你看它真干活时怎么使。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Version resolution and release channels 1
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "stable-tools",
"plugins": [
{
"name": "code-formatter",
"source": {
"source": "github",
"repo": "acme-corp/code-formatter",
"ref": "stable"
}
}
]
} Version resolution and release channels 2
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "latest-tools",
"plugins": [
{
"name": "code-formatter",
"source": {
"source": "github",
"repo": "acme-corp/code-formatter",
"ref": "latest"
}
}
]
} Version resolution and release channels 3
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"extraKnownMarketplaces": {
"stable-tools": {
"source": {
"source": "github",
"repo": "acme-corp/stable-tools"
}
}
}
} Version resolution and release channels 4
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"extraKnownMarketplaces": {
"latest-tools": {
"source": {
"source": "github",
"repo": "acme-corp/latest-tools"
}
}
}
} Validation and testing
这一段主要是在把"Validation and testing"讲实,不是只摆个标题给你看。
Validation and testing 1
先别急着往下翻,下面这条命令跑完,心里才有底。
claude plugin validate . Validation and testing 2
最省事的做法,就是把下面这句原样说给 Claude。
/plugin validate . Validation and testing 3
最省事的做法,就是把下面这句原样说给 Claude。
/plugin marketplace add ./path/to/marketplace Validation and testing 4
最省事的做法,就是把下面这句原样说给 Claude。
/plugin install test-plugin@marketplace-name Manage marketplaces from the CLI
这里讲的是收放和管理,不只是"能不能用",而是"怎么管住、怎么不乱"。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Plugin marketplace add
这一块主要是在说"Plugin marketplace add"真到手上该怎么用,哪里最容易踩坑。
这里还牵扯作用域,意思就是这条规则到底管当前项目、你个人,还是只管这一趟会话。
Plugin marketplace add 1
看到这里,别光点头,下面这条命令先跑起来再说。
claude plugin marketplace add <source> [options] Plugin marketplace add 2
看到这里,别光点头,下面这条命令先跑起来再说。
claude plugin marketplace add acme-corp/claude-plugins Plugin marketplace add 3
看到这里,别光点头,下面这条命令先跑起来再说。
claude plugin marketplace add acme-corp/claude-plugins@v2.0 Plugin marketplace add 4
看到这里,别光点头,下面这条命令先跑起来再说。
claude plugin marketplace add https://gitlab.example.com/team/plugins.git 照着做一遍
如果你不想来回翻,就先照这几步顺着做。
每做完一步就看一下结果,再决定要不要继续往下。
第 1 步:Walkthrough: create a local marketplace 1
这一段不是只让你理解意思,下面这条命令就是现在要跑的。
mkdir -p my-marketplace/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/.claude-plugin
mkdir -p my-marketplace/plugins/quality-review-plugin/skills/quality-review 第 2 步:Walkthrough: create a local marketplace 2
这一段说完,最后还得写到配置里才算真的生效。
---
description: Review code for bugs, security, and performance
disable-model-invocation: true
---
Review the code I've selected or the recent changes for:
- Potential bugs or edge cases
- Security concerns
- Performance issues
- Readability improvements
Be concise and actionable. 第 3 步:Walkthrough: create a local marketplace 3
这一段说完,最后还得写到配置里才算真的生效。
{
"name": "quality-review-plugin",
"description": "Adds a quality-review skill for quick code reviews",
"version": "1.0.0"
} 第 4 步:Create the marketplace file
光知道意思还不够,这里得把规矩落进配置里,下面这块照着填。
{
"name": "company-tools",
"owner": {
"name": "DevTools Team",
"email": "devtools@example.com"
},
"plugins": [
{
"name": "code-formatter",
"source": "./plugins/formatter",
"description": "Automatic code formatting on save",
"version": "2.1.0",
"author": {
"name": "DevTools Team"
}
},
{
"name": "deployment-tools",
"source": {
"source": "github",
"repo": "company/deploy-plugin"
},
"description": "Deployment automation tools"
}
]
} 一眼看懂这一页
先把这页到底在讲什么看明白,再去碰具体命令和配置,最不容易绕晕。
Create and distribute a plugin marketplace
|
v
这是 Plugin distribution 里的一摊要紧活
|
v
先弄懂,再下手 文末提醒
这站会按官方 docs 的导航和内容变化继续重生成,原站加页、删页、改页时,这里会跟着更新。
人话解释会尽量顺着原页往下讲,但命令、参数名、配置名这些硬东西还是保留原样,免得你抄过去跑不起来。