Build with Agent Team
You are coordinating a build using Claude Code Agent Teams. Read the plan document, determine the right team structure, spawn teammates, and orchestrate the build.
Arguments
- Plan path:
$ARGUMENTS[0]- Path to a markdown file describing what to build - Team size:
$ARGUMENTS[1]- Number of agents (optional)
Step 1: Read the Plan
Read the plan document at $ARGUMENTS[0]. Understand:
- What are we building?
- What are the major components/layers?
- What technologies are involved?
- What are the dependencies between components?
Step 2: Determine Team Structure
If team size is specified ($ARGUMENTS[1]), use that number of agents.
If NOT specified, analyze the plan and determine the optimal team size based on:
- Number of independent components (frontend, backend, database, infra, etc.)
- Technology boundaries (different languages/frameworks = different agents)
- Parallelization potential (what can be built simultaneously?)
Guidelines:
- 2 agents: Simple projects with clear frontend/backend split
- 3 agents: Full-stack apps (frontend, backend, database/infra)
- 4 agents: Complex systems with additional concerns (testing, DevOps, docs)
- 5+ agents: Large systems with many independent modules
Step 3: Set Up Agent Team
Enable tmux split panes so each agent is visible. Before spawning, enter Delegate Mode (Shift+Tab) to restrict yourself to coordination only.
Step 4: Contract-First Spawning
CRITICAL: Agents that build in parallel WILL diverge on interfaces unless they agree on contracts FIRST. Enforce a contract-first, build-second protocol.
Spawn Order
- Spawn upstream agents first (e.g., database, then backend)
- Each upstream agent's FIRST task is: define and send their contract
- Lead receives and verifies the contract
- Lead forwards the verified contract to downstream agents
- Only then spawn or unblock downstream agents
Lead as Active Contract Relay
The lead must:
- Receive the contract from the producing agent
- Verify it — check for exact URLs, response shapes, status codes
- Forward it to consuming agents with explicit instructions
Step 5: Facilitate Collaboration
Phase 1: Contracts (Sequential, Lead-Orchestrated)
Phase 2: Implementation (Parallel where safe)
Phase 3: Pre-Completion Contract Verification
Phase 4: Polish (Cross-Review)
Step 6: Validation
Two levels: agent-level (each validates their domain) and lead-level (you validate the integrated system).
Definition of Done
- All agents report their work is done
- Each agent has validated their own domain
- Integration points have been tested
- Cross-review feedback has been addressed
- The plan's acceptance criteria are met
- Lead agent has run end-to-end validation
Execute
- Read and understand the plan
- Determine team size
- Define agent roles, ownership, and validation requirements
- Map the contract chain
- Enter Delegate Mode
- Spawn upstream agents first
- Receive and verify each contract
- Forward verified contracts to downstream agents
- When all agents return, run end-to-end validation
- If validation fails, re-spawn the relevant agent
- Confirm the build meets the plan's requirements
Source: nickyeager/fetchtext — distributed by TomeVault.