CClaude Code Catalog
All Patterns

Parallel Task Execution

WorkflowAdvanced

When facing a large-scale task like migrating 50 files or adding tests to 20 modules, sequential execution wastes time. This pattern decomposes the work into independent units, launches parallel Claude Code processes via tmux or background jobs, and collects results. Includes strategies for dependency detection, conflict avoidance, and progress monitoring.

parallelconcurrencytmuxperformancebatch

Pattern Code

# Parallel Task Execution Pattern ## Step 1: Decompose the task ```bash # Generate a task manifest claude -p "List all React class components in src/ that need converting to functional components. Output as JSON: [{file, component, complexity}]" > tasks.json ``` ## Step 2: Partition into independent batches ```bash # Split tasks into N batches (no cross-dependencies) cat tasks.json | jq -c '[.[] | select(.complexity != "high")]' \ | jq -c '_nwise(5)' > batches.jsonl ``` ## Step 3: Launch parallel agents ```bash #!/bin/bash # parallel-convert.sh SESSION="parallel-convert" tmux new-session -d -s $SESSION BATCH_NUM=0 while IFS= read -r batch; do if [ $BATCH_NUM -gt 0 ]; then tmux split-window -t $SESSION tmux select-layout -t $SESSION tiled fi tmux send-keys -t $SESSION.$BATCH_NUM \ "claude -p 'Convert these class components to functional: $batch Rules: use hooks, preserve prop types, keep test files passing'" Enter ((BATCH_NUM++)) done < batches.jsonl ``` ## Step 4: Monitor and collect results ```bash # Wait for all agents and verify while tmux list-panes -t parallel-convert -F '#{pane_dead}' | grep -q 0; do sleep 5 done echo "All agents complete" git diff --stat npm test ```

Copy this pattern into your project configuration to implement.

Terminal Preview

Parallel Task Execution

About Parallel Task Execution

Claude Code patterns are proven architectural designs and workflow structures that help you tackle complex development scenarios. Parallel Task Execution is a Workflow pattern at the Advanced level that provides a tested, repeatable approach you can adapt to your projects for more efficient and consistent results.

Related Patterns