上級
Claude Code プラグインを開発・公開する
plugin.json マニフェスト、skills、commands、agents、hooks を含む完全なプラグイン構造を構築して公開する方法
pluginsdevelopmentdistribution
Claude Code プラグインを開発・公開する
Claude Code のプラグインシステムを使うと、スキル、コマンド、エージェント、フック、MCP サーバーを一つのパッケージとして配布できます。Superpowers、oh-my-claudecode、Everything Claude Code はすべてこの仕組みで動作しています。
プラグインのディレクトリ構造
my-plugin/
.claude-plugin/
plugin.json # マニフェスト
skills/
my-skill/
SKILL.md
commands/
my-command.md
agents/
my-agent.md
hooks/
hooks.json
mcp-config.json
styles/
.lsp.json
plugin.json マニフェスト
{
"name": "my-plugin",
"version": "1.0.0",
"description": "My custom Claude Code plugin",
"author": {
"name": "Developer Name",
"email": "dev@example.com"
},
"commands": "commands",
"agents": "agents",
"skills": "skills",
"hooks": "hooks/hooks.json",
"mcpServers": "mcp-config.json",
"outputStyles": "styles",
"lspServers": ".lsp.json"
}
マニフェストの各フィールド
| フィールド | 説明 | 必須 |
|---|---|---|
name | プラグイン名 | はい |
version | バージョン文字列 | はい |
description | 簡単な説明 | はい |
author | 作者情報 | はい |
commands | コマンドディレクトリへのパス | いいえ |
agents | エージェントディレクトリへのパス | いいえ |
skills | スキルディレクトリへのパス | いいえ |
hooks | フック定義へのパス | いいえ |
mcpServers | MCP設定へのパス | いいえ |
outputStyles | スタイルディレクトリへのパス | いいえ |
lspServers | LSP設定へのパス | いいえ |
プラグインのインストール方法
マーケットプレイスから
/plugin marketplace add owner/repo
/plugin install plugin-name@plugin-name
Git リポジトリから
/plugin install owner/plugin-repo
Superpowers の実例
Superpowers プラグインは14のスキル、1つのエージェント、SessionStart フックを含む実践的な参考実装です。
- SessionStart フック: セッション開始時に
using-superpowersスキルの内容を注入 - スキル自動検出: Skill ツールによって自動的に検出される
- 指示の優先順位: ユーザーの指示 > Superpowers スキル > デフォルトシステムプロンプト
- ゼロ依存: Node.js の組み込みモジュールのみ使用
スキル設計のベストプラクティス
Superpowers の writing-skills スキルから学べる重要な原則。
- Description Trap を避ける: description には「いつ使うか」だけを書き、「何をするか」は書かない
- トークン効率: 常にロードされるスキルは200語以内、その他は500語以内
- 合理化対策: 規律強制スキルには言い訳への反論を含める
- TDD for Skills: スキルなしでプレッシャーシナリオを実行し、ベースラインを記録してからスキルを作成
カスタム出力スタイル
styles/
my-style.md
---
description: "Concise output style focused on action items"
keep-coding-instructions: true
---
- Keep responses under 100 words unless code examples are needed
- Lead with the action, then explain why
- Use bullet points over paragraphs
---
## あわせて読む
- [Skill を定義して再利用可能なプロンプトを作る](/tips/skill-development-basics) - スキル定義の詳細
- [カスタムエージェントで専門タスクを委任する](/tips/custom-sub-agents) - エージェント定義の方法