---
name: sr-subagent-driven-development
description: Use when executing implementation plans with independent tasks in the current session
---

# Subagent-Driven Development

Execute plan by dispatching fresh subagent per task, with two-stage review after each: spec compliance review first, then code quality review.

**Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration

## When to Use

- Have an implementation plan with mostly independent tasks
- Want to stay in the current session
- Tasks don't have tight coupling requiring shared state

**vs. Executing Plans (parallel session):**
- Same session (no context switch)
- Fresh subagent per task (no context pollution)
- Two-stage review after each task
- Faster iteration (no human-in-loop between tasks)

## The Process

1. **Read plan, extract all tasks with full text, create todo list**
2. **Per task:**
   - Dispatch implementer subagent (see implementer-prompt.md)
   - If subagent asks questions, answer them before proceeding
   - Subagent implements, tests, commits, self-reviews
   - Dispatch spec reviewer subagent (see spec-reviewer-prompt.md)
   - If spec issues found, implementer fixes, re-review
   - Dispatch code quality reviewer subagent (see code-quality-reviewer-prompt.md)
   - If quality issues found, implementer fixes, re-review
   - Mark task complete
3. **After all tasks:** Dispatch final code reviewer for entire implementation
4. **Use sr-finishing-a-development-branch skill**

## Prompt Templates

- `./implementer-prompt.md` - Dispatch implementer subagent
- `./spec-reviewer-prompt.md` - Dispatch spec compliance reviewer subagent
- `./code-quality-reviewer-prompt.md` - Dispatch code quality reviewer subagent

## Red Flags

**Never:**
- Start implementation on main/master branch without explicit user consent
- Skip reviews (spec compliance OR code quality)
- Proceed with unfixed issues
- Dispatch multiple implementation subagents in parallel (conflicts)
- Make subagent read plan file (provide full text instead)
- Skip scene-setting context
- Ignore subagent questions
- Accept "close enough" on spec compliance
- **Start code quality review before spec compliance is approved**
- Move to next task while either review has open issues

**If subagent asks questions:**
- Answer clearly and completely
- Don't rush them into implementation

**If reviewer finds issues:**
- Implementer fixes them
- Reviewer reviews again
- Repeat until approved

**If subagent fails task:**
- Dispatch fix subagent with specific instructions
- Don't try to fix manually (context pollution)

## Related Skills

- **sr-writing-plans**: Creates the plan this skill executes
- **sr-using-git-worktrees**: Set up isolated workspace before starting (required)
- **sr-requesting-code-review**: Code review template for reviewer subagents
- **sr-finishing-a-development-branch**: Complete development after all tasks
- **sr-test-driven-development**: Subagents follow TDD for each task
- **sr-executing-plans**: Alternative workflow for parallel session execution
