從操作者到 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
一個以成果為中心的請求,減少手動協調。
關鍵洞察
Claude Code 不是打字助手。它是擁有專業 agents 的思考夥伴。
Claude Code 提供:
- Agent 工具,可將工作委派給子代理,並在任務獨立時平行委派
- 內建與專案定義的子代理;實際可用項目取決於設定
- Hooks,在生命週期事件執行已設定的檢查
- CLAUDE.md,提供持久化的專案上下文與指引
微觀管理每次按鍵,會把規劃與協調負擔留給你。清楚定義成果能讓 Claude 使用更多 agentic 工作流,而最終驗證責任仍由你掌握。
五個心態轉變
轉變 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 驗證:
Delegate implementation of the user-profile editing feature to a subagent.
Ask it to follow existing patterns and return changed files plus verification.
After implementation, use a separate reviewer to inspect quality and patterns,
then run the related tests and report the actual results.
轉變 3:從串行到並行
操作者思維: 「先這個,然後那個,然後這個。」
Director 思維: 「什麼可以同時進行?」
Director 不會等財務部門完成後才開始行銷。他們並行運作,在里程碑同步。
只有分支互相獨立時,平行處理才有幫助。相依工作仍須按順序執行,每次 fan-out 也會增加協調成本:
Sequential (Operator):
Analyze → Plan → Implement → Test → Review
Parallel (Director):
┌→ Analyze structure ─┐
├→ Find patterns ├→ Implement → Test + Review
└→ Check tests ─┘
實際實作:
Investigate the authentication system. Delegate independent read-only checks
in parallel: map the file structure, find JWT patterns, trace middleware,
inspect existing tests, and review recent auth changes. Synthesize the findings
before proposing an implementation.
轉變 4:從重複指令到可重用指引
操作者思維: 「這次告訴 Claude 要做什麼。」
Director 思維: 「把長期上下文放進 CLAUDE.md,硬性政策則在其他層強制。」
CLAUDE.md 是共享的專案作業手冊。長期指引可以寫一次,但必須強制的邊界應使用 permissions、sandbox 或 hooks:
# 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 Guidance
- Changes in auth/, payment/, admin/ require security review
- No hardcoded secrets
- Validate all user inputs
## Working Defaults
Claude should normally:
- Read any project file
- Run tests and linting
- Create/modify files in src/ and tests/
- Create local git branches
## Boundaries to enforce in settings, sandbox, or hooks
- 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 會明確委派審查角色。security-auditor 這類自訂名稱必須先完成設定才能使用:
For this authentication change:
- Ask the configured security reviewer to check vulnerabilities.
- Use a separate reviewer for code quality and project patterns.
- Run the relevant tests and report coverage from the actual test output.
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:
- 功能實作
- 程式碼審查
- 重構
- 任何有多個步驟的任務
- 任何你會委派給團隊成員的事
按思維模式選擇模型
不要把思維模式綁定到固定模型名稱。模型、預設值、價格與供應情況都會改變:
| 任務類型 | 預設策略 | 何時覆寫 |
|---|---|---|
| 探索 | 繼承 session 模型 | 實測顯示較低成本選項仍保有所需品質 |
| 實作 | 使用 session 預設 | benchmark 顯示品質、延遲或成本取捨更好 |
| 安全或架構 | 選擇足夠能力並驗證 | 風險等級與評估結果支持時 |
轉型計畫
你不是一下子翻轉開關。你逐漸過渡。
第 1 週:覺察 注意你何時在微觀管理。問:「我可以改成陳述結果嗎?」
第 2 週:實驗 每天嘗試一個任務用 Director Mode。比較體驗。
第 3 週:Parallel Agents 使用 Agent 委派進行彼此獨立的 Explore 調查,再整合結果。
第 4 週:CLAUDE.md 發展你的專案憲法。建立一次上下文。
第 2 個月:完整 Director Mode 讓 Director Mode成為你的預設。有意識地切換到操作者模式。 設定 hooks 自動執行政策。
衡量成功
效率指標
| 指標 | 操作者模式 | Director Mode |
|---|---|---|
| 提示模式 | 許多逐步交接 | 較少的成果層級交接 |
| Context switching | 高 | 低 |
| 完成時間 | 順序執行基準 | 取決於任務獨立性與協調成本 |
| 一致性 | 取決於臨時提示 | 透過清楚上下文與驗證改善 |
品質指標
你的 Director Mode正在發揮作用,當:
- Claude 第一次就產出符合你風格的程式碼
- 你很少糾正同樣的錯誤兩次
- 任務分支真正獨立時,parallel agents 可縮短實際等待時間
- 審查會在明確委派或設定好的 hooks 強制時執行
更大的格局
這個思維轉變反映了職涯演進:
- 初級開發者:執行特定任務
- 資深開發者:解決更廣泛的問題
- Tech leads:定義結果並協調
- Engineering managers:設定方向並委派
與 Claude Code 的 Director Mode不只是生產力技巧。它是領導力的練習。你正在培養有效委派的技能——定義結果、設定約束、並信任他人找到路徑。
今天就開始
選擇你的下一個任務。在你 prompt 之前,問自己:
- 我需要什麼結果?
- 什麼約束重要?
- Claude 可以決定什麼?
- 哪些專業 agents 應該驗證?
然後為結果 prompt,而非步驟。
注意差異。從這裡開始建立。
資料來源:Claude Code subagents、Claude Code model configuration、Claude Code hooks、Claude Code memory