## Summary This PR **reverses** the earlier template consolidation and restores **3-phase separation** (SPEC → TEST → IMPL as separate tickets) as the **primary and default pattern** for service implementation. ## Context After comprehensive analysis following user feedback, the earlier consolidation of templates contradicted: - **ADR-002**: Architecture document explicitly chose 3-phase separation - **Agent execution model**: Designed for phase checkpoints and recovery - **Platform workflows**: GitHub project boards work better with granular tickets ## Changes ### 1. Restored 3-Phase Templates (24 total) - ✅ **WB-SPEC/TEST/IMPL.md** - Restored from git history (commit 90528a7) - ✅ **INFRA-SPEC/TEST/IMPL.md** - Split from INFRA.md - ✅ **API-SPEC/TEST/IMPL.md** - Split from API.md - ✅ **DB-SPEC/TEST/IMPL.md** - Split from DB.md - ✅ **STATE-SPEC/TEST/IMPL.md** - Split from STATE.md - ✅ **MODEL-SPEC/TEST/IMPL.md** - Split from MODEL.md - ✅ **EVENT-SPEC/TEST/IMPL.md** - Split from EVENT.md - ✅ **OBS-SPEC/TEST/IMPL.md** - Split from OBS.md ### 2. Moved Consolidated Templates to quick/ (Optional) - Moved 8 consolidated templates to `docs/templates/quick/` - Created `quick/README.md` with usage guidance - Quick templates remain available for features < 4 hours ### 3. Created Comprehensive Documentation - **docs/templates/README.md** - Template selection guide with decision flow - Decision criteria: **4-hour rule** (> 4 hours → 3-phase, < 4 hours → quick) - Expected usage: **80% 3-phase, 20% quick** ### 4. Updated Core Documentation - **SERVICE_IMPLEMENTATION_TEMPLATE.md**: Added template selection section, updated all examples to use 3-phase naming - **agent-execution-model.md**: Added template selection logic for autonomous agents ## Rationale ### Why 3-Phase is Better for 80% of Features **Benefits:** - ✅ **Checkpoints**: Each phase closure = recovery point for agents - ✅ **Recovery**: Agents can resume from last closed ticket - ✅ **Progress Tracking**: Clear visibility into development phase - ✅ **Approval Gates**: Enforced at phase boundaries - ✅ **Parallel Work**: SPEC for Feature B while IMPL for Feature A - ✅ **GitHub Integration**: Better project board granularity - ✅ **Team Coordination**: Clear handoffs between specialists **3-Phase SHOULD BE USED when:** - Feature > 4 hours total - Multiple people involved (architect, QA, developer) - Approval gates required between phases - Part of larger epic with dependencies - Autonomous agent execution (needs checkpoints) - Production-critical features ### When Quick Templates Should Be Used (20% of cases) **Quick templates remain available for:** - ✅ Features < 4 hours total - ✅ Single developer ownership - ✅ Low-risk changes (internal tools, config) - ✅ Experimental/proof-of-concept work - ✅ Obvious solutions with no unknowns ## Template Structure ``` docs/templates/ ├── README.md # Template selection guide ├── SERVICE_IMPLEMENTATION_TEMPLATE.md # Master template (3-phase) │ ├── INFRA-SPEC.md, INFRA-TEST.md, INFRA-IMPL.md ├── API-SPEC.md, API-TEST.md, API-IMPL.md ├── DB-SPEC.md, DB-TEST.md, DB-IMPL.md ├── WB-SPEC.md, WB-TEST.md, WB-IMPL.md ├── STATE-SPEC.md, STATE-TEST.md, STATE-IMPL.md ├── MODEL-SPEC.md, MODEL-TEST.md, MODEL-IMPL.md ├── EVENT-SPEC.md, EVENT-TEST.md, EVENT-IMPL.md ├── OBS-SPEC.md, OBS-TEST.md, OBS-IMPL.md │ └── quick/ # Optional consolidated templates ├── README.md # When to use quick templates ├── API.md, DB.md, INFRA.md, WB.md └── STATE.md, MODEL.md, EVENT.md, OBS.md ``` ## Architecture Alignment This change aligns with: - ✅ **ADR-002**: Explicit architectural choice of 3-phase separation - ✅ **Agent Execution Model**: Designed for phase checkpoints and recovery - ✅ **Platform Workflows**: Better GitHub project board integration - ✅ **Quality Gates**: Easier to enforce with separate tickets ## Decision Logic for Agents ```python def select_template(feature): if feature.estimated_hours >= 4: return "3-phase" # Default for most features if feature.multiple_people or feature.production_critical: return "3-phase" # Needs checkpoints and gates # Only for truly simple work if (feature.estimated_hours < 4 and feature.single_developer and feature.low_risk): return "quick" # When in doubt, use 3-phase return "3-phase" ``` ## Statistics - **24 three-phase templates** (8 categories × 3 phases) - **8 quick templates** (optional, in quick/ subdirectory) - **Expected usage**: 80% 3-phase, 20% quick - **Default**: When in doubt, use 3-phase templates ## Testing - ✅ All template files created and validated - ✅ README files provide clear guidance - ✅ SERVICE_IMPLEMENTATION_TEMPLATE.md updated with examples - ✅ agent-execution-model.md includes selection logic - ✅ Quick templates moved to subdirectory with warnings ## Related Issues Addresses feedback from user questioning whether "1 ticket per category instead of 3" is always best. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude