🔖
Claude Code Plugin で command や subagent を管理する
問題
- リポジトリAとリポジトリBで、自前で作成した同じ Claude Code command や subagentを利用しており、管理が煩雑
- command や subagent を git 管理したい
対応
- plugin と plugin marketplace を使って command や subagent を管理する
手順例
- GitHub に plugin 管理用のリポジトリを作成する
- plugin と plugin marketplace を管理する
- plugin 管理用のリポジトリに subagent や command を追加する
// ディレクトリ構造例
├── .claude-plugin
│ └── marketplace.json
├── base-plugin
│ ├── .claude-plugin
│ │ └── plugin.json
│ ├── agents
│ │ ├── code-reviewer.md
│ │ └── git-commit-writer.md
│ └── commands
│ ├── code-review.md
│ └── commit.md
└── foo-plugin
├── .claude-plugin
│ └── plugin.json
├── agents
│ └── bar.md
└── commands
└── baz.md
// marketplace.json 例
{
"name": "foo-marketplace",
"owner": {
"name": "bar"
},
"plugins": [
{
"name": "base-plugin",
"source": "./base-plugin",
"description": "全projectで共通で利用するplugin"
},
{
"name": "hoge-plugin",
"source": "./hoge-plugin",
"description": "hoge領域に取り組む際に利用するplugin"
}
]
}
- command や subagent を利用するリポジトリの settings.json に extraKnownMarketplaces を追加し、 Claude Code を開き直す
"extraKnownMarketplaces": {
"foo-claude-plugins": {
"source": {
"source": "github",
"repo": "your-org/claude-plugins"
}
}
}
Defines additional marketplaces that should be made available for the repository. Typically used in repository-level settings to ensure team members have access to required plugin sources.
リポジトリで利用可能にするべき追加のマーケットプレイスを定義します。通常、チームメンバーが必要なプラグインソースにアクセスできるようにするため、リポジトリレベルの設定で使用されます。
-
/pluginから
Browse and install pluginsを選択し、必要な plugin を install する

-
subagent や command を利用する

用語
- plugin
- command, subagent, mcpサーバ, hooks をまとめて利用できるようにしたもの
- plugin marketplace
- 利用可能な plugin のカタログ
- plugin の配布は marketplace を利用して行われる
この対応により発生して、根本解決していない問題
- Claude Code GitHub Actions の workflow で subagent を利用していたが、これが利用できなくなった
Discussion