|
| 1 | +# {{ name }} Specifications |
| 2 | + |
| 3 | +> **Spec-Driven Development**: Define specifications first, then implement. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 📋 Directory Structure |
| 8 | + |
| 9 | +``` |
| 10 | +specs/ |
| 11 | +├── 001-domain-spec/ ← Feature 1: Domain Specification (Primary) |
| 12 | +│ ├── spec.md ← Domain protocol/rules/standards |
| 13 | +│ └── checklists/ ← Quality checks (optional) |
| 14 | +│ |
| 15 | +├── 002-toolkit-spec/ ← Feature 2: Toolkit Specification (Secondary) |
| 16 | +│ ├── spec.md ← Toolkit specification |
| 17 | +│ ├── plan.md ← Technical architecture (generated) |
| 18 | +│ ├── tasks.md ← Development tasks (generated) |
| 19 | +│ └── checklists/ ← Quality checks (optional) |
| 20 | +│ |
| 21 | +└── README.md ← This file |
| 22 | +``` |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 🏗️ Two-Feature Architecture (Recommended) |
| 27 | + |
| 28 | +**IMPORTANT**: Separate domain specification from toolkit implementation. |
| 29 | + |
| 30 | +### Feature 1: Domain Specification (Primary) |
| 31 | +**Purpose**: Define the domain protocol, rules, and standards |
| 32 | + |
| 33 | +**Example**: `specs/001-{{ domain }}-protocol-spec/spec.md` |
| 34 | +- What is the domain protocol? |
| 35 | +- What are the entities and their schemas? |
| 36 | +- What are the validation rules? |
| 37 | +- What are the constraints and requirements? |
| 38 | + |
| 39 | +**Key**: This is **pure domain knowledge**, independent of implementation. |
| 40 | + |
| 41 | +### Feature 2: Toolkit Specification (Secondary) |
| 42 | +**Purpose**: Define how to build tools to parse, validate, and enforce the domain spec |
| 43 | + |
| 44 | +**Example**: `specs/002-toolkit-spec/spec.md` |
| 45 | +- **Depends on**: 001-{{ domain }}-protocol-spec |
| 46 | +- **Components**: Parser, Validator, CLI |
| 47 | +- **Goal**: Execute and validate Feature 1's specification |
| 48 | + |
| 49 | +**Key**: The toolkit is the **carrier** of the domain specification. |
| 50 | + |
| 51 | +### Why Separate? |
| 52 | + |
| 53 | +1. ✅ **Clear Concerns**: Protocol experts define Feature 1, toolkit experts define Feature 2 |
| 54 | +2. ✅ **Reusable Specs**: Feature 1 can be published and referenced independently |
| 55 | +3. ✅ **Clean Dependencies**: Feature 2 explicitly depends on Feature 1 |
| 56 | +4. ✅ **True Spec-Driven**: Specification IS the system, toolkit executes it |
| 57 | + |
| 58 | +### When to Merge? |
| 59 | + |
| 60 | +Only for very simple toolkits without formal protocols. **Default: Always separate.** |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## 🎯 Development Workflow |
| 65 | + |
| 66 | +### Phase 1: Define Domain Specification |
| 67 | + |
| 68 | +#### Step 0: Define Design Principles |
| 69 | +```bash |
| 70 | +/sdx.constitution |
| 71 | +# Define domain governance principles at memory/constitution.md |
| 72 | +# Focus: Domain principles, not implementation |
| 73 | +``` |
| 74 | + |
| 75 | +#### Step 1: Define Domain Specification |
| 76 | +```bash |
| 77 | +/sdx.specify "Define {{ domain }} protocol" |
| 78 | +# Creates specs/001-{{ domain }}-protocol-spec/spec.md |
| 79 | +# Focus: Domain protocol, entities, validation rules |
| 80 | +``` |
| 81 | + |
| 82 | +#### Step 2 (Optional): Clarify Domain Specification |
| 83 | +```bash |
| 84 | +/sdx.clarify |
| 85 | +# Resolve ambiguities in the domain spec |
| 86 | +``` |
| 87 | + |
| 88 | +#### Step 3 (Optional): Validate Domain Spec Quality |
| 89 | +```bash |
| 90 | +/sdx.checklist |
| 91 | +# Check domain specification completeness and clarity |
| 92 | +``` |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +### Phase 2: Define Toolkit Specification |
| 97 | + |
| 98 | +#### Step 4: Define Toolkit Specification |
| 99 | +```bash |
| 100 | +/sdx.specify "Define toolkit for {{ domain }} protocol" |
| 101 | +# Creates specs/002-toolkit-spec/spec.md |
| 102 | +# Focus: Parser, Validator, CLI components |
| 103 | +# Depends on: 001-{{ domain }}-protocol-spec |
| 104 | +``` |
| 105 | + |
| 106 | +#### Step 5: Design Architecture |
| 107 | +```bash |
| 108 | +/sdx.plan |
| 109 | +# Generates specs/002-toolkit-spec/plan.md |
| 110 | +# Technical design for the toolkit |
| 111 | +``` |
| 112 | + |
| 113 | +#### Step 6: Break Down Tasks |
| 114 | +```bash |
| 115 | +/sdx.tasks |
| 116 | +# Generates specs/002-toolkit-spec/tasks.md |
| 117 | +# Development tasks for building src/ code |
| 118 | +``` |
| 119 | + |
| 120 | +#### Step 7 (Optional): Validate Implementation Spec |
| 121 | +```bash |
| 122 | +/sdx.checklist |
| 123 | +# Check implementation specification quality |
| 124 | +``` |
| 125 | + |
| 126 | +#### Step 8 (Optional): Check Consistency |
| 127 | +```bash |
| 128 | +/sdx.analyze |
| 129 | +# Cross-artifact consistency (spec.md, plan.md, tasks.md) |
| 130 | +# Verify Feature 2 aligns with Feature 1 |
| 131 | +``` |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +### Phase 3: Implement Toolkit |
| 136 | + |
| 137 | +#### Step 9: Implement |
| 138 | +```bash |
| 139 | +/sdx.implement |
| 140 | +# Build src/ code based on Feature 2 specifications |
| 141 | +``` |
| 142 | + |
| 143 | +--- |
| 144 | + |
| 145 | +## 📚 Feature Management |
| 146 | + |
| 147 | +### Create New Feature |
| 148 | +```bash |
| 149 | +./scripts/bash/create-new-feature.sh |
| 150 | +# Or use: /sdx.specify "feature description" |
| 151 | +``` |
| 152 | + |
| 153 | +### Feature Numbering |
| 154 | +- `001-xxx`: Domain specification (Primary, core knowledge) |
| 155 | +- `002-xxx`: Toolkit specification (Secondary, executor) |
| 156 | +- `003-xxx`: Additional features or enhancements |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +## 🔄 Specification Evolution |
| 161 | + |
| 162 | +### Propose Changes (for stable features) |
| 163 | +```bash |
| 164 | +/sdx.proposal "Change description" |
| 165 | +# Creates change proposal in changes/ |
| 166 | +``` |
| 167 | + |
| 168 | +### Apply Approved Changes |
| 169 | +```bash |
| 170 | +/sdx.apply <proposal-id> |
| 171 | +# Applies changes to specifications |
| 172 | +``` |
| 173 | + |
| 174 | +### Archive Completed Changes |
| 175 | +```bash |
| 176 | +/sdx.archive <proposal-id> |
| 177 | +# Moves to changes/archive/ |
| 178 | +``` |
| 179 | + |
| 180 | +--- |
| 181 | + |
| 182 | +## 💡 Best Practices |
| 183 | + |
| 184 | +1. **Protocol Spec First, Toolkit Spec Second**: Define Feature 1 (protocol spec) before Feature 2 (toolkit spec) |
| 185 | +2. **Separate Concerns**: Keep protocol specification separate from toolkit specification |
| 186 | +3. **Explicit Dependencies**: Feature 2 must explicitly depend on Feature 1 |
| 187 | +4. **Clarify Early**: Use `/sdx.clarify` if requirements are unclear (before planning) |
| 188 | +5. **Validate Before Coding**: Use `/sdx.checklist` and `/sdx.analyze` before `/sdx.implement` |
| 189 | +6. **Keep Specs Updated**: Specifications are living documents |
| 190 | +7. **Package Domain Specs**: The domain specification is a core asset to distribute |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +## 📖 File Descriptions |
| 195 | + |
| 196 | +| File | Purpose | When to Edit | |
| 197 | +|------|---------|--------------| |
| 198 | +| `spec.md` | What to build | During feature definition | |
| 199 | +| `plan.md` | How to build | Generated by `/sdx.plan` | |
| 200 | +| `tasks.md` | Task breakdown | Generated by `/sdx.tasks` | |
| 201 | +| `checklists/` | Quality checks | Generated by `/sdx.checklist` | |
| 202 | + |
| 203 | +--- |
| 204 | + |
| 205 | +**Status**: 🟢 Ready for development | **Last Updated**: {{ date }} |
| 206 | + |
0 commit comments