/execute-plan
/execute-plan
Section titled “/execute-plan”Execute a detailed implementation plan using fresh subagents per task with mandatory code review gates between tasks.
Purpose
Section titled “Purpose”The /execute-plan command automates plan execution while maintaining high quality through systematic code reviews. It spawns fresh subagents for each task, preventing context pollution and ensuring focused implementation.
/execute-plan [plan-file-path]Arguments
Section titled “Arguments”- plan-file-path: Path to the plan file (created with
/plan --detailed)
Core Pattern
Section titled “Core Pattern”“Fresh subagent per task + review between tasks = high quality, fast iteration”
Why Fresh Agents?
Section titled “Why Fresh Agents?”- Prevents context pollution between tasks
- Each task gets focused attention
- Failures don’t cascade to other tasks
- Easier to retry individual tasks
Why Code Review Between Tasks?
Section titled “Why Code Review Between Tasks?”- Catches issues early before they compound
- Ensures code matches intent
- Prevents technical debt accumulation
- Creates natural checkpoints for rollback
How It Works
Section titled “How It Works”Step 1: Load Plan
Section titled “Step 1: Load Plan”- Reads the plan file
- Verifies plan is complete and approved
- Creates TodoWrite tracking with all tasks
- Sets first task to
in_progress
Step 2: Execute Task (For Each Task)
Section titled “Step 2: Execute Task (For Each Task)”For each task in the plan:
- Dispatch fresh subagent with task details
- Subagent implements following TDD cycle:
- Write failing test
- Verify test fails
- Implement minimally
- Verify test passes
- Commit changes
- Subagent returns completion summary
Step 3: Code Review
Section titled “Step 3: Code Review”After each task completes:
- Dispatch code-reviewer subagent
- Review scope: only changes from current task
- Reviewer returns findings categorized as:
- Critical: Must fix before proceeding
- Important: Should fix before proceeding
- Minor: Can fix later
Step 4: Handle Review Findings
Section titled “Step 4: Handle Review Findings”IF Critical or Important issues found: 1. Dispatch fix subagent for each issue 2. Re-request code review 3. Repeat until no Critical/Important issues
IF only Minor issues: 1. Note for later cleanup 2. Proceed to next taskStep 5: Mark Complete
Section titled “Step 5: Mark Complete”- Update TodoWrite - mark task completed
- Move to next task
- Repeat from Step 2
Step 6: Final Review
Section titled “Step 6: Final Review”After all tasks complete:
- Dispatch comprehensive code review
- Review entire implementation against plan
- Verify all success criteria met
- Run full test suite
- Use
finishing-development-branchskill
Critical Rules
Section titled “Critical Rules”Never Skip Code Reviews
Section titled “Never Skip Code Reviews”Every single task must be reviewed before proceeding. No exceptions.
Never Proceed with Critical Issues
Section titled “Never Proceed with Critical Issues”Critical issues must be fixed immediately:
implement → review → fix critical → re-review → proceedNever Run Parallel Implementation
Section titled “Never Run Parallel Implementation”Tasks run sequentially, one at a time:
WRONG: Run Task 1, 2, 3 simultaneouslyRIGHT: Task 1 → Review → Task 2 → Review → Task 3 → ReviewAlways Read Plan Before Implementing
Section titled “Always Read Plan Before Implementing”WRONG: Start coding based on memory of planRIGHT: Read plan file, extract task details, then implementError Handling
Section titled “Error Handling”When a Task Fails
Section titled “When a Task Fails”- Capture error details
- Attempt fix (max 2 retries)
- If still failing:
- Pause execution
- Report to user with:
- Which task failed
- Error details
- Suggested resolution
- Wait for user decision
When Review Finds Major Issues
Section titled “When Review Finds Major Issues”- List all Critical/Important issues
- Dispatch fix subagent for each
- Re-run code review
- If issues persist after 2 cycles:
- Pause execution
- Report to user
- May need plan revision
Output
Section titled “Output”Progress Updates
Section titled “Progress Updates”During execution, you see real-time progress:
## Execution Progress
### Task 1: Create User model ✓- Files modified: src/models/user.ts- Tests added: 3- Review: Passed
### Task 2: Add validation ✓- Files modified: src/models/user.ts- Tests added: 2- Review: Passed (1 minor deferred)
### Task 3: Create endpoint [IN PROGRESS]- Status: Implementing...Completion Summary
Section titled “Completion Summary”When execution completes:
## Execution Complete
### Summary- Tasks completed: 8/8- Tests added: 24- Coverage: 92%
### Files Created- src/models/user.ts- src/services/user-service.ts- src/routes/user.ts
### Files Modified- src/routes/index.ts- src/types/index.ts
### Deferred Items- Minor: Variable rename in user-service.ts line 12
### Next Steps- Run full test suite- Use /ship to create PRPrerequisites
Section titled “Prerequisites”Before using this command:
- Plan file exists and is complete
- Plan was created with
/plan --detailed - Plan has been reviewed and approved
- Tests can be run (
npm testorpytestworks)
Examples
Section titled “Examples”Execute a Saved Plan
Section titled “Execute a Saved Plan”/execute-plan plans/user-authentication.mdExecutes the detailed plan from the specified file.
After Creating a Plan
Section titled “After Creating a Plan”# Step 1: Create detailed plan/plan --detailed --save=plans/oauth.md "implement OAuth2 authentication"
# Step 2: Execute the plan/execute-plan plans/oauth.mdComplete workflow from planning to automated execution.
Resume After Pause
Section titled “Resume After Pause”If execution pauses due to an error:
# Fix the issue manually, then resume/execute-plan --resume plans/oauth.mdResumes from the last completed task.
Best Practices
Section titled “Best Practices”Before Execution
Section titled “Before Execution”- Review the plan - Make sure it’s accurate
- Check environment - Tests run, dependencies installed
- Clean working directory - Commit or stash changes
- Set aside time - Don’t interrupt during execution
During Execution
Section titled “During Execution”- Monitor progress - Watch for warnings or issues
- Don’t interrupt - Let tasks complete
- Review deferred items - Note minor issues for cleanup
After Execution
Section titled “After Execution”- Run full test suite - Verify everything works
- Review deferred issues - Fix minor items
- Manual testing - Test critical paths
- Create PR - Use
/shipcommand
Workflow Integration
Section titled “Workflow Integration”Complete Feature Development Flow
Section titled “Complete Feature Development Flow”# 1. Brainstorm design/brainstorm "user authentication system"
# 2. Create detailed plan/plan --detailed --save=plans/auth.md "implement authentication from design"
# 3. Execute plan with automation/execute-plan plans/auth.md
# 4. Ship to production/ship "feat: add user authentication system"Plan Review Flow
Section titled “Plan Review Flow”# 1. Create plan/plan --detailed --save=plans/feature.md "feature description"
# 2. Review plan with team/review plans/feature.md
# 3. Execute reviewed plan/execute-plan plans/feature.mdTroubleshooting
Section titled “Troubleshooting””Plan file not found”
Section titled “”Plan file not found””- Check the file path is correct
- Use absolute paths or paths relative to repo root
”Plan not detailed enough”
Section titled “”Plan not detailed enough””- Plan must be created with
--detailedflag - Regular plans need manual execution
”Tests failing during execution”
Section titled “”Tests failing during execution””- Check test environment is set up correctly
- Verify dependencies are installed
- May need to fix plan or environment
”Code review keeps failing”
Section titled “”Code review keeps failing””- Review the critical issues being reported
- May need to revise the plan
- Consider pausing and fixing manually
Related Commands
Section titled “Related Commands”- /plan - Create detailed plans for execution
- /brainstorm - Design features before planning
- /ship - Create PR after execution
- /review - Review code or plans
Customization
Section titled “Customization”Execution behavior can be customized via CLAUDE.md:
- Review strictness levels
- Retry counts for failures
- Parallel task limits
- TDD enforcement
See the Configuration Guide for details.