💬 hippo: This is a real field log of using Subagents to rewrite blog posts in parallel. Moving from writing one post at a time to running 20 concurrently delivered a clear speedup—along with a few rate-limit pitfalls along the way.


1. Background: Why Use Subagents?

I had 27 Claude Code Official Docs Breakdown posts that needed a full rewrite. The original drafts had major issues:

  • Mostly generic, boilerplate filler
  • Missing code examples and configuration schemas from the official guides
  • Empty platitudes instead of concrete technical explanations

The problem with writing sequentially: Every post bloats the conversation context. By the 10th article, Claude starts forgetting the template rules and output quality degrades.

Why Subagents help:

  • Each Subagent gets its own isolated context window
  • Tasks run concurrently without interfering with each other
  • The main thread only waits for completion summaries

2. Subagent Configuration

2.1 Create the Article Template

Define the rewrite rubric in .claude/templates/doc-rewrite-template.md:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Claude Code Official Docs Breakdown Template

## Article Structure

Every post must include the following sections:

### Front Matter

\`\`\`yaml
---
title: "Official Docs Breakdown: {Topic Name}"
date: {YYYY-MM-DD HH:mm:ss}
tags: [Claude Code, AI Tools, Official Docs Breakdown]
categories: [AI Tools]
series: claude-code
series_index: {index}
description: {50-100 char summary covering key concepts}
source_url: {official docs URL}
---
\`\`\`

## Acceptance Criteria

| Element | Requirement | Minimum |
|------|------|---------|
| Code blocks | Language tag required | ≥2 |
| Config examples | Copy-pasteable JSON/YAML/Bash | ≥1 |
| Tables | Parameter reference table with headers | ≥1 |
| Concept explanations | Concrete details, no boilerplate | Every section |
| Field notes | Real pitfalls or hands-on advice | ≥1 |
| Length | Excluding Front Matter | ≥1,000 chars |

## Banned Boilerplate

❌ The following filler lines fail review:
- "This feature is an important part of the Claude Code ecosystem"
- "Practice makes perfect—try it yourself"
- "Learn by scenario and check the docs when issues arise"

2.2 Define the Custom Subagent

Create the custom Subagent definition in .claude/agents/doc-writer.md (YAML front matter is required—Claude Code uses name and description to discover and route to the agent):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
name: doc-writer
description: Rewrites Claude Code Official Docs Breakdown posts against the template. Invoke when the main thread needs to batch-rewrite official-docs posts in parallel.
tools: Read, Write, WebFetch, WebSearch
---

# Claude Code Official Docs Breakdown Writer Agent

You are a dedicated agent for rewriting Claude Code Official Docs Breakdown posts.

## Objective

Rewrite low-quality docs breakdown drafts into substantive, technically accurate posts.

## Workflow

1. **Read the template**: Start by reading `.claude/templates/doc-rewrite-template.md`
2. **Read the draft**: Inspect the target existing post
3. **Fetch official docs**: Use WebFetch to pull the official documentation page
4. **Rewrite to spec**: Follow the template structure and acceptance criteria
5. **Self-check**: Verify ≥2 code blocks, ≥1 config example, and ≥1 table

## Output Format

Return a brief summary on completion: file path, code block count, config example count, and table count.

3. Launching Subagents in Parallel

3.1 Launch a Single Subagent

Use the Agent tool to start a background task:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Agent "Rewrite sub-agents.md"
Prompt:
You are a documentation rewrite Agent. Complete the task in these steps:

1. Read the article template: `.claude/templates/doc-rewrite-template.md`
2. Read the existing draft: `source/_posts/ai-tools/official-docs/sub-agents.md`
3. Fetch the official docs: https://code.claude.com/docs/en/sub-agents
4. Rewrite the article according to the template structure

Output a brief summary when done.

Options:
- run_in_background: true ← Key: execute in the background
- subagent_type: "general-purpose"

3.2 Launch Multiple Subagents in Parallel

The key: Invoke multiple Agent tool calls in a single message to get true parallel execution:

1
2
3
4
5
6
7
8
9
10
11
┌─────────────────────────────────────────────────────┐
│ Main Thread │
│ │
│ Agent(sub-agents.md) ────┐ │
│ Agent(skills.md) ────────┼──→ Run in background │
│ Agent(mcp.md) ───────────┤ (isolated contexts) │
│ Agent(settings.md) ──────┤ │
│ Agent(cli-reference.md) ─┘ │
└─────────────────────────────────────────────────────┘
↓
Wait for notifications as each finishes

Out of the 27 Official Docs Breakdown posts, I first polished 4 reference examples by hand (claude-quickstart, claude-setup, how-claude-code-works, hooks), then launched 23 Subagents in parallel for the remaining 23 posts.


4. Results

4.1 First-Pass Parallel Run (23 Posts)

Status Count Posts
✅ Succeeded on first pass 17 posts sub-agents, skills, mcp, cli-reference, settings, best-practices, desktop-quickstart, github-actions, claude-overview, vs-code, jetbrains, legal-and-compliance, slack, claude-code-on-the-web, third-party-integrations, remote-control, browser-control
❌ Rate-limited (retried in smaller batches) 6 posts troubleshooting, memory, common-workflows, gitlab-ci-cd, features-overview, scheduled-tasks

4.2 Single-Post Output Quality

Taking sub-agents.md as an example:

Metric Target Actual
Code blocks ≥2 6 (YAML, Bash, CLI JSON)
Config examples ≥1 3 (complete subagent configs)
Tables ≥1 3 (file locations, config fields, built-in comparison)
Length ≥1,000 chars ~2,000+ chars

5. Pitfalls Encountered

Pitfall 1: API Rate Limits

Symptom: Launching 20+ Subagents simultaneously triggered HTTP 429 rate-limit errors.

1
API Error: 429 {"error":{"code":"1302","message":"Your account has reached the rate limit"}}

Root cause: Every Subagent makes independent API calls; high concurrency quickly trips account rate limits.

Fix:

  1. Lower concurrency (3–5 Subagents per batch is the sweet spot)
  2. Add a cooldown gap between batches
  3. Or accept partial failures and retry the failed slice afterward

Pitfall 2: Every Subagent Triggers the Stop Hook

Symptom: I had a Stop Hook configured to send Feishu notifications, and got blasted with 20+ alerts at once.

Root cause: Every Subagent triggers the Stop Hook upon completion, with transcript_path pointing to that subagent’s own session transcript.

Impact: The notification payload displayed subagent task prompts like "Rewrite xxx.md" instead of the main session’s user prompt.

Fix:

  • Temporarily disable the Stop Hook before running large parallel batches if you want to avoid notification noise
  • Or treat it as expected behavior

Pitfall 3: No Way to Cancel Running Subagents

Symptom: When I wanted to abort all running Subagents mid-flight, there was no built-in way to recall or cancel background tasks.

Root cause: Once dispatched, background Subagents execute independently until they terminate on their own.

Fix:

  1. Wait for them to finish naturally (rate-limited ones fail fast)
  2. Close the current session (background Subagents do not carry over into a new session)

6. Efficiency Comparison

Approach 27 Posts Notes
Sequential (/clear per post) ~27 sessions Must re-read the template every time; slow turnaround
Parallel Subagents (5 per batch) ~6 sessions Main thread just waits; 4–5x faster overall
Parallel Subagents (20+ at once) 1 session Hits API rate limits and lowers first-pass success rate

Best practice: Run 3–5 posts per batch with a 2–3 minute interval between batches. You get a 3–5x throughput boost without tripping API rate limits.


7. Complete Setup

Bootstrap Commands (Main Thread)

1
2
3
4
5
# Create configuration directories
mkdir -p .claude/agents .claude/templates

# Launch parallel Subagents (recommended: 5 per batch)
# Note: invoke multiple Agent tool calls in a single message
1
2
3
4
5
6
7
8
// Example: launch 5 Subagents concurrently
[
{"tool": "Agent", "description": "Rewrite article1.md", "prompt": "...", "run_in_background": true},
{"tool": "Agent", "description": "Rewrite article2.md", "prompt": "...", "run_in_background": true},
{"tool": "Agent", "description": "Rewrite article3.md", "prompt": "...", "run_in_background": true},
{"tool": "Agent", "description": "Rewrite article4.md", "prompt": "...", "run_in_background": true},
{"tool": "Agent", "description": "Rewrite article5.md", "prompt": "...", "run_in_background": true}
]

8. Summary

When Subagents shine:

  • ✅ Batch-processing similar tasks (such as rewriting a series of articles)
  • ✅ Workloads that benefit from isolated context windows
  • ✅ Tasks that can run completely independently

When to avoid Subagents:

  • ❌ Tasks with tight sequential dependencies
  • ❌ Workflows requiring frequent back-and-forth confirmation
  • ❌ Tight API quotas where parallel calls will trigger rate limits

Bottom line: Trade one session’s wait time for a 3–5x jump in task throughput.



Last updated: 2026-03-25

Series Navigation