Skip to content
←INDEX / Prompt library
TUTORIAL/Claude Code/AdvancedPRO

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.

SakuyaPromptCraft editor · Updated 2026-06-08
TutorialClaude CodeAdvanced
01PROMPT
一個大任務塞進單一對話,context 很快被搜尋結果、log、檔案內容塞爆。改用 subagents:把任務扇出成數個獨立子代理平行跑,各自在自己的 context 裡幹活、只回報摘要。這支提示詞幫你規劃分工、定義邊界、必要時產出可重用的子代理檔。

[ Log in to see the full prompt ]
LOGIN TO UNLOCK

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.

02CONTEXT / Why it works

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.

03SAMPLE / Expected result

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」 → 三個子代理並行,摘要回主線,再由主線彙整成報告。 ✅ 平行/序列已分 ✅ 無寫入衝突 ✅ 唯讀最小權限 ✅ 回報格式定死 ✅ 編排順序明確

A description of the intended result. Check this entry's testing notes and try the prompt with your own inputs.

RELATED
PRO01
TUTORIALSuno v5.5FEATURED
r/SunoAI (anonymous studio engineer)2026-06-12

Suno Engineer's Mindset: 4 Steps to a Song That Doesn't Sound Like AI

5.0(1)

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.

Advanced
Read

Free02
TUTORIALClaude 4.5 SonnetFEATURED
r/ClaudeAI2026-05-14

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.

Intermediate
Read

PRO03
TUTORIALClaude 4.5 SonnetFEATURED
r/PromptEngineering2026-05-14

7 Cross-Model A/B-Tested Prompt Techniques (Not Vibes)

Written after six months of A/B testing 200+ prompts on Claude, GPT-4, and Gemini with human raters. Covers persona + constraint stacking, anti-examples, role-reversal QA, cognitive scaffolds, emotional priming, uncertainty CoT, and steelman-first.

Advanced
Read

Free04
TUTORIALChatGPTFEATURED
r/ChatGPTPromptGenius2026-05-14

5 trust-checking one-liner prompts (no role-play)

After a year of role-play system prompts and 14-step frameworks, here's the takeaway: the thing that actually moved the needle on quality was 5 one-line prompts. No roles, no markdown, no "you are an expert."

Beginner
Read

COMMENTS · 討論區0 則
登入 後可留言。還沒帳號?註冊
目前沒有留言。第一個說說你的經驗。