メインコンテンツへスキップ

Director Mode フレームワーク:監督のように Claude Code をマスターする

コマンドを打つのを止め、成果を指揮しましょう。AI 開発の方法を根本から変える思考の転換を学びます—マイクロマネジメントから並列エージェントによる戦略的な統率へ。

多くの開発者は Claude Code を高機能なオートコンプリートのように使っています—指示を一つずつ入力し、応答を待ち、すべてのステップを手動で調整しています。これは オペレーターモード (Operator Mode) です。

より良い方法があります。Director Mode は Claude Code を専門部門を持つプロダクションチームとして扱います。あなたは望む成果を定義し、意図を設定し、システムを自律的に動かします—すべての作業を自分でやらずに優れた作品を創り出す監督のように。

このガイドでは、Claude Code の公式機能に基づいた完全な Director Mode フレームワークを解説します。

核心となる哲学

“監督はすべての作業を自分でやらない—チームが共に素晴らしい成果を出す条件を作り出す。”

Director Mode は3つの柱で構成されています:

  1. 指示よりも意図 - 達成方法ではなく、望む成果を定義する
  2. 並列エージェント委任 - 同時に動作する専門エージェントを信頼する
  3. 成果検証 - すべてのステップではなく、結果を検証する

Claude Code のエージェントアーキテクチャを理解する

Director Mode を実装する前に、Claude Code が実際に提供するものを理解しましょう。

サブエージェントと Agent ツール

Claude Code は Agent ツールを通じ、分離されたサブエージェントへ作業を委任できます。対話では役割、スコープ、期待する出力を明示すれば十分です。ツール呼び出しの schema は変更され得る実装詳細です:

Use an Explore subagent to map the authentication module.
Find every JWT-related function and its callers, then return conclusions
and relevant file paths rather than raw file dumps.

利用できる組み込み・カスタム agent は、現在の Claude Code バージョンとプロジェクト設定によって異なります。読み取り専用のコードベース調査には Explore、広い範囲のタスクには general-purpose、または .claude/agents/ で定義したカスタム agent を使います。

モデル選択戦略

モデル名、デフォルト、提供状況、レイテンシ、価格は変化します。まずサブエージェントにセッションモデルを継承させ、品質・速度・コストの有用な差をそのタスクで測定できた場合だけ上書きします。固定ティア表を永続化せず、/model または現在のモデルドキュメントを確認してください。

問題:オペレーターモード

典型的な開発者が Claude Code を使う様子を見てみましょう:

User: "Please read the file src/auth.ts"
Claude: [reads file]
User: "Now find the validateToken function"
Claude: [shows function]
User: "Add input validation for the token parameter"
Claude: [makes change]
User: "Now run the tests"
Claude: [runs tests]

これは オペレーターモード です—すべてのアクションをマイクロマネジメントしています。そのコスト:

  • シンプルなタスクに 5回以上のやり取り
  • 思考とプロンプト間の コンテキストスイッチ
  • 並列実行なし—すべてが順次処理
  • すべてのステップを覚えておく 認知的負荷

解決策:Director Mode

同じタスクを Director Mode で行うと:

User: "Implement input validation for token handling in our
      auth module. Follow our security guidelines and ensure
      test coverage."

Claude: [autonomously]
  → Explores codebase structure
  → Identifies all token-related functions
  → Analyzes existing validation patterns
  → Implements validation following project conventions
  → Writes comprehensive tests
  → Validates against security requirements

成果に焦点を当てた1つのプロンプトで、手作業の引き継ぎを減らします。

3つの柱を実践する

第1の柱:指示よりも意図

オペレーターのアプローチ:

"Read src/api/users.ts, find the createUser function,
add try-catch around the database call, log any errors
using console.error with the prefix '[UserAPI]', then
return a 500 status code."

Director のアプローチ:

"Add proper error handling to the user creation endpoint
following our API error standards."

プロジェクトのエラーハンドリング標準を CLAUDE.md で確立していれば、Claude は以下を把握しています:

  • どのロガーを使用するか
  • どのエラーフォーマットに従うか
  • レスポンスをどう構造化するか
  • エラーメッセージに何を含めるか

第2の柱:並列エージェント委任

Claude Code 2.0+ は 並列エージェント実行 をサポートしています。これがゲームチェンジャーです。

タスクを順次実行する代わりに:

Task 1 (30s) → Task 2 (30s) → Task 3 (30s) = 90 seconds total

並列で実行します:

Task 1 (30s) ┐
Task 2 (30s) ├→ 30 seconds total
Task 3 (30s) ┘

実例—コードベースの分析:

"I need to understand how authentication works in this project."

Claude spawns 5 parallel agents:
→ Agent 1 (Explore): Maps auth-related file structure
→ Agent 2 (Grep): Finds all JWT/token references
→ Agent 3 (Read): Analyzes middleware patterns
→ Agent 4 (Grep): Identifies security guidelines
→ Agent 5 (Read): Reviews existing tests

Results synthesized in ~30 seconds instead of 3+ minutes.

第3の柱:プロジェクトブループリント

あなたの CLAUDE.md ファイルはプロジェクトのブループリント(設計図)です。すべての開発を導く指針となる原則を定義します。

# CLAUDE.md - Project Blueprint

## Core Guidelines
- All code changes require corresponding tests
- Use TypeScript strict mode—no `any` types
- Follow the repository's existing patterns
- Security-first: validate all inputs at boundaries

## Autonomous Operations (No confirmation needed)
- Read any project file
- Run tests and linting
- Create/modify files in src/ and tests/
- Create local git branches

## Requires Confirmation
- Push to remote
- Modify environment variables
- Delete files
- Install production dependencies

## Agent Delegation Rules
When encountering these situations:
- Code quality questions → invoke code-reviewer agent
- Security-sensitive code → invoke security-auditor agent
- Performance concerns → run benchmarks before committing

Explore Agent 詳解

Explore agent はコードベースナビゲーション用の読み取り専用サブエージェントです。モデルと実行時間は現在の設定に依存するため、固定時間を約束せず、調査範囲に応じて徹底度を選びます。

徹底度レベル

Quick: Explore the auth module and find the login handler.
Medium: Map the JWT flow, including callers and tests.
Very thorough: Trace the complete authentication boundary and report evidence,
open questions, and relevant file paths.

旧方式 vs 新方式

旧方式(5つの手動ステップ):

Agent 1: Glob find *auth*.ts
Agent 2: Grep search "JWT"
Agent 3: Read auth/index.ts
Agent 4: Grep find authenticate() usage
Agent 5: Read test files

新方式(1つの Explore agent):

Use an Explore subagent to inspect the authentication implementation.
Focus on JWT handling, middleware, and test coverage. Return a concise map
with relevant file paths.

結果: 境界を定めた1回の委任で複数の手作業を置き換え、探索の詳細をメインコンテキストの外に保てます。実際の時間短縮はリポジトリとタスクによって異なります。

Agent の役割

Claude Code は組み込みサブエージェントとカスタム agent をサポートします。以下の名前は例であり、組み込みとは限りません。参照する前に .claude/agents/ で定義してください:

エージェント役割最適な用途
code-reviewerコード品質分析実装後
security-auditor脆弱性検出認証/決済の変更
test-runnerテスト実行と分析コード変更後
debugger根本原因分析エラー発生時
refactor-assistantコード改善複雑さの軽減
doc-writerドキュメント作成API 変更時

委任の例:

"Implement the payment integration.

Delegation:
→ security-auditor: Review before merge
→ code-reviewer: Check patterns and quality
→ test-runner: Ensure 80%+ coverage"

自動適用のための Hooks

Director Mode は hooks を使って設定済みのライフサイクルチェックを実行できます。hooks ドキュメントより:

Stop Hook - 完了の検証

{
  "Stop": [{
    "matcher": "*",
    "hooks": [{
      "type": "prompt",
      "prompt": "Check if code was modified. If Write/Edit was used, verify tests were run. If no tests ran, block and explain."
    }]
  }]
}

PreToolUse Hook - 危険な操作のブロック

{
  "PreToolUse": [{
    "matcher": "Bash",
    "hooks": [{
      "type": "prompt",
      "prompt": "If command contains 'rm -rf', 'drop', or destructive operations, return 'ask' for user confirmation. Otherwise 'approve'."
    }]
  }]
}

利用可能な Hook イベント

イベントタイミングユースケース
PreToolUseツール実行前承認/拒否/修正
PostToolUseツール実行後結果への対応
Stopエージェントが停止を検討完了の検証
SessionStartセッション開始コンテキストの読み込み
SubagentStopサブエージェント停止タスク完了の確認
UserPromptSubmitユーザーがプロンプトを送信コンテキスト追加/検証

並列実行パターン

パターン1:分析スウォーム

"Analyze the authentication system.

Launch in parallel:
→ Agent 1 (Explore quick): Map file structure
→ Agent 2 (Explore medium): Find all auth middleware
→ Agent 3 (Grep): Search for JWT patterns
→ Agent 4 (Read): Review existing tests
→ Agent 5 (Grep): Find recent auth changes"

時間比較: 順次作業では各ブランチの時間が加算され、並列作業では最も遅い独立ブランチに調整コストを加えた時間が目安になります。固定倍率を仮定せず、自分のタスクで測定してください。

パターン2:分割統治

複数ファイルのリファクタリング用:

"Migrate from REST to GraphQL.

Parallel implementation:
→ Agent 1: Convert users endpoints
→ Agent 2: Convert products endpoints
→ Agent 3: Convert orders endpoints
→ Agent 4: Update shared types
→ Agent 5: Update tests"

パターン3:実装とレビュー

"Build user profile editing.

Phase 1 (parallel):
→ Implementation agent: Build the feature
→ Test agent: Write test cases
→ Doc agent: Draft documentation

Phase 2 (parallel):
→ security-auditor: Security review
→ code-reviewer: Quality check"

実装レベル

レベル1:基本的な Director Mode

指示を成果に変換:

このように言う代わりにこう言う
”Add console.log statements to debug…""Debug why the user login fails"
"Create a new file called X and add…""Add a utility for date formatting"
"Run npm test and show me failures""Ensure all tests pass”

レベル2:CLAUDE.md ブループリント

以下を網羅する包括的な CLAUDE.md を作成:

  1. プロジェクトコンテキスト - 技術スタック、構造、コマンド
  2. 開発標準 - コードスタイル、テスト、ドキュメント
  3. ワークフローガイドライン - 確認が必要なもの、自律的な操作
  4. エージェント委任 - どのタスクにどのエージェントを使うか

レベル3:並列エージェントオーケストレーション

"Analyze and refactor the authentication module.

Phase 1 - Analysis (parallel):
→ 3 Explore agents: Map structure, find patterns, check tests

Phase 2 - Implementation (parallel):
→ Multiple agents: One per file

Phase 3 - Review (parallel):
→ code-reviewer + security-auditor + test-runner"

レベル4:完全自律モード

"Implement feature X end-to-end.

Constraints:
- Follow existing patterns
- 80%+ test coverage
- No breaking changes
- Security review required

Freedom to:
- Choose implementation approach
- Structure code as appropriate
- Design tests

Verify before completing:
- All tests pass
- No TypeScript errors
- Documentation updated"

実践例

バグ調査

"Users report 'undefined is not a function' on dashboard.

Investigate in parallel:
→ Explore: Search for error patterns
→ Grep: Find recent dashboard changes
→ Read: Check related components

Then:
- Fix root cause
- Add regression test
- Verify no other occurrences"

機能開発

"Add dark mode to the application.

Constraints:
- Use CSS variables
- Persist preference
- Default to system preference

Delegation:
→ Explore agents: Find all color usage
→ Implementation: Add theme system
→ test-runner: Visual regression tests"

コードレビュー

"Review PR #123 comprehensively.

Parallel review:
→ code-reviewer: Quality and patterns
→ security-auditor: Vulnerabilities
→ test-runner: Coverage analysis
→ Explore agent: Impact assessment

Output: Categorized findings with severity"

マインドセットの転換

オペレーターマインドセットDirector マインドセット
Claude に正確に何をするか指示するClaude に必要な成果を伝える
すべてのステップを分解する制約を定義し、Claude に計画させる
各応答を待つエージェントを並列で動かす
すべてのアクションを確認する信頼し、最終結果を検証する
トレーニングのようにプロンプトする監督のように委任する

成功の測定

効率性メトリクス

メトリクスオペレーターモードDirector Mode
プロンプトの形多数の手順単位の引き継ぎ少数の成果単位の引き継ぎ
コンテキストスイッチ
完了までの時間順次実行の基準タスクの独立性と調整コストに依存
一貫性場当たり的なプロンプトに依存明確なコンテキストと検証で改善

品質指標

Director Mode が機能している場合:

  • Claude が最初の試行であなたのスタイルに合ったコードを生成する
  • 同じミスを二度修正することがほとんどない
  • ブランチが本当に独立しているとき、並列 agent が待ち時間を短縮する
  • 明示的に委任した場合、または設定済みの自動化で強制した場合にレビューが実行される

今日から始める

1日目: 現在のプロンプトパターンに気づく。ステップバイステップの指示を出していませんか?

1週目:

  1. 3つのプロンプトを指示から成果に変換する
  2. 基本的なガイドラインを含む CLAUDE.md を作成する
  3. 1つの並列 Explore スウォームを試す

1ヶ月目:

  1. すべてのセクションを含む CLAUDE.md を完成させる
  2. 自動検証用の hooks を設定する
  3. すべての適切なタスクで並列エージェントを使用する
  4. 効率性の改善を測定する

クイックリファレンス

Director Mode プロンプトテンプレート

"[Outcome description]

Constraints:
- [Must-have requirements]

Freedom to:
- [Decisions Claude can make]

Delegation:
- [Which agents should review]

Verify:
- [Completion criteria]"

モデル選択

Explore/Search → デフォルトは継承し、必要なら低コストモデルを実測
Implementation → 測定で上書きが妥当と分かるまでセッションモデルを使用
Security/Architecture → 十分な能力を選び、結果を検証

並列実行ルール

Independent tasks → Launch simultaneously
Dependent tasks → Run sequentially
Mixed → Phase approach

Claude Code のワークフローを変革する準備はできましたか?オペレーターから Director への移行は、単なる効率性の問題ではありません—操作のレベルではなく、成果のレベルで働くことなのです。

出典: Claude Code subagents, Claude Code model configuration, Claude Code hooks