✻Founding-member pricing: every lesson for $19/mo. The first 3 lessons are free. Start lesson 1 →
Unit 5 · Subagents & Parallel Work · Lesson 25 of 40

Parallel Work: Worktrees, Background Agents & /batch

Scale Claude Code with parallel work: git worktrees, background subagents, background sessions, /batch for large changes and agent teams.

ACADEMY11 min+72 XP4-question quiz

🎯 By the end of this lesson you'll be able to

  • Run isolated parallel sessions with worktrees
  • Send work to the background and check on it
  • Split large changes with /batch
  • Know the options for coordinating many agents

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:

bash
claude --worktree fix-rounding     # or: claude -w fix-rounding
claude --worktree feature-export   # in another terminal tab

Each 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.
  • /fork copies your conversation into a background session that continues on its own.
  • claude agents shows 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:

text
/batch migrate every class component in src/components to a function component with hooks
!
Parallel means more review

Five 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

ApproachWhat it is
SubagentsClaude delegates turn by turn and each returns a summary
Agent teamsMultiple Claude instances with shared tasks and messaging
Dynamic workflowsA script Claude writes that orchestrates many subagents and returns one result. Good for audits and large migrations.
Agent viewDispatch and monitor many sessions from one screen
⇅Run two features in parallel safelydrag or use arrows
  1. ⋮⋮Start session one with claude -w feature-a
  2. ⋮⋮Start session two in another tab with claude -w feature-b
  3. ⋮⋮Give each session a clear task with its own test command
  4. ⋮⋮Review each branch's diff, ideally in a fresh session
  5. ⋮⋮Merge the branches one at a time, running tests after each
⌨Type the command+15 XP

Start a Claude Code session in a new worktree named "feature-export"

❯

Check your understanding

?Lesson quiz10 XP per correct answer · +25 for a perfect score
QUESTION 1 OF 4

What problem do worktrees solve for parallel sessions?

Why: Each worktree has its own files and branch, so sessions can't collide.
QUESTION 2 OF 4

How do you get gitignored files like .env.local into each worktree?

Why: .worktreeinclude lists files to copy into new worktrees.
QUESTION 3 OF 4

What does /batch do?

Why: /batch fans out a big change across isolated parallel workers.
QUESTION 4 OF 4

Which key sends a running task to the background?

Why: Ctrl+B backgrounds running tasks.
0 / 4 correct
Academy lesson

Unlock lesson 25 and the next 15

You've finished the free lessons. Join the Academy for $19/month to unlock every lesson, quiz, terminal simulation and puzzle, plus the final exam and your certificate of completion.

  • All 40 lessons across 9 units
  • 165+ quiz questions
  • Final exam + certificate
  • New lessons as Claude Code evolves
  • XP, streaks and badges
  • Cancel anytime

Already a member? Log in to continue.

Key takeaways

  • Worktrees give parallel sessions isolated files and branches.
  • Use background subagents, /fork and claude agents to multitask.
  • /batch splits big repetitive changes across parallel workers.
  • More parallelism means more review. Every unit needs a check.

Nice work. Lesson 25 done?

Mark it complete to earn +72 XP, keep your streak alive and unlock badges.

Written by Curtis Cornell from Anthropic's public Claude Code documentation. Last reviewed November 14, 2026. Claude Code changes fast; if something here differs from your version, the official docs win.

Start lesson 1 free →