SKILL.md
SKILL.mdBrowse 3 files
2,430 tokens
10,699 bytes
Token encoding: o200k_base
Snapshot 24fd22b
1---2name: subagent-driven-development3description: "Execute plans via delegate_task subagents (2-stage review)."4version: 1.1.05author: Hermes Agent (adapted from obra/superpowers)6license: MIT7platforms: [linux, macos, windows]8metadata:9 hermes:10 tags: [delegation, subagent, implementation, workflow, parallel]11 related_skills: [requesting-code-review, test-driven-development]12---13 14# Subagent-Driven Development15 16## Overview17 18Execute implementation plans by dispatching fresh subagents per task with systematic two-stage review.19 20**Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration.21 22## When to Use23 24Use this skill when:25- You have an implementation plan (from the `plan` skill or user requirements)26- Tasks are mostly independent27- Quality and spec compliance are important28- You want automated review between tasks29 30**vs. manual execution:**31- Fresh context per task (no confusion from accumulated state)32- Automated review process catches issues early33- Consistent quality checks across all tasks34- Subagents can ask questions before starting work35 36## The Process37 38### 1. Read and Parse Plan39 40Read the plan file. Extract ALL tasks with their full text and context upfront. Create a todo list:41 42```python43# Read the plan44read_file("docs/plans/feature-plan.md")45 46# Create todo list with all tasks47todo([48 {"id": "task-1", "content": "Create User model with email field", "status": "pending"},49 {"id": "task-2", "content": "Add password hashing utility", "status": "pending"},50 {"id": "task-3", "content": "Create login endpoint", "status": "pending"},51])52```53 54**Key:** Read the plan ONCE. Extract everything. Don't make subagents read the plan file — provide the full task text directly in context.55 56### 2. Per-Task Workflow57 58For EACH task in the plan:59 60#### Step 1: Dispatch Implementer Subagent61 62Use `delegate_task` with complete context:63 64```python65delegate_task(66 goal="Implement Task 1: Create User model with email and password_hash fields",67 context="""68 TASK FROM PLAN:69 - Create: src/models/user.py70 - Add User class with email (str) and password_hash (str) fields71 - Use bcrypt for password hashing72 - Include __repr__ for debugging73 74 FOLLOW TDD:75 1. Write failing test in tests/models/test_user.py76 2. Run: pytest tests/models/test_user.py -v (verify FAIL)77 3. Write minimal implementation78 4. Run: pytest tests/models/test_user.py -v (verify PASS)79 5. Run: pytest tests/ -q (verify no regressions)80 6. Commit: git add -A && git commit -m "feat: add User model with password hashing"81 82 PROJECT CONTEXT:83 - Python 3.11, Flask app in src/app.py84 - Existing models in src/models/85 - Tests use pytest, run from project root86 - bcrypt already in requirements.txt87 """,88 toolsets=['terminal', 'file']89)90```91 92#### Step 2: Dispatch Spec Compliance Reviewer93 94After the implementer completes, verify against the original spec:95 96```python97delegate_task(98 goal="Review if implementation matches the spec from the plan",99 context="""100 ORIGINAL TASK SPEC:101 - Create src/models/user.py with User class102 - Fields: email (str), password_hash (str)103 - Use bcrypt for password hashing104 - Include __repr__105 106 CHECK:107 - [ ] All requirements from spec implemented?108 - [ ] File paths match spec?109 - [ ] Function signatures match spec?110 - [ ] Behavior matches expected?111 - [ ] Nothing extra added (no scope creep)?112 113 OUTPUT: PASS or list of specific spec gaps to fix.114 """,115 toolsets=['file']116)117```118 119**If spec issues found:** Fix gaps, then re-run spec review. Continue only when spec-compliant.120 121#### Step 3: Dispatch Code Quality Reviewer122 123After spec compliance passes:124 125```python126delegate_task(127 goal="Review code quality for Task 1 implementation",128 context="""129 FILES TO REVIEW:130 - src/models/user.py131 - tests/models/test_user.py132 133 CHECK:134 - [ ] Follows project conventions and style?135 - [ ] Proper error handling?136 - [ ] Clear variable/function names?137 - [ ] Adequate test coverage?138 - [ ] No obvious bugs or missed edge cases?139 - [ ] No security issues?140 141 OUTPUT FORMAT:142 - Critical Issues: [must fix before proceeding]143 - Important Issues: [should fix]144 - Minor Issues: [optional]145 - Verdict: APPROVED or REQUEST_CHANGES146 """,147 toolsets=['file']148)149```150 151**If quality issues found:** Fix issues, re-review. Continue only when approved.152 153#### Step 4: Mark Complete154 155```python156todo([{"id": "task-1", "content": "Create User model with email field", "status": "completed"}], merge=True)157```158 159### 3. Final Review160 161After ALL tasks are complete, dispatch a final integration reviewer:162 163```python164delegate_task(165 goal="Review the entire implementation for consistency and integration issues",166 context="""167 All tasks from the plan are complete. Review the full implementation:168 - Do all components work together?169 - Any inconsistencies between tasks?170 - All tests passing?171 - Ready for merge?172 """,173 toolsets=['terminal', 'file']174)175```176 177### 4. Verify and Commit178 179```bash180# Run full test suite181pytest tests/ -q182 183# Review all changes184git diff --stat185 186# Final commit if needed187git add -A && git commit -m "feat: complete [feature name] implementation"188```189 190## Task Granularity191 192**Each task = 2-5 minutes of focused work.**193 194**Too big:**195- "Implement user authentication system"196 197**Right size:**198- "Create User model with email and password fields"199- "Add password hashing function"200- "Create login endpoint"201- "Add JWT token generation"202- "Create registration endpoint"203 204## Red Flags — Never Do These205 206- Start implementation without a plan207- Skip reviews (spec compliance OR code quality)208- Proceed with unfixed critical/important issues209- Dispatch multiple implementation subagents for tasks that touch the same files210- Make subagent read the plan file (provide full text in context instead)211- Skip scene-setting context (subagent needs to understand where the task fits)212- Ignore subagent questions (answer before letting them proceed)213- Accept "close enough" on spec compliance214- Skip review loops (reviewer found issues → implementer fixes → review again)215- Let implementer self-review replace actual review (both are needed)216- **Start code quality review before spec compliance is PASS** (wrong order)217- Move to next task while either review has open issues218 219## Handling Issues220 221### If Subagent Asks Questions222 223- Answer clearly and completely224- Provide additional context if needed225- Don't rush them into implementation226 227### If Reviewer Finds Issues228 229- Implementer subagent (or a new one) fixes them230- Reviewer reviews again231- Repeat until approved232- Don't skip the re-review233 234### If Subagent Fails a Task235 236- Dispatch a new fix subagent with specific instructions about what went wrong237- Don't try to fix manually in the controller session (context pollution)238 239## Efficiency Notes240 241**Why fresh subagent per task:**242- Prevents context pollution from accumulated state243- Each subagent gets clean, focused context244- No confusion from prior tasks' code or reasoning245 246**Why two-stage review:**247- Spec review catches under/over-building early248- Quality review ensures the implementation is well-built249- Catches issues before they compound across tasks250 251**Cost trade-off:**252- More subagent invocations (implementer + 2 reviewers per task)253- But catches issues early (cheaper than debugging compounded problems later)254 255## Integration with Other Skills256 257### With plan258 259This skill EXECUTES plans created by the `plan` skill:2601. User requirements → plan → implementation plan2612. Implementation plan → subagent-driven-development → working code262 263### With test-driven-development264 265Implementer subagents should follow TDD:2661. Write failing test first2672. Implement minimal code2683. Verify test passes2694. Commit270 271Include TDD instructions in every implementer context.272 273### With requesting-code-review274 275The two-stage review process IS the code review. For final integration review, use the requesting-code-review skill's review dimensions.276 277### With systematic-debugging278 279If a subagent encounters bugs during implementation:2801. Follow systematic-debugging process2812. Find root cause before fixing2823. Write regression test2834. Resume implementation284 285## Example Workflow286 287```288[Read plan: docs/plans/auth-feature.md]289[Create todo list with 5 tasks]290 291--- Task 1: Create User model ---292[Dispatch implementer subagent]293 Implementer: "Should email be unique?"294 You: "Yes, email must be unique"295 Implementer: Implemented, 3/3 tests passing, committed.296 297[Dispatch spec reviewer]298 Spec reviewer: ✅ PASS — all requirements met299 300[Dispatch quality reviewer]301 Quality reviewer: ✅ APPROVED — clean code, good tests302 303[Mark Task 1 complete]304 305--- Task 2: Password hashing ---306[Dispatch implementer subagent]307 Implementer: No questions, implemented, 5/5 tests passing.308 309[Dispatch spec reviewer]310 Spec reviewer: ❌ Missing: password strength validation (spec says "min 8 chars")311 312[Implementer fixes]313 Implementer: Added validation, 7/7 tests passing.314 315[Dispatch spec reviewer again]316 Spec reviewer: ✅ PASS317 318[Dispatch quality reviewer]319 Quality reviewer: Important: Magic number 8, extract to constant320 Implementer: Extracted MIN_PASSWORD_LENGTH constant321 Quality reviewer: ✅ APPROVED322 323[Mark Task 2 complete]324 325... (continue for all tasks)326 327[After all tasks: dispatch final integration reviewer]328[Run full test suite: all passing]329[Done!]330```331 332## Remember333 334```335Fresh subagent per task336Two-stage review every time337Spec compliance FIRST338Code quality SECOND339Never skip reviews340Catch issues early341```342 343**Quality is not an accident. It's the result of systematic process.**344 345## Further reading (load when relevant)346 347When the orchestration involves significant context usage, long review loops, or complex validation checkpoints, load these references for the specific discipline:348 349- **`references/context-budget-discipline.md`** — Four-tier context degradation model (PEAK / GOOD / DEGRADING / POOR), read-depth rules that scale with context window size, and early warning signs of silent degradation. Load when a run will clearly consume significant context (multi-phase plans, many subagents, large artifacts).350- **`references/gates-taxonomy.md`** — The four canonical gate types (Pre-flight, Revision, Escalation, Abort) with behavior, recovery, and examples. Load when designing or reviewing any workflow that has validation checkpoints — use the vocabulary explicitly so each gate has defined entry, failure behavior, and resumption rules.351 352Both references adapted from gsd-build/get-shit-done (MIT © 2025 Lex Christopherson).353 Discovery context
Discovered by repository scan. No exact path reference found in the snapshot’s root AGENTS.md.