From one agent to many
Once you trust Claude on single tasks, the next leap is running several at once: a bug fix, a feature and a test-coverage push, all in parallel. The challenge is isolation. Parallel agents must not edit the same files.
Git worktrees: separate desks, one repo
A git worktree is an extra working directory attached to the same repository, on its own branch. Claude Code has first-class support:
claude --worktree fix-rounding # or: claude -w fix-rounding
claude --worktree feature-export # in another terminal tabEach session gets its own folder and branch, so the two can't collide. Need gitignored files like .env.local in each worktree? List them in a .worktreeinclude file and they're copied in.
Subagents can be isolated the same way with isolation: worktree in their definition.
Background work
- Subagents can run in the background while you keep working in the main thread. Press Ctrl+B to send a running task to the background.
/forkcopies your conversation into a background session that continues on its own.claude agentsshows the background sessions you have running.
/batch: one big change, many workers
For a large, repetitive change (migrating 200 components, updating every API call site), the bundled /batch skill splits the work into independent units and runs them as parallel subagents, each in its own worktree:
/batch migrate every class component in src/components to a function component with hooksFive agents produce five diffs. Make sure each unit has a check (tests, typecheck), and review results before merging. A second session makes an excellent reviewer.
Coordinating many agents
| Approach | What it is |
|---|---|
| Subagents | Claude delegates turn by turn and each returns a summary |
| Agent teams | Multiple Claude instances with shared tasks and messaging |
| Dynamic workflows | A script Claude writes that orchestrates many subagents and returns one result. Good for audits and large migrations. |
| Agent view | Dispatch and monitor many sessions from one screen |
- ⋮⋮Start session one with claude -w feature-a
- ⋮⋮Start session two in another tab with claude -w feature-b
- ⋮⋮Give each session a clear task with its own test command
- ⋮⋮Review each branch's diff, ideally in a fresh session
- ⋮⋮Merge the branches one at a time, running tests after each
Start a Claude Code session in a new worktree named "feature-export"
Check your understanding
What problem do worktrees solve for parallel sessions?
How do you get gitignored files like .env.local into each worktree?
What does /batch do?
Which key sends a running task to the background?