Mass JS to TS Migration
200 JavaScript files converted to TypeScript with full type annotations. One agent per file, all running in parallel. Types inferred from usage patterns, imports rewritten, tests updated.
Stop running tasks one by one. Spawn a swarm of agents, each tackling a piece of the problem simultaneously. Orchestrate, fan out, collect results. This is how you scale intelligence.
Three orchestration patterns. Each with different tradeoffs in control, context sharing, and scale.
Click each pattern to expand. Every pattern includes a flow visualization, example, and code you can use today.
An orchestrator dispatches work to N agents. Each runs independently, returns results to the center.
Built-in swarm orchestration. One command decomposes, plans, spawns, and manages parallel agents for you.
/batch migrate all React class components to functional in src/Automatically scans the codebase and identifies all units of work (files, components, modules)
Presents the full plan for your approval: which files, what changes, estimated scope per unit
One agent per unit, each in its own worktree. No conflicts, no merge issues, full isolation
All agents run in parallel. Each makes its changes, runs tests, validates output independently
Each agent opens a PR. 20 PRs in parallel, clean diffs, ready for your review. You just approve.
# What /batch does under the hood:
# 1. Scan and decompose
files=$(find src/ -name "*.tsx" -exec grep -l "extends React.Component" {} \;)
# 2. Present plan (you approve)
# "Found 20 class components. Migrate each to functional + hooks."
# [approve / modify / cancel]
# 3. Spawn agents in isolated worktrees
for f in $files; do
# Each agent gets its own git worktree
git worktree add "/tmp/batch-$(basename $f)" -b "batch/migrate-$(basename $f)"
claude --worktree "/tmp/batch-$(basename $f)" \
"Convert $f from class component to functional.
Replace lifecycle methods with hooks.
Run tests. Open PR when done." &
done
wait
# Result: 20 PRs ready for reviewSelect your task, scale, and output format. Get an orchestrator prompt you can copy and run.
#!/bin/bash
# Swarm: Code Migration
# Scale: 5-10 agents | Output: json
MAX_PARALLEL=10
count=0
# Discover items
find src/ -name "*.{ext}" -type f
for item in $items; do
claude "Migrate {file} from {from} to {to}.
Preserve all functionality. Run tests after migration.
Return: {status: "success"|"failed", changes: number, errors: []}" \
--output "results/{name}.json" &
count=$((count + 1))
if [ $((count % MAX_PARALLEL)) -eq 0 ]; then
wait
fi
done
wait
echo "Swarm complete: $count items processed"
# Reduce phase: merge all results
claude "Read all results in results/ directory.
Merge into a single summary report.
Highlight: top issues, patterns, recommendations."Patterns that have been deployed in production. Real numbers, real workflows.
200 JavaScript files converted to TypeScript with full type annotations. One agent per file, all running in parallel. Types inferred from usage patterns, imports rewritten, tests updated.
One agent per competitor. Each researches pricing, features, positioning, reviews, tech stack. All results merged into a single comparison matrix with scoring and recommendations.
Marketing copy translated into 10 languages simultaneously. Each agent is prompted with language-specific cultural context and terminology. Native-quality output, not machine translation.
One agent per client reads their project folder, communication log, and progress file. Generates a formatted weekly report with blockers, wins, and next actions. 12 reports at once.
Compare swarm cost vs sequential. Swarms cost the same in tokens but save massive time.
5 questions. Test your understanding of agent swarm patterns.