01. なぜこのリポジトリを読むのか?
CLI本体のソースコードではないのに、読む価値があるのか?
Section titled “CLI本体のソースコードではないのに、読む価値があるのか?”答え:Yes! このリポジトリから得られる知見は、Claude Codeを使いこなす上で非常に価値があります。
得られる知見
Section titled “得られる知見”1. プラグイン開発のスキル 🔧
Section titled “1. プラグイン開発のスキル 🔧”何ができるようになるか
Section titled “何ができるようになるか”- 自分専用のコマンドを作成できる
- チーム固有のワークフローを自動化できる
- プロジェクト固有のルールをフックで強制できる
Before(プラグインなし):
毎回同じ手順を手作業で説明 ↓"まずlintを実行して、テストを通して、コミットして、PRを作成して..." ↓時間がかかる、手順を忘れるAfter(カスタムプラグイン):
/ship というコマンドを作成 ↓lint → test → commit → push → PR作成を自動化 ↓1コマンドで完了、ミスなし実装例:
---description: Lint, test, commit, push, and create PRallowed-tools: Bash(npm:*), Bash(git:*), Bash(gh:*)---
## Workflow
1. Run `npm run lint`2. Run `npm test`3. If both pass: - Create commit with descriptive message - Push to remote - Create PR with summary
Do all steps in sequence. Stop if any step fails.2. Claude Codeの拡張性の理解 🚀
Section titled “2. Claude Codeの拡張性の理解 🚀”理解できること
Section titled “理解できること”- どこまでカスタマイズできるか
- どんな自動化が可能か
- プラグインシステムの限界
実例:feature-devプラグインから学べること
Section titled “実例:feature-devプラグインから学べること”plugins/feature-dev/ を読むと分かること:
Claude Codeは7フェーズのワークフローを実行できる:
Phase 1: Discovery(要件理解) ↓Phase 2: Exploration(3つのエージェントを並列起動) ├─→ Agent 1: 類似機能を探す ├─→ Agent 2: アーキテクチャを分析 └─→ Agent 3: UIパターンを調査 ↓Phase 3: Questions(不明点を質問) ↓Phase 4: Design(3つのアプローチを提案) ↓Phase 5: Implementation ↓Phase 6: Testing ↓Phase 7: Review知見:
- マルチエージェントを並列実行できる
- フェーズごとにタスクを分割できる
- エージェントごとにツール権限を制限できる
→ 自分のワークフローにも応用できる!
3. プロンプトエンジニアリングの技術 💡
Section titled “3. プロンプトエンジニアリングの技術 💡”Anthropic公式の実装パターンを学べる
Section titled “Anthropic公式の実装パターンを学べる”重要な発見:
パターン1: 動的コンテキストの注入
Section titled “パターン1: 動的コンテキストの注入”❌ 素人の書き方:
Create a git commit for the current changes.✅ Anthropic公式の書き方:
## Context
- Current git status: !`git status`- Current git diff: !`git diff HEAD`- Current branch: !`git branch --show-current`- Recent commits: !`git log --oneline -10`
## Your task
Based on the above changes, create a single git commit.知見: 最新情報を動的に取得して、コンテキストを充実させる
パターン2: 明確な制約の設定
Section titled “パターン2: 明確な制約の設定”plugins/commit-commands/commands/commit.md:
You have the capability to call multiple tools in a single response.Stage and create the commit using a single message.Do not use any other tools or do anything else.Do not send any other text or messages besides these tool calls.知見:
- 「何をすべきか」だけでなく「何をすべきでないか」も明示
- ツールの使用を制限することで、意図しない動作を防ぐ
パターン3: エージェントの専門化
Section titled “パターン3: エージェントの専門化”plugins/feature-dev/agents/code-explorer.md:
You are an expert code analyst specializing in tracing andunderstanding feature implementations across codebases.
## Core MissionProvide a complete understanding of how a specific feature works...
## Analysis Approach1. Feature Discovery2. Code Flow Tracing3. Architecture Analysis4. Implementation Details知見:
- 役割を明確に定義
- 分析アプローチを構造化
- 期待する出力を明示
→ 自分のプロンプトにも応用できる!
4. ワークフロー設計の知識 📋
Section titled “4. ワークフロー設計の知識 📋”複雑なタスクを構造化する方法
Section titled “複雑なタスクを構造化する方法”例:code-reviewプラグイン
plugins/code-review/commands/code-review.md から学べること:
複雑なPRレビューを5つのエージェントに分割:
1. comment-analyzer(コメント分析)2. test-analyzer(テスト分析)3. type-design-analyzer(型設計分析)4. code-reviewer(コードレビュー)5. code-simplifier(簡素化提案)
各エージェントが独立してレビュー ↓信頼度スコア(0-100)を付与 ↓80%以上の問題のみ報告(false positive削減)知見:
- 複雑なタスクは専門家に分割
- 品質管理(信頼度スコア)の導入
- false positiveの削減戦略
→ 自分の複雑なワークフローにも応用できる!
5. Claude Code内部仕様の推測 🔍
Section titled “5. Claude Code内部仕様の推測 🔍”利用可能なツールとその使い方
Section titled “利用可能なツールとその使い方”プラグインのコードを読むことで、Claude Codeの内部仕様が分かる:
利用可能なツール一覧:
# ファイル操作tools: Glob, Grep, Read, Edit, Write
# シェル実行tools: Bash
# TODO管理tools: TodoWrite
# Webtools: WebFetch, WebSearch
# Jupytertools: NotebookRead, NotebookEdit
# その他tools: Task, KillShell, BashOutputツールの制限方法:
# すべてのgitコマンドallowed-tools: Bash(git:*)
# git addとcommitのみallowed-tools: Bash(git add:*), Bash(git commit:*)
# npmのtestコマンドのみallowed-tools: Bash(npm test:*)知見:
- 正規表現でツールを制限できる
:*でサブコマンドを許可- 複数のツールをカンマ区切りで指定
6. フックシステムの活用 🎣
Section titled “6. フックシステムの活用 🎣”ファイル編集前に自動チェック
Section titled “ファイル編集前に自動チェック”例:security-guidanceプラグイン
if ".github/workflows/" in file_path: print("⚠️ Warning: GitHub Actions workflow") print("Be careful of command injection")応用例:
例1: チーム規約の自動チェック
Section titled “例1: チーム規約の自動チェック”if file_path.endswith(".tsx"): # import順序をチェック # 命名規則をチェック # 禁止パターンをチェック if violation_found: print("⚠️ Team Convention Violation:") print("- Imports should be in this order: React, libraries, local")例2: コミット前のチェック
Section titled “例2: コミット前のチェック”# コンソールログの残存チェック# デバッグコードのチェック# TODOコメントのチェック知見:
- ツール実行前にバリデーション可能
- チーム規約を自動的に強制できる
- セキュリティチェックを組み込める
実践的な応用例
Section titled “実践的な応用例”ケース1: 個人の開発ワークフロー最適化
Section titled “ケース1: 個人の開発ワークフロー最適化”あなたの状況:
- 毎回同じ手順でPRを作成
- ブログ記事を書くときの定型作業
- 特定の形式でドキュメントを生成
このリポジトリから得られる知見:
commit-commandsを参考に、自分専用の/blog-postコマンド作成- テンプレート生成、画像最適化、デプロイを自動化
実装例:
---description: Create and publish a blog post---
1. Create markdown file with frontmatter2. Optimize images in ./images3. Generate OG image4. Git commit and push5. Trigger deploymentケース2: チーム開発の標準化
Section titled “ケース2: チーム開発の標準化”あなたのチーム:
- PR作成時に特定のチェックリストが必要
- コードレビュー観点が決まっている
- セキュリティガイドラインがある
このリポジトリから得られる知見:
feature-devを参考に、チーム専用の開発ワークフロー作成security-guidanceを参考に、チーム規約のチェックフック作成code-reviewを参考に、カスタムレビューエージェント作成
実装例:
---description: Create PR following team standards---
1. Run linter2. Run tests (unit + integration)3. Check coverage (>80% required)4. Generate changelog entry5. Create PR with team template: - Summary - Breaking changes - Migration guide - Screenshots (if UI)ケース3: 特定ドメインの専門化
Section titled “ケース3: 特定ドメインの専門化”あなたの専門分野:
- データサイエンス(Jupyter Notebook中心)
- フロントエンド開発(React/TypeScript)
- インフラ(Terraform/Kubernetes)
このリポジトリから得られる知見:
- エージェントを専門分野に特化させる方法
- ドメイン固有のツールセットの設定
実装例(データサイエンス):
---name: data-analyzerdescription: Analyzes datasets and suggests visualizationstools: NotebookRead, NotebookEdit, Read, WebFetchmodel: sonnet---
You are a data science expert.
## Analysis Approach1. Load and inspect dataset2. Check data quality (missing values, outliers)3. Suggest appropriate visualizations4. Recommend statistical testsBefore:このリポジトリを読む前
Section titled “Before:このリポジトリを読む前”Claude Codeをブラックボックスとして使う ↓提供された機能のみ使用 ↓繰り返し同じ手順を説明 ↓効率が悪いAfter:このリポジトリを読んだ後
Section titled “After:このリポジトリを読んだ後”Claude Codeの拡張性を理解 ↓自分のワークフローに合わせてカスタマイズ ↓コマンド、エージェント、フックを自作 ↓自動化により生産性が大幅向上具体的な学習目標
Section titled “具体的な学習目標”初級レベル(1-2日)
Section titled “初級レベル(1-2日)”- シンプルなコマンドを1つ作成できる
- 動的コマンド実行を使える
- allowed-toolsの仕組みを理解
成果物: 自分専用の/statusや/deployコマンド
中級レベル(3-5日)
Section titled “中級レベル(3-5日)”- フックを1つ作成できる
- Pythonスクリプトでバリデーション実装
- セキュリティチェックを組み込める
成果物: チーム規約チェックフック
上級レベル(1-2週間)
Section titled “上級レベル(1-2週間)”- マルチエージェントワークフローを設計できる
- 複雑なタスクをフェーズに分割できる
- プラグインをチームで共有できる
成果物: チーム専用の機能開発ワークフロー
まとめ:このリポジトリを読む価値
Section titled “まとめ:このリポジトリを読む価値”| 観点 | 価値 |
|---|---|
| 実装技術 | プラグイン開発のスキル獲得 |
| 設計思想 | ワークフロー設計のパターン学習 |
| プロンプト技術 | Anthropic公式のベストプラクティス |
| 応用力 | 自分の問題に適用できる |
| 生産性 | 繰り返し作業の自動化 |
| 品質 | チーム規約の自動チェック |
結論: CLI本体のソースコードではないが、Claude Codeを使いこなすための実践的な知識が詰まっている。
このリポジトリは「Claude Codeの教科書」であり、読むことで:
- ツールとしての理解が深まる
- 自分でカスタマイズできるようになる
- チームの生産性を向上させられる
次のアクション
Section titled “次のアクション”始めましょう!