Skip to main content

Summary

Launching 3 Claude Code agents in parallel with isolation: "worktree" generated 320 new tests across 3 packages (CRDT, n8n-exporter, IR) in ~4 minutes. The key enabler: giving each agent the COMPLETE source code of every file it needs to test, not summaries.

The Pattern

Agent 1 (worktree): CRDT package     → 10 test files → 128 new tests
Agent 2 (worktree): n8n-exporter     → 4 test files  → 166 new tests  
Agent 3 (worktree): IR package       → 1 test file   → 26 new tests
Total wall-clock time: ~4 minutes (agents run concurrently).

What Makes It Work

  1. Complete source context: Each agent prompt included “Read ALL source files in packages/X/src/ — I need to understand every function, export, and type.” Agents that receive summaries write shallow tests; agents that see exact signatures write precise assertions.
  2. Existing test pattern: Including the existing test file shows the agent the project’s test conventions (vitest, describe/it, factory functions, temp directories).
  3. Worktree isolation: isolation: "worktree" gives each agent a git worktree so they don’t conflict. Files written by agents persist in the main repo.
  4. Independence: The 3 packages have no test-time dependencies on each other, so parallel execution is safe.

Anti-Pattern: Summarized Prompts

If you tell an agent “write tests for the CRDT package” without providing source code, it will:
  • Guess at function signatures
  • Miss edge cases in type handling
  • Write tests for functions that don’t exist
  • Use wrong import paths

Business Impact

Manual test writing for 320 tests across 10+ source files would take 2-3 days. Parallel agents compressed this to 4 minutes with 100% pass rate on first run.