Advanced

Paste this guide into Claude Code and it will walk you through every step interactively.

Parallelization Patterns

What this gives you: The ability to run 5-10 tasks simultaneously instead of one at a time. Research competitors, build a landing page, and review code all at once. The same work that takes a day gets done in an hour.

Running tasks one at a time is the slowest, most expensive way to use AI. Running them in parallel - with the right pattern - gets you better results in less time at a fraction of the cost.

Why Parallel Beats Serial

Most people use Claude Code like a conversation: ask a question, wait for the answer, ask the next question. This is fine for simple, sequential tasks. It is terrible for research, analysis, quality assurance, and anything that benefits from multiple perspectives.

The problem with serial execution is threefold. First, it is slow - tasks that could run simultaneously are blocked behind each other. Second, it is expensive in terms of your time because you are the bottleneck between each step. Third, and most importantly, it produces worse results because a single agent builds up context bias - it gets attached to its initial approach and stops questioning its own assumptions.

Parallelization solves all three problems. Multiple agents working simultaneously finish faster, you are freed from babysitting each step, and independent agents with no shared context produce genuinely diverse outputs that you can synthesise into a higher-quality result.

The three patterns below cover 90% of use cases. Learn these and your effective output quality will jump substantially.

Pattern 1: Fan Out / Fan In

The core idea: split a research or analysis task across multiple cheap agents simultaneously, then have one higher-quality agent synthesise the results.

# Fan Out / Fan In - visual diagram ┌─ Sonnet Agent 1: "Research competitor pricing models" ├─ Sonnet Agent 2: "Research competitor onboarding flows" User Task ──────────┼─ Sonnet Agent 3: "Research competitor content strategy" ├─ Sonnet Agent 4: "Research competitor tech stack" └─ Sonnet Agent 5: "Research competitor customer reviews" │ ▼ Opus Agent: "Synthesise all findings into strategic recommendations"

Why this works on cost: Sonnet costs $3 per million input tokens. Opus costs $15 per million. By using Sonnet for the research phase (which is mostly reading and summarising) and Opus only for the synthesis (which requires higher reasoning), you pay $3/MTok for 80% of the work instead of $15/MTok for 100%.

On a task with five research agents each processing 10,000 tokens, and one synthesis agent processing 50,000 tokens:

40% cheaper, faster because the research runs in parallel, and often better because each research agent goes deeper on its specific sub-topic.

Real-World Example: Competitor Analysis

# Step 1: Dispatch 5 Sonnet research agents in parallel # Each runs simultaneously - do not wait for one before starting the next claude -p "Research how [Competitor A] prices their AI automation services. Find: pricing tiers, trial/freemium offers, annual vs monthly, enterprise deals. Summarise in 300 words." --model claude-sonnet-4-5 & claude -p "Research [Competitor A]'s onboarding flow. Find: first week experience, handholding level, docs quality, time-to-value. Summarise in 300 words." --model claude-sonnet-4-5 & claude -p "Research [Competitor A]'s content strategy. Find: YouTube presence, newsletter, LinkedIn activity, content frequency. Summarise in 300 words." --model claude-sonnet-4-5 & # Wait for all agents to finish wait # Step 2: Collect all outputs into one file cat research-1.txt research-2.txt research-3.txt > combined-research.txt # Step 3: Run Opus to synthesise claude -p "You have research from 5 analysts. Synthesise into strategic recommendations. What are the gaps in the market? Where should we position differently? Research: $(cat combined-research.txt)" --model claude-opus-4-5
Tip: In Claude Code, you can dispatch multiple sub-agents from a single session. Each sub-agent runs in its own context, so they cannot contaminate each other's research with shared assumptions.

Pattern 2: Developer + QA

Build with one agent. Review with a completely fresh agent that has never seen the code.

This pattern exploits a well-known problem in software development: you cannot QA your own work effectively. Not because you are bad at testing, but because you wrote the code with specific assumptions baked in. You test the paths you intended to build, not the paths a user will actually take. A fresh reviewer, with no context about what you were trying to do, tests without those assumptions.

# Developer phase - build the feature claude "Build a Stripe webhook handler that: - Receives payment_intent.succeeded events - Updates the customer record in Supabase - Sends a Slack notification to the #payments channel - Handles errors gracefully and logs them" # ---- Feature is built ---- # QA phase - FRESH AGENT, no prior context claude -p "You are a senior QA engineer reviewing this Stripe webhook handler. You have never seen this code before. Your job is to find: 1. Security vulnerabilities (missing signature verification, injection risks) 2. Edge cases not handled (network failures, duplicate events, partial updates) 3. Performance issues (blocking calls, missing indexes, N+1 queries) 4. Missing error handling paths 5. Incorrect assumptions about the data shape Code to review: $(cat webhook-handler.ts)"

The key requirement: the QA agent must have zero context from the build session. It should not know what you were trying to achieve, what trade-offs you made, or what you considered and rejected. This bias-free perspective is what makes it valuable.

Real-World Example: Cold Email Campaign

# Developer agent: write the email sequence claude "Write a 5-email cold outreach sequence for solar installers. Offer: AI lead reactivation system that books dead leads into consultations. Sequence: intro, case study, objection handling, urgency, final follow-up." # QA agent: review with fresh eyes claude -p "You are a cold email conversion specialist. Review this 5-email sequence. Find: weak subject lines, missing personalisation hooks, logical gaps between emails, claims that need proof, calls-to-action that are unclear or too soft, and anything that sounds like every other AI agency email. Sequence: [paste sequence here]"
Warning: Do not use the same Claude Code session for both developer and QA. The QA agent will have the build context in its window and will unconsciously defend the decisions that were made. Open a new session or use a sub-agent invoked fresh with -p.

Pattern 3: Stochastic Consensus

For high-stakes decisions where you genuinely do not know the right answer, spawn 5-10 agents with slightly different framings of the same question. The answers that appear across multiple independent agents represent high confidence. Answers that only appear once represent genuine uncertainty.

# Stochastic consensus - 5 agents, same question, different framings # Agent 1: Optimistic framing claude -p "What pricing model would maximise revenue for an AI automation agency targeting solar installers? Consider the upside scenario." > price-1.txt & # Agent 2: Risk-focused framing claude -p "What pricing model minimises churn risk for an AI automation agency targeting solar installers? Consider what could go wrong." > price-2.txt & # Agent 3: Customer POV framing claude -p "From a solar installer's perspective, what pricing model for an AI automation service feels most fair and easiest to justify internally?" > price-3.txt & # Agent 4: Competitive framing claude -p "What pricing model differentiates an AI automation agency from competitors in the home services market? What would make a solar installer choose us?" > price-4.txt & # Agent 5: Unit economics framing claude -p "What pricing model produces the best unit economics for an AI automation agency with ~80% margins? Model the numbers." > price-5.txt & wait # Synthesis: find where agents agree claude -p "5 analysts gave independent pricing recommendations. Find: 1. Recommendations that appear in 2+ analyses (high confidence) 2. Recommendations that appear in only 1 (genuine uncertainty or niche insight) 3. Direct contradictions (explore these - they reveal real trade-offs) Reports: $(cat price-1.txt price-2.txt price-3.txt price-4.txt price-5.txt)"

The magic of this pattern is in the contradictions. When two agents with different framings reach the same conclusion, you can be confident. When they contradict each other, you have found a real trade-off that deserves deliberate choice rather than being papered over by a single agent's bias.

Real-World Application: Building a Landing Page

Combining all three patterns for a single deliverable:

  1. Fan Out research: 3 Sonnet agents each research 5 competitors' landing pages - headline structure, offer framing, proof elements, CTA design
  2. Opus synthesis: One Opus agent turns the research into a landing page brief with the strongest elements from each competitor
  3. Developer agent: Builds the page from the brief
  4. QA agent (fresh): Reviews the page for conversion issues, mobile problems, load speed, clarity of value proposition
  5. Stochastic consensus on headline: 5 agents each write 3 headline options with different framings, pick whichever appears most consistently

This sounds like a lot of steps. In practice, steps 1-3 run in the background while you do other work. Steps 4-5 take 10 minutes. Total time investment from you: 30 minutes. Total quality: significantly higher than any single-agent approach could produce.

Token Conservation Rules

Parallelization increases quality but can increase cost if not managed. These rules keep spending in check:

RuleWhy It Saves Tokens
Sonnet for research, Opus for synthesis onlyNever use Opus for tasks that are primarily reading and summarising. Reserve it for high-reasoning synthesis work.
One Write over many EditsWhen rewriting a large file, do it in one operation. Multiple small edits each start a new context, wasting tokens on preamble.
Store API docs locallyIf you use an API repeatedly, download the docs and reference them from disk. Re-fetching the same documentation on every session is pure waste.
Scope your sub-agents tightlyA sub-agent with a narrow task processes fewer tokens and produces better output. "Research competitor pricing" beats "Research everything about this competitor."
Use -p for disposable tasksThe claude -p flag runs a one-shot query without maintaining a session. No session overhead, no accumulated context cost.

When NOT to Parallelize

Parallelization has overhead. There is coordination cost, synthesis time, and the complexity of managing multiple outputs. Do not apply it to:

ScenarioWhy Parallel Doesn't Help
Simple, well-defined tasks"Write me a git commit message for these changes" does not benefit from 5 agents. One is fine.
Sequential dependenciesIf task B requires the output of task A, you cannot run them in parallel. Build step 2 genuinely needs the code from step 1.
Conversational tasksDebugging a specific error interactively is a back-and-forth dialogue. Parallelization does not help here.
Small decisionsNot every choice warrants consensus. Reserve stochastic consensus for decisions that will compound over time.
Tip: A useful rule of thumb - parallelize when the task has a clear output that can be evaluated, and when multiple independent perspectives genuinely improve that output. If you cannot define "better" for the output, you cannot benefit from consensus.

Want this built into your workflow?

I can build a parallelized agent system that runs these patterns automatically for your specific business tasks.

Book a Call
Next Guide
The Auto-Research Loop