從操作者到 Director:思維模式的轉變
改變一切的心智模型。如何將 Claude Code 視為擁有 parallel agents、專業化工具和自主能力的執行團隊。
掌握 Claude Code 最大的障礙不是技術——而是心態。大多數開發者以錯誤的思維模式接觸 AI 輔助,把 Claude 當作需要手把手指導的初級開發者。
這篇文章談的是改變一切的思維轉變——並以官方 Claude Code 功能的具體範例作為支撐。
使用 Claude Code 的兩種方式
操作者思維
操作者會給出逐步指令:
User: Read the file src/utils/date.ts
Claude: [shows file]
User: Find the formatDate function
Claude: [shows function]
User: Add a parameter for timezone
Claude: [makes change]
User: Now update the tests
Claude: [updates tests]
這樣可行。但很累人。你做了所有思考,Claude 只是在打字。
成本分析:
- 一個簡單任務需要 4+ 次來回
- 沒有並行執行——所有事情都是串行的
- 你需要記住每個步驟的認知負擔
- 完全沒有利用 Claude Code 的 agentic 能力
Director 思維
Director 定義結果並委派:
User: "Our date formatting doesn't handle timezones correctly.
Users in different timezones see wrong dates.
Fix this throughout the codebase."
Claude: [autonomously using parallel agents]
→ Explore agent: Maps all date-related files
→ Explore agent: Finds timezone-related patterns
→ Implementation: Updates formatDate with timezone support
→ Implementation: Propagates changes to all usages
→ test-runner: Runs tests and verifies coverage
→ Verification: Confirms no regressions
同樣的結果。快 5 倍。零微觀管理。
關鍵洞察
Claude Code 不是打字助手。它是擁有專業 agents 的思考夥伴。
根據官方文件,Claude Code 提供:
- Task tool 用於生成 parallel subagents
- 專業化 agents(debugger、security-auditor、test-runner 等)
- Hooks 用於自動執行政策
- CLAUDE.md 用於持久化專案上下文
當你微觀管理每次按鍵,你只用了 10% 的能力。當你以明確的結果委派時,你解鎖了其餘的能力。
五個心態轉變
轉變 1:從「如何」到「什麼」
操作者思維: 「我該如何告訴 Claude 做這個改動?」
Director 思維: 「我需要什麼結果?」
| 不要這樣想 | 改成這樣想 |
|---|---|
| 「讀取檔案 X,找到函數 Y,加入 Z」 | 「功能 X 需要支援 Y」 |
| 「執行 npm test 並給我看失敗結果」 | 「確保測試通過」 |
| 「建立一個新檔案叫做…」 | 「我們需要一個工具來…」 |
| 「搜尋所有使用…的地方」 | 「找出所有使用這個模式的地方」 |
| 「加入 console.log 來除錯…」 | 「除錯為什麼這個會失敗」 |
實際範例:
❌ Operator prompt:
"Read src/api/users.ts, find the createUser function, add try-catch
around the database call, log errors with prefix '[UserAPI]',
return 500 status on failure."
✅ Director prompt:
"Add proper error handling to the user creation endpoint
following our API error standards."
轉變:停止把意圖翻譯成指令。直接陳述意圖。
轉變 2:從控制到信任
操作者思維: 「我需要驗證每一步。」
Director 思維: 「我會驗證最終結果。」
這對開發者來說很難。我們被訓練要理解每一行。但請思考:
- 你會審查團隊成員寫的每一行嗎?
- 還是你信任他們然後審查 pull request?
Claude 值得同樣的信任——在最後同樣需要驗證。
信任但用 agents 驗證:
// Let Claude work autonomously
Task({
subagent_type: "general-purpose",
model: "sonnet",
prompt: "Implement the user profile editing feature following our patterns."
})
// Then verify with specialized agents
Task({
subagent_type: "code-reviewer",
model: "sonnet",
prompt: "Review the changes for quality and patterns."
})
Task({
subagent_type: "test-runner",
model: "haiku",
prompt: "Run all related tests and report coverage."
})
轉變 3:從串行到並行
操作者思維: 「先這個,然後那個,然後這個。」
Director 思維: 「什麼可以同時進行?」
Director 不會等財務部門完成後才開始行銷。他們並行運作,在里程碑同步。
來自 Task tool 文件:
Sequential (Operator):
Analyze → Plan → Implement → Test → Review
Time: 30s + 30s + 60s + 30s + 30s = 180s
Parallel (Director):
┌→ Analyze structure (30s) ─┐
├→ Find patterns (30s) ├→ Implement (60s) → Test + Review (30s)
└→ Check tests (30s) ─┘
Time: 30s + 60s + 30s = 120s (33% faster)
實際實作:
// Launch 5 parallel Explore agents
Task({
subagent_type: "Explore",
model: "haiku",
prompt: "Map authentication file structure (thoroughness: quick)"
})
Task({
subagent_type: "Explore",
model: "haiku",
prompt: "Find JWT-related patterns (thoroughness: quick)"
})
Task({
subagent_type: "Explore",
model: "haiku",
prompt: "Analyze middleware chain (thoroughness: medium)"
})
Task({
subagent_type: "Explore",
model: "haiku",
prompt: "Check existing auth tests (thoroughness: quick)"
})
Task({
subagent_type: "Explore",
model: "haiku",
prompt: "Review recent auth changes (thoroughness: quick)"
})
轉變 4:從指令到政策
操作者思維: 「這次告訴 Claude 要做什麼。」
Director 思維: 「定義每次都適用的政策。」
你的 CLAUDE.md 就是公司政策手冊。定義一次,永遠執行:
# CLAUDE.md - Project Constitution
## Code Standards
- TypeScript strict mode, no `any` types
- All functions must have explicit return types
- Maximum 50 lines per function
## Testing Policy
- All features require tests before completion
- Minimum 80% coverage for new code
- Integration tests for API routes
## Security Policy
- Files in auth/, payment/, admin/ trigger security-auditor
- No hardcoded secrets
- Validate all user inputs
## Autonomous Operations
Claude may freely:
- Read any project file
- Run tests and linting
- Create/modify files in src/ and tests/
- Create local git branches
## Requires Confirmation
- Pushing to remote
- Modifying environment files
- Deleting files
轉變 5:從手動檢查到自動化 Hooks
操作者思維: 「記得在 auth 改動後執行安全檢查。」
Director 思維: 「設定 hooks 自動執行這件事。」
來自 hooks 文件:
{
"hooks": {
"Stop": [{
"matcher": "*",
"hooks": [{
"type": "prompt",
"prompt": "If code in auth/, payment/, or admin/ was modified, verify security-auditor was run. If not, block and explain."
}]
}]
}
}
可用的 hook 事件:
| 事件 | 時機 | 使用案例 |
|---|---|---|
PreToolUse | 工具執行前 | 阻擋危險指令 |
PostToolUse | 工具執行後 | 審計變更 |
Stop | 完成前 | 驗證需求 |
SessionStart | Session 開始時 | 載入上下文 |
Director 做的事(操作者不做的)
1. 設定一次上下文
操作者在每個 prompt 重複上下文。
Director 在 CLAUDE.md 建立上下文:
# Project Context
React 18 app with TypeScript.
Using Prisma for database, Zod for validation.
See @docs/architecture.md for structure.
現在每次對話都從共享理解開始。
2. 定義約束,而非步驟
操作者列出每個步驟。
Director 定義邊界:
"Add user search functionality.
Constraints:
- Use existing search patterns
- Must be performant (< 200ms)
- Include proper pagination
- Don't modify the user model
Freedom to:
- Choose UI implementation
- Design the API contract
- Structure the components"
3. 委派給專家
操作者自己做所有事。
Director 用 Task tool 指派專家:
// For authentication change
Task({
subagent_type: "security-auditor",
model: "sonnet",
prompt: "Review for vulnerabilities"
})
Task({
subagent_type: "code-reviewer",
model: "sonnet",
prompt: "Check code quality and patterns"
})
Task({
subagent_type: "test-runner",
model: "haiku",
prompt: "Verify test coverage"
})
4. 審查結果,而非過程
操作者檢查每個中間步驟。
Director 驗證最終結果:
"Before I merge:
- All tests pass?
- Security review complete?
- Documentation updated?
- Backward compatible?"
Prompt 比較:10 個實際範例
範例 1:新增功能
❌ Operator:
"Create a new file src/components/DarkModeToggle.tsx. Add a React
component with a button. Use useState for the theme state. Add
onClick handler. Import from theme context. Add CSS classes..."
✅ Director:
"Add dark mode toggle to the settings page. Use our existing
theme system and persist the preference."
範例 2:修復 Bug
❌ Operator:
"Read src/api/orders.ts. Find line 45. There's a null check missing.
Add if statement before accessing user.id."
✅ Director:
"Orders API crashes when user is undefined. Find and fix the root cause."
範例 3:程式碼審查
❌ Operator:
"Show me file 1. Now file 2. Check for security issues in file 1.
Check for type errors in file 2. Look for missing tests..."
✅ Director:
"Review PR #123 comprehensively. Check security, quality, and coverage."
範例 4:重構
❌ Operator:
"Open utils/helpers.ts. Find formatCurrency. Move to utils/currency.ts.
Update imports in file1.ts, file2.ts, file3.ts..."
✅ Director:
"Extract currency utilities into their own module. Update all usages."
範例 5:除錯
❌ Operator:
"Add console.log at line 20. Run the app. Show me output.
Now add console.log at line 35..."
✅ Director:
"Dashboard loads slowly (8s, should be <2s). Find the bottleneck and fix it."
範例 6:測試
❌ Operator:
"Create test file. Import component. Write test for render.
Write test for click handler. Write test for state change..."
✅ Director:
"Add comprehensive tests for the checkout flow. Cover edge cases."
範例 7:文件
❌ Operator:
"Open README. Add section for installation. Add section for usage.
Add section for API..."
✅ Director:
"Update documentation to reflect the new authentication flow."
範例 8:安全審計
❌ Operator:
"Check file1 for SQL injection. Check file2 for XSS.
Check file3 for auth bypass..."
✅ Director:
"Audit the payment module for security vulnerabilities."
範例 9:效能
❌ Operator:
"Profile the dashboard. Show me slow queries.
Add index to users table. Cache the results..."
✅ Director:
"Optimize dashboard performance. Target <2s load time."
範例 10:遷移
❌ Operator:
"Read current API. List all endpoints. Create new versions.
Update route 1. Update route 2..."
✅ Director:
"Migrate from REST to GraphQL. Maintain backward compatibility."
信任方程式
有效的委派需要信任。信任建立於:
能力: Claude 深入理解程式碼。讓它展示這點。
清晰: 當你對結果清晰時,Claude 就能交付。
驗證: 信任但用專業 agents 驗證。
迭代: 回饋改善未來的互動。
公式:
Effective Delegation = Clear Outcome + Defined Constraints + Agent Verification
何時操作,何時當 Director
不是每個任務都需要 Director Mode。
使用操作者模式:
- 學習某個東西如何運作
- 逐步追蹤除錯
- 你想要控制的實驗
- 單行修改
使用 Director Mode:
- 功能實作
- 程式碼審查
- 重構
- 任何有多個步驟的任務
- 任何你會委派給團隊成員的事
按思維模式選擇模型
| 任務類型 | 模型 | 原因 |
|---|---|---|
| 快速探索 | Haiku 4.5 | 快速、便宜(快 2 倍,成本 1/3) |
| 標準開發 | Sonnet 4.5 | 平衡的 coding 效能 |
| 關鍵決策 | Opus 4.5 | 最高智力 |
快速切換模型(v2.0.65+):按 Option+P(macOS)或 Alt+P(Windows/Linux)。
轉型計畫
你不是一下子翻轉開關。你逐漸過渡。
第 1 週:覺察 注意你何時在微觀管理。問:「我可以改成陳述結果嗎?」
第 2 週:實驗 每天嘗試一個任務用 Director Mode。比較體驗。
第 3 週:Parallel Agents 使用 Task tool 生成 parallel Explore agents 進行調查。
第 4 週:CLAUDE.md 發展你的專案憲法。建立一次上下文。
第 2 個月:完整 Director Mode 讓 Director Mode成為你的預設。有意識地切換到操作者模式。 設定 hooks 自動執行政策。
衡量成功
效率指標
| 指標 | 操作者模式 | Director Mode |
|---|---|---|
| 每個功能的 prompts | 15-20 | 3-5 |
| Context switching | 高 | 低 |
| 完成時間 | 基準 | 快 40-60% |
| 一致性 | 不穩定 | 高 |
品質指標
你的 Director Mode正在發揮作用,當:
- Claude 第一次就產出符合你風格的程式碼
- 你很少糾正同樣的錯誤兩次
- Parallel agents 完成任務快 5 倍
- 審查通過 hooks 自動進行
更大的格局
這個思維轉變反映了職涯演進:
- 初級開發者:執行特定任務
- 資深開發者:解決更廣泛的問題
- Tech leads:定義結果並協調
- Engineering managers:設定方向並委派
與 Claude Code 的 Director Mode不只是生產力技巧。它是領導力的練習。你正在培養有效委派的技能——定義結果、設定約束、並信任他人找到路徑。
今天就開始
選擇你的下一個任務。在你 prompt 之前,問自己:
- 我需要什麼結果?
- 什麼約束重要?
- Claude 可以決定什麼?
- 哪些專業 agents 應該驗證?
然後為結果 prompt,而非步驟。
注意差異。從這裡開始建立。