Claude Code Subagent Fan-Out: Splitting Big Tasks Into Parallel Subagents
Has Claude Code break a large task into several independent, parallel subagents (each with its own context, restricted tools, and an assignable model), planning how to fan the work out, defining each subagent's responsibility boundaries and reporting format, and producing reusable .claude/agents subagent definition files when needed.
一個大任務塞進單一對話,context 很快被搜尋結果、log、檔案內容塞爆。改用 subagents:把任務扇出成數個獨立子代理平行跑,各自在自己的 context 裡幹活、只回報摘要。這支提示詞幫你規劃分工、定義邊界、必要時產出可重用的子代理檔。
[ Log in to see the full prompt ]Sign up free to see the full prompt, copy it, save it, and join the discussion. Free content unlocks on login; Pro content is a separate subscription.
When to use: A task so large that a single conversation would get flooded with context from search results, logs, or file contents, or the same kind of work needs to be repeated across many files/modules (e.g., auditing 12 services, applying one rule across an entire monorepo, researching auth+db+api in parallel and then consolidating). Why it works: subagents are a genuine Claude Code feature as of 2026—each subagent has its own context, restricted tools, and an assignable model, returning only a summary to the main thread. This prompt first forces the correct decomposition (work that touches the same set of files, or has sequential dependencies, is not allowed to run in parallel), then picks the right execution method (a one-off fan-out / repeating over multiple targets with /batch / defining reusable subagents in .claude/agents), and finally gives an orchestration order. Tips: (1) research-type subagents should always be read-only (tools limited to Read/Grep/Glob, or Write/Edit disallowed); (2) route high-volume exploration to Haiku to save cost, reserving Opus for genuinely hard reasoning; (3) a subagent only receives its own system prompt, so its definition file must be self-contained and must nail down the reporting format; (4) subagents cannot spawn further subagents—don't design multi-level nesting.
Phase 1 拆解(節錄): - Lane A 研究 auth 模組(可平行,read-only)→ 回報:發現的問題清單 + 檔案:行號 - Lane B 研究資料層(可平行,read-only)→ 回報:同上 - Lane C 研究 API 層(可平行,read-only)→ 回報:同上 - Lane D 彙整成報告(SEQUENTIAL,依賴 A/B/C 的輸出)→ 不可與 A/B/C 同時跑 寫入衝突檢查:A/B/C 全唯讀、互不寫檔 → 安全平行。 Phase 2 方法:選『可重用 custom subagents』,因為你之後每個專案都想再跑這套安全審計。 Phase 3 產出(節錄): --- .claude/agents/security-researcher.md --- --- name: security-researcher description: Use proactively to audit a code area for security issues. Read-only. tools: Read, Grep, Glob model: haiku --- You audit the assigned module for injection, authz gaps, and secret leaks. Return ONLY: a bullet list of findings as `severity | file:line | one-line issue`. No prose. 調用(一則訊息內平行跑三個 lane): 「用 security-researcher 同時審 auth、資料層、API 三個模組,各自回報 findings」 → 三個子代理並行,摘要回主線,再由主線彙整成報告。 ✅ 平行/序列已分 ✅ 無寫入衝突 ✅ 唯讀最小權限 ✅ 回報格式定死 ✅ 編排順序明確
Suno Engineer's Mindset: 4 Steps to a Song That Doesn't Sound Like AI
A studio engineer's breakdown of Suno's fatal weaknesses (fried vocals, high-frequency artifacts), plus a 4-step DAW workflow and a Suno Studio cleanup prompt.
5 Claude Weekly Workflows That Stuck After 6 Months
Proposal generator / meeting processor / content repurposer / Friday review / shutdown reset — out of 40 I tried, only these 5 survived, each saving 30+ minutes per run.