AgentSkillsCN

subagent-driven-development

当在当前会话中执行包含独立任务的实施计划时使用。

SKILL.md
--- frontmatter
name: subagent-driven-development
description: Use when executing implementation plans with independent tasks in the current session

Subagent-Driven Development

Adapted from obra/superpowers for Cursor IDE.

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

Core principle: Fresh subagent per task + two-stage review = 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 sequential coupling

vs. Executing Plans (batch mode):

  • 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, note context, create TodoWrite
  2. Per task: a. Dispatch implementer subagent (Task tool, subagent_type: "generalPurpose") b. If subagent asks questions → answer, re-dispatch c. Subagent implements, tests, commits, self-reviews d. Dispatch spec reviewer subagent (Task tool, readonly) e. If spec issues → implementer fixes → re-review f. Dispatch code quality reviewer subagent (Task tool, readonly) g. If quality issues → implementer fixes → re-review h. Mark task complete in TodoWrite
  3. After all tasks — dispatch final code reviewer for entire implementation
  4. Use finishing-a-development-branch skill

Implementer Subagent Prompt Template

When dispatching via Cursor's Task tool:

code
description: "Implement Task N: [task name]"
subagent_type: "generalPurpose"
prompt: |
  You are implementing Task N: [task name]

  ## Task Description
  [FULL TEXT of task from plan - paste it, don't make subagent read file]

  ## Context
  [Scene-setting: where this fits, dependencies, architectural context]

  ## Before You Begin
  If you have questions about requirements, approach, or dependencies — ask now.

  ## Your Job
  1. Implement exactly what the task specifies
  2. Write tests (following TDD)
  3. Verify implementation works
  4. Commit your work
  5. Self-review: completeness, quality, YAGNI, testing
  6. Report back: what you implemented, test results, files changed, concerns

Spec Reviewer Subagent Prompt Template

code
description: "Review spec compliance for Task N"
subagent_type: "generalPurpose"
readonly: true
prompt: |
  You are reviewing whether an implementation matches its specification.

  ## What Was Requested
  [FULL TEXT of task requirements]

  ## What Implementer Claims They Built
  [From implementer's report]

  ## CRITICAL: Do Not Trust the Report
  Verify everything independently by reading actual code.

  Check for:
  - Missing requirements
  - Extra/unneeded work
  - Misunderstandings

  Report: ✅ Spec compliant OR ❌ Issues found with file:line references

Code Quality Reviewer Subagent Prompt Template

Only dispatch after spec compliance passes.

code
description: "Code quality review for Task N"
subagent_type: "generalPurpose"
readonly: true
prompt: |
  Review the code changes for Task N.

  ## What Was Implemented
  [From implementer's report]

  ## Review Criteria
  - Code quality, readability, maintainability
  - Test coverage and quality
  - Error handling
  - Adherence to project patterns
  - SOLID principles

  Categorize issues as: Critical (must fix), Important (should fix), Minor (nice to have)
  Report: Strengths, Issues, Assessment

Red Flags

Never:

  • 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)
  • Start code quality review before spec compliance is ✅
  • Move to next task while either review has open issues

If subagent asks questions: Answer clearly and completely. If reviewer finds issues: Implementer fixes → reviewer reviews again → repeat until approved. If subagent fails task: Dispatch fix subagent with specific instructions.