specweave 0.26.4 → 0.26.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CLAUDE.md +154 -4
  2. package/bin/specweave.js +15 -0
  3. package/dist/plugins/specweave-github/lib/completion-calculator.js +2 -2
  4. package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -1
  5. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +28 -1
  6. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
  7. package/dist/plugins/specweave-github/lib/github-feature-sync.js +191 -19
  8. package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
  9. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts +3 -0
  10. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -1
  11. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +25 -2
  12. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -1
  13. package/dist/src/cli/commands/archive.d.ts +10 -0
  14. package/dist/src/cli/commands/archive.d.ts.map +1 -0
  15. package/dist/src/cli/commands/archive.js +78 -0
  16. package/dist/src/cli/commands/archive.js.map +1 -0
  17. package/dist/src/cli/commands/init.js +2 -2
  18. package/dist/src/cli/commands/init.js.map +1 -1
  19. package/dist/src/cli/helpers/init/initial-increment-generator.d.ts.map +1 -1
  20. package/dist/src/cli/helpers/init/initial-increment-generator.js +48 -8
  21. package/dist/src/cli/helpers/init/initial-increment-generator.js.map +1 -1
  22. package/dist/src/core/increment/increment-reopener.d.ts.map +1 -1
  23. package/dist/src/core/increment/increment-reopener.js +13 -14
  24. package/dist/src/core/increment/increment-reopener.js.map +1 -1
  25. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  26. package/dist/src/core/increment/metadata-manager.js +19 -0
  27. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  28. package/dist/src/core/increment/status-change-sync-trigger.d.ts +85 -0
  29. package/dist/src/core/increment/status-change-sync-trigger.d.ts.map +1 -0
  30. package/dist/src/core/increment/status-change-sync-trigger.js +137 -0
  31. package/dist/src/core/increment/status-change-sync-trigger.js.map +1 -0
  32. package/dist/src/core/increment/sync-circuit-breaker.d.ts +64 -0
  33. package/dist/src/core/increment/sync-circuit-breaker.d.ts.map +1 -0
  34. package/dist/src/core/increment/sync-circuit-breaker.js +95 -0
  35. package/dist/src/core/increment/sync-circuit-breaker.js.map +1 -0
  36. package/dist/src/core/living-docs/living-docs-sync.d.ts +12 -0
  37. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  38. package/dist/src/core/living-docs/living-docs-sync.js +157 -24
  39. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  40. package/dist/src/init/repo/types.d.ts +1 -1
  41. package/package.json +2 -2
  42. package/plugins/specweave/agents/pm/AGENT.md +13 -7
  43. package/plugins/specweave/commands/sync-diagnostics.md +227 -0
  44. package/plugins/specweave/hooks/docs-changed.sh.backup +79 -0
  45. package/plugins/specweave/hooks/human-input-required.sh.backup +75 -0
  46. package/plugins/specweave/hooks/post-first-increment.sh.backup +61 -0
  47. package/plugins/specweave/hooks/post-increment-change.sh.backup +98 -0
  48. package/plugins/specweave/hooks/post-increment-completion.sh.backup +231 -0
  49. package/plugins/specweave/hooks/post-increment-planning.sh.backup +1048 -0
  50. package/plugins/specweave/hooks/post-increment-status-change.sh.backup +147 -0
  51. package/plugins/specweave/hooks/post-spec-update.sh.backup +158 -0
  52. package/plugins/specweave/hooks/post-user-story-complete.sh.backup +179 -0
  53. package/plugins/specweave/hooks/pre-command-deduplication.sh.backup +83 -0
  54. package/plugins/specweave/hooks/pre-implementation.sh.backup +67 -0
  55. package/plugins/specweave/hooks/pre-task-completion.sh.backup +194 -0
  56. package/plugins/specweave/hooks/pre-tool-use.sh.backup +133 -0
  57. package/plugins/specweave/hooks/user-prompt-submit.sh +20 -8
  58. package/plugins/specweave/hooks/user-prompt-submit.sh.backup +386 -0
  59. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +19 -0
  60. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  61. package/plugins/specweave/skills/brownfield-analyzer/SKILL.md +267 -868
  62. package/plugins/specweave/skills/increment-planner/SKILL.md +379 -1245
  63. package/plugins/specweave/skills/role-orchestrator/SKILL.md +293 -969
  64. package/plugins/specweave-ado/hooks/post-living-docs-update.sh.backup +353 -0
  65. package/plugins/specweave-ado/hooks/post-task-completion.sh.backup +172 -0
  66. package/plugins/specweave-ado/lib/ado-multi-project-sync.js +1 -0
  67. package/plugins/specweave-ado/lib/enhanced-ado-sync.js +170 -0
  68. package/plugins/specweave-docs/skills/technical-writing/SKILL.md +333 -839
  69. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +1080 -0
  70. package/plugins/specweave-github/hooks/post-task-completion.sh.backup +258 -0
  71. package/plugins/specweave-github/lib/completion-calculator.js +1 -1
  72. package/plugins/specweave-github/lib/completion-calculator.ts +2 -2
  73. package/plugins/specweave-github/lib/github-feature-sync.js +152 -18
  74. package/plugins/specweave-github/lib/github-feature-sync.ts +225 -22
  75. package/plugins/specweave-github/lib/user-story-issue-builder.js +21 -1
  76. package/plugins/specweave-github/lib/user-story-issue-builder.ts +31 -3
  77. package/plugins/specweave-jira/hooks/post-task-completion.sh.backup +172 -0
  78. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
  79. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +981 -0
  80. package/plugins/specweave-release/hooks/post-task-completion.sh.backup +110 -0
  81. package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +269 -749
  82. package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +318 -810
@@ -5,1478 +5,612 @@ description: Creates comprehensive implementation plans for ANY type of SpecWeav
5
5
 
6
6
  # Increment Planner Skill
7
7
 
8
- ## 📚 Required Reading (LOAD FIRST)
9
-
10
- **CRITICAL**: Before planning features, read this guide:
11
- - **[Increment Lifecycle Guide](.specweave/docs/internal/delivery/guides/increment-lifecycle.md)**
12
-
13
- This guide contains:
14
- - Complete increment structure (spec.md, plan.md, tasks.md with embedded tests)
15
- - WIP limits and status progression
16
- - Task vs increment decision tree
17
- - Context manifest creation for 70%+ token reduction
18
- - **v0.7.0+**: Test-Aware Planning (tests embedded in tasks.md, no separate tests.md)
19
-
20
- **Load this guide using the Read tool BEFORE creating feature plans.**
8
+ **Self-contained increment planning that works in ANY user project after `specweave init`.**
21
9
 
22
10
  ---
23
11
 
24
- This skill creates comprehensive, well-structured implementation plans for SpecWeave features following the Spec-Driven Development methodology.
25
-
26
12
  ## Purpose
27
13
 
28
- The increment-planner skill automates the creation of implementation plans for ANY type of work:
29
- - Auto-numbered increment directories (`0001-9999` 4-digit format)
30
- - Duplicate detection (prevents creating 0002 when 0002 already exists)
31
- - Complete increment artifacts (spec.md, plan.md, tasks.md with embedded tests, **metadata.json**)
32
- - Proper context manifests for selective loading
33
- - Constitutional compliance
34
- - Separation of WHAT/WHY (spec) from HOW (plan) from STEPS (tasks with test plans)
35
- - **v0.7.0+**: Test-Aware Planning (bidirectional AC↔Task↔Test linking)
36
- - **v0.8.0+**: Multi-Project Support (specs organized by project/team)
37
- - **v0.18.0+**: Bidirectional Task↔User Story Linking (automatic during `/specweave:done`)
38
- - **v0.24.5+**: **MANDATORY metadata.json creation** (enables status tracking, WIP limits, external tool sync)
39
-
40
- ## Bidirectional Linking (v0.18.0+)
41
-
42
- **CRITICAL FEATURE**: When you create tasks, ensure they have **AC**: fields so bidirectional links can be created automatically.
43
-
44
- ### How It Works
45
-
46
- 1. **During Planning**: Create tasks with AC-IDs
47
- ```markdown
48
- ## T-001: Implement User Login
49
-
50
- **AC**: AC-US1-01, AC-US1-02, AC-US1-03 ← CRITICAL!
51
- ```
52
-
53
- 2. **During Completion**: `/specweave:done` automatically:
54
- - Extracts user stories to `.specweave/docs/internal/specs/{project}/{feature}/`
55
- - Parses tasks.md for AC-IDs
56
- - **Injects bidirectional links** into tasks.md
57
- - Creates complete traceability (Tasks ↔ User Stories)
58
-
59
- 3. **Result**: Tasks now link back to user stories:
60
- ```markdown
61
- ## T-001: Implement User Login
62
-
63
- **User Story**: [US-001: User Authentication](../../docs/internal/specs/default/auth-service/us-001-user-authentication.md)
64
-
65
- **AC**: AC-US1-01, AC-US1-02, AC-US1-03
66
- ```
67
-
68
- ### Requirements
69
-
70
- **MUST HAVE** for bidirectional linking:
71
- - ✅ Tasks with **AC**: field
72
- - ✅ AC-IDs in format: `AC-US{number}-{criteria}` (e.g., `AC-US1-01`)
73
- - ✅ Matching user stories in spec.md (e.g., `### US-001:` or `#### US-001:`)
14
+ Automates creation of increment structure for ANY type of work:
15
+ - Auto-numbered directories (`0001-9999`)
16
+ - Duplicate detection (prevents conflicts)
17
+ - Complete file templates (spec.md, plan.md, tasks.md, metadata.json)
18
+ - Proper YAML frontmatter
19
+ - Works in all user projects (self-contained)
74
20
 
75
- **Multi-Project Support**:
76
- - Works with `specs/default/`, `specs/backend/`, `specs/frontend/`, etc.
77
- - Paths automatically adapt to project structure
78
- - No additional configuration needed
79
-
80
- ### Benefits
81
-
82
- - ✅ **Complete Traceability**: Navigate from tasks to user stories and back
83
- - ✅ **Automatic**: Zero manual linking during `/specweave:done`
84
- - ✅ **LLM-Friendly**: AI can understand relationships bidirectionally
85
- - ✅ **Multi-Project Aware**: Works across all projects
86
-
87
- **For complete details**: See `.specweave/docs/public/guides/bidirectional-linking.md`
88
-
89
- ## Increment Types (v0.7.0+)
90
-
91
- **Increments can be any type of work**, not just features. SpecWeave supports six types:
92
-
93
- | Type | Description | Use When | Limit |
94
- |------|-------------|----------|-------|
95
- | **feature** | Standard feature development | Adding new functionality | Max 2 active |
96
- | **hotfix** | Critical production fixes | Production is broken | Unlimited |
97
- | **bug** | Production bugs with SRE investigation | Bug requires root cause analysis | Unlimited |
98
- | **change-request** | Stakeholder requests | Business requirements change | Max 2 active |
99
- | **refactor** | Code improvement | Technical debt, code quality | Max 1 active |
100
- | **experiment** | POC/spike work | Exploring options, prototypes | Unlimited* |
21
+ ---
101
22
 
102
- **Examples**:
103
- - **Feature**: "Add user authentication", "Implement payment processing"
104
- - **Hotfix**: "Fix critical security vulnerability CVE-2024-1234"
105
- - **Bug**: "Investigate memory leak in production API", "Performance degradation in checkout flow"
106
- - **Change Request**: "Redesign dashboard per stakeholder feedback"
107
- - **Refactor**: "Extract service layer from monolith", "Migrate to TypeScript"
108
- - **Experiment**: "Evaluate GraphQL vs REST", "Prototype real-time collaboration"
23
+ ## Increment Types
109
24
 
110
- **Key Insight**: The increment structure (spec.md, plan.md, tasks.md) works for ALL types. Even a bug investigation needs:
111
- - **spec.md**: What's broken? Expected vs actual behavior? Impact?
112
- - **plan.md**: Investigation approach, tools, hypothesis
113
- - **tasks.md**: Investigation steps, fix implementation, verification
25
+ | Type | Description | Use When | WIP Limit |
26
+ |------|-------------|----------|-----------|
27
+ | **feature** | New functionality | Adding features | Max 2 active |
28
+ | **hotfix** | Critical production fixes | Production broken | Unlimited |
29
+ | **bug** | Bug investigation with RCA | Needs root cause analysis | Unlimited |
30
+ | **change-request** | Stakeholder requests | Business changes | Max 2 active |
31
+ | **refactor** | Code improvement | Technical debt | Max 1 active |
32
+ | **experiment** | POC/spike work | Exploring options | Unlimited |
114
33
 
115
- ## When to Use This Skill
34
+ ---
116
35
 
117
- Use this skill when:
118
- - **Features**: Creating new functionality from a description
119
- - **Hotfixes**: Planning urgent production fixes
120
- - **Bugs**: Structuring SRE investigations and root cause analysis
121
- - **Change Requests**: Organizing stakeholder-driven changes
122
- - **Refactors**: Planning code improvement work
123
- - **Experiments**: Structuring POCs and technical spikes
124
- - **Brownfield**: Structuring modifications to existing codebases
36
+ ## When to Use
125
37
 
126
- ## When NOT to Use This Skill
38
+ **USE** when:
39
+ - Creating features, hotfixes, bug investigations, refactors, POCs
40
+ - Planning structured work in user projects
41
+ - Need complete increment scaffold with templates
127
42
 
128
- Do NOT activate if:
129
- - User is asking general questions about SpecWeave (use documentation instead)
130
- - Another skill (e.g., `project-kickstarter`) is already handling the request
131
- - User is already in an active increment planning workflow
132
- - ❌ Increment files (spec.md, plan.md, tasks.md) are currently being created
43
+ **DON'T USE** when:
44
+ - User asking general questions
45
+ - Another skill already handling request
46
+ - Already in active increment planning
133
47
 
134
48
  ---
135
49
 
136
- ## Increment Naming Convention
50
+ ## Critical Rules
137
51
 
138
- **CRITICAL**: All increments MUST use descriptive names, not just numbers.
52
+ ### 1. Increment Naming (MANDATORY)
139
53
 
140
54
  **Format**: `####-descriptive-kebab-case-name`
141
55
 
142
- **Examples**:
143
- - ✅ `0001-core-framework`
144
- - ✅ `0002-core-enhancements`
145
- - ✅ `0003-intelligent-model-selection`
146
- - ❌ `0003` (too generic, rejected)
147
- - ❌ `0004` (no description, rejected)
148
-
149
- **Rationale**:
150
- - **Clear intent at a glance** - "0003-intelligent-model-selection" tells you exactly what it does
151
- - **Easy to reference** - "the model selection increment" vs "increment 3"
152
- - **Better git history** - Commit messages naturally include feature name
153
- - **Searchable by feature** - `git log --grep="model-selection"` works
154
- - **Self-documenting** - Increment folders are readable without opening files
155
-
156
- **Rules**:
157
- - `####` = Zero-padded 4-digit number (0001, 0002, 0003, ...)
158
- - `-descriptive-name` = Kebab-case description (lowercase, hyphens)
159
- - Max 50 chars total (for readability)
160
- - No special characters except hyphens
161
-
162
- **When Creating Increments**:
163
- ```bash
164
- # ❌ Wrong
165
- /specweave:increment "0004"
166
-
167
- # ✅ Correct
168
- /specweave:increment "0004-cost-optimization"
169
- /specweave:increment "0005-github-sync-enhancements"
56
+ **CORRECT**:
170
57
  ```
171
-
172
- **Enforcement**:
173
- - `/specweave:increment` command validates naming (rejects bare numbers)
174
- - Code review requirement (descriptive names mandatory)
175
-
176
- ---
177
-
178
- ## 🔗 External Sync Architecture (CRITICAL)
179
-
180
- **Source of Truth**: `.specweave/docs/specs/` (LOCAL) is the permanent source of truth. External tools (GitHub, Jira, ADO) are **MIRRORS**.
181
-
182
- **Correct sync direction**:
58
+ 0001-user-authentication
59
+ 0002-payment-processing
60
+ 0003-email-notifications
183
61
  ```
184
- ✅ CORRECT:
185
- .specweave/ ↔ GitHub Issues (Local ↔ External)
186
- .specweave/ ↔ Jira Epics (Local ↔ External)
187
- .specweave/ ↔ ADO Work Items (Local ↔ External)
188
62
 
189
- ❌ WRONG:
190
- GitHub ↔ Jira (External ↔ External - NO!)
63
+ **WRONG**:
191
64
  ```
192
-
193
- **When invoking PM agent**: Ensure it understands sync is **Local ↔ External**, not External ↔ External!
194
-
195
- ## Activation Triggers
196
-
197
- This skill activates automatically when users say:
198
- - **Features**: "Plan a feature for...", "Create implementation plan for..."
199
- - **Hotfixes**: "Fix critical bug in production", "Emergency security patch"
200
- - **Bugs**: "Investigate memory leak", "Debug performance issue", "Root cause analysis for..."
201
- - **Change Requests**: "Stakeholder requested...", "Business wants to change..."
202
- - **Refactors**: "Refactor...", "Extract service layer", "Improve code quality"
203
- - **Experiments**: "Prototype...", "Evaluate...", "POC for...", "Spike work"
204
- - **General**: "Create increment for...", "Help me structure [work]", "Break down this work: ..."
205
-
206
- ---
207
-
208
- ## 🆕 Multi-Project Support (v0.8.0+ | Flattened v0.16.11+)
209
-
210
- **Key Changes**:
211
- - ✅ **CORRECT** (v0.16.11+): Specs organized with FLATTENED structure: `.specweave/docs/internal/specs/{project-id}/`
212
- - ❌ **OLD** (v0.8.0-v0.16.10): `.specweave/docs/internal/projects/{project-id}/specs/` (DEPRECATED nested structure)
213
- - Use `ProjectManager` (from `src/core/project-manager.ts`) to get correct paths (always returns flattened structure)
214
- - Single project uses `specs/default/` automatically (transparent)
215
- - Multi-project mode allows multiple teams/repos
216
- - Parent repo content goes to `specs/_parent/` (for multi-repo setups with parent repositories)
217
-
218
- **Path Resolution**:
219
- ```typescript
220
- import { ProjectManager } from '../../core/project-manager';
221
-
222
- const projectManager = new ProjectManager(projectRoot);
223
- const activeProject = projectManager.getActiveProject();
224
-
225
- // Get correct paths for active project (flattened structure v0.16.11+)
226
- const specsPath = projectManager.getSpecsPath(); // specs/{activeProject.id}/
227
- const modulesPath = projectManager.getModulesPath(); // modules/{activeProject.id}/
228
- const teamPath = projectManager.getTeamPath(); // team/{activeProject.id}/
65
+ 0001 ← No description
66
+ 0002-feature ← Too generic
67
+ my-feature ← No number
229
68
  ```
230
69
 
231
- **In PM Agent Instructions**:
232
- - DO NOT hardcode `.specweave/docs/internal/specs/`
233
- - USE ProjectManager to get correct path for active project
234
- - Living docs are created via `/specweave:sync-docs update` (not manually):
235
- - Feature overviews: `.specweave/docs/internal/specs/_features/FS-{number}/FEATURE.md`
236
- - User stories: `.specweave/docs/internal/specs/{project}/FS-{number}/us-{id}-{slug}.md`
237
-
238
- ---
239
-
240
- ## ⚠️ CRITICAL: Living Documentation Workflow
70
+ ### 2. NO Agent Spawning from Skills (CRITICAL)
241
71
 
242
- **MANDATORY**: Feature planner must orchestrate **BOTH** living docs and increment files.
72
+ **Skills MUST NOT spawn content-generating agents via Task() tool.**
243
73
 
244
- ### Correct Workflow (MUST FOLLOW)
74
+ **Why**: Context explosion causes Claude Code crashes:
75
+ - Skill (1500 lines) loads into context
76
+ - Agent (600 lines) spawned
77
+ - Agent output (2000+ lines) generated
78
+ - **Total: 4000+ lines = CRASH** 💥
245
79
 
80
+ **✅ SAFE Workflow**:
246
81
  ```
247
- User: "I want to build real-time price tracking"
248
-
249
- increment-planner skill
250
-
251
- STEP 1: Determine increment number and check for duplicates
252
- ├─ Use the Bash tool to run: node plugins/specweave/skills/increment-planner/scripts/feature-utils.js next
253
- ├─ Get next available increment number (e.g., "0021")
254
- ├─ Get short name from user description
255
- ├─ Check if increment already exists using: node plugins/specweave/skills/increment-planner/scripts/feature-utils.js check-increment {number}
256
- └─ If duplicate found, STOP and tell user: "Increment {number} already exists! Please use the existing increment."
257
-
258
- STEP 2: Scan existing docs
259
- ├─ Read .specweave/docs/internal/strategy/ (existing requirements)
260
- ├─ Read .specweave/docs/internal/architecture/adr/ (existing decisions)
261
- └─ Pass existing context to agents
262
-
263
- STEP 3: Invoke PM Agent (🚨 MANDATORY - USE TASK TOOL)
264
-
265
- YOU MUST USE THE TASK TOOL - DO NOT SKIP:
266
-
267
- Task(
268
- subagent_type: "specweave:pm:pm",
269
- description: "PM product strategy",
270
- prompt: "Create product strategy for: [user feature description]
271
-
272
- Context from existing docs: [summary of strategy docs from Step 1]
273
-
274
- You MUST create living Spec (living docs - source of truth) AND optionally create increment spec.md:
275
-
276
- 1. Spec (living docs - SOURCE OF TRUTH, permanent):
277
- - IMPORTANT: Living docs are created via `/specweave:sync-docs update` (not manually)
278
- - Structure (v0.18.0+ - three-layer architecture):
279
- * Feature overview: `.specweave/docs/internal/specs/_features/FS-{number}/FEATURE.md`
280
- * User stories: `.specweave/docs/internal/specs/{project}/FS-{number}/us-*.md`
281
- - This is the COMPLETE, PERMANENT source of truth
282
- - Include ALL of:
283
- * User stories (US-001, US-002, etc.) with full details
284
- * Acceptance criteria (AC-US1-01, etc.)
285
- * Functional requirements (FR-001, etc.)
286
- * Non-functional requirements (NFR-001, etc.)
287
- * Success criteria (metrics, KPIs)
288
- * Test strategy
289
- - This spec can be linked to Jira/ADO/GitHub Issues
290
- - Spec persists even after increment completes
291
- - No line limit (be thorough, this is source of truth)
292
-
293
- 2. Strategy docs (optional, high-level ONLY):
294
- - IF this is a NEW module/product, create:
295
- .specweave/docs/internal/strategy/{module-name}/
296
- * overview.md (high-level product vision, market opportunity, personas)
297
- * business-case.md (optional - ROI, competitive analysis)
298
- - IMPORTANT:
299
- * ❌ NO detailed user stories (those go in living spec.md)
300
- * ❌ NO detailed requirements (those go in living spec.md)
301
- * ❌ NO acceptance criteria (those go in living spec.md)
302
- * ✅ ONLY strategic, high-level business context
303
-
304
- 3. Increment spec.md (optional, can duplicate living spec):
305
- - Create .specweave/increments/{number}-{name}/spec.md
306
- - This CAN duplicate content from living spec.md (temporary reference - that's OK!)
307
- - OR it can just reference the spec: \"See [FS-{number}](../../docs/internal/specs/_features/FS-{number}/FEATURE.md) for complete requirements\"
308
- - Increment spec.md may be deleted after increment completes
309
- - Living spec.md persists as permanent documentation
310
-
311
- Tech stack: [detected tech stack]"
312
- )
313
-
314
- Wait for PM agent to complete!
315
-
316
- STEP 4: Invoke Architect Agent (🚨 MANDATORY - USE TASK TOOL)
317
-
318
- YOU MUST USE THE TASK TOOL - DO NOT SKIP:
319
-
320
- Task(
321
- subagent_type: "specweave:architect:architect",
322
- description: "Architect technical design",
323
- prompt: "Create technical architecture for: [user feature description]
324
-
325
- FIRST, read PM's strategy docs from .specweave/docs/internal/strategy/{module}/
326
-
327
- You MUST create BOTH living docs AND increment files:
328
-
329
- 1. Living docs (source of truth):
330
- - Update .specweave/docs/internal/architecture/system-design.md
331
- - Create .specweave/docs/internal/architecture/adr/ (at least 3 ADRs):
332
- * ####-websocket-vs-polling.md
333
- * ####-database-choice.md
334
- * ####-deployment-platform.md
335
- - Create diagrams/{module}/ (Mermaid C4 diagrams)
336
- - Create data-models/{module}-schema.sql
337
-
338
- 2. Increment file:
339
- - Create .specweave/increments/{number}-{name}/plan.md
340
- - Keep plan.md < 500 lines (summary only)
341
- - MUST reference living docs
342
- - Include links to ../../docs/internal/architecture/adr/
343
-
344
- Tech stack: [detected tech stack]"
345
- )
346
-
347
- Wait for Architect agent to complete!
348
-
349
- STEP 5: Invoke Test-Aware Planner Agent (🚨 MANDATORY - USE TASK TOOL)
350
-
351
- YOU MUST USE THE TASK TOOL - DO NOT SKIP:
352
-
353
- Task(
354
- subagent_type: "specweave:test-aware-planner:test-aware-planner",
355
- description: "Generate tasks with embedded tests",
356
- prompt: "Create tasks.md with embedded test plans for: [user feature description]
357
-
358
- FIRST, read the increment files:
359
- - .specweave/increments/{number}-{name}/spec.md (user stories with AC-IDs)
360
- - .specweave/increments/{number}-{name}/plan.md (technical architecture)
361
-
362
- You MUST create tasks.md with embedded test plans:
363
-
364
- Generate .specweave/increments/{number}-{name}/tasks.md:
365
- - Parse spec.md for user stories (US1, US2) and AC-IDs (AC-US1-01, etc.)
366
- - Parse plan.md for technical architecture and test strategy
367
- - Generate tasks with embedded test plans (NO separate tests.md)
368
- - Each task includes:
369
- * Test Plan (Given/When/Then in BDD format)
370
- * Test Cases (unit/integration/E2E with file paths and function names)
371
- * Coverage Targets (80-90% overall)
372
- * Implementation steps
373
- * TDD workflow (if test_mode: TDD)
374
- - For non-testable tasks (docs, config): Use Validation section
375
- - Ensure all AC-IDs from spec.md are covered
376
-
377
- Follow the workflow in plugins/specweave/agents/test-aware-planner/AGENT.md
378
- Use templates from plugins/specweave/agents/test-aware-planner/templates/
379
-
380
- Tech stack: [detected tech stack]"
381
- )
382
-
383
- Wait for test-aware-planner agent to complete!
384
-
385
- STEP 6: Validate Living Docs and Increment Files
386
- ├─ Check `.specweave/docs/internal/specs/_features/FS-{number}/FEATURE.md` exists (SOURCE OF TRUTH)
387
- ├─ Check living spec.md contains ALL user stories, requirements, AC-IDs (with AC-IDs)
388
- ├─ Check .specweave/docs/internal/architecture/adr/ has ≥3 ADRs
389
- ├─ Check strategy docs (if created) are high-level only (no detailed user stories)
390
- ├─ Check .specweave/increments/{number}-{name}/spec.md references or duplicates living spec
391
- ├─ Check .specweave/increments/{number}-{name}/plan.md references architecture docs
392
- ├─ Check .specweave/increments/{number}-{name}/tasks.md has embedded test plans
393
- └─ Check tasks.md covers ALL AC-IDs from living spec.md
394
-
395
- ✅ SUCCESS: Living spec created (permanent), increment created (temporary)
82
+ 1. Skill creates basic templates (50 lines each)
83
+ 2. Skill outputs: "Tell Claude: 'Complete spec for increment 0005'"
84
+ 3. Agent activates in MAIN context (NOT nested) = SAFE
396
85
  ```
397
86
 
398
- ### What Gets Created
87
+ ### 3. metadata.json is MANDATORY
399
88
 
400
- #### Living Spec (Living Docs - Source of Truth) ✅
401
- ```
402
- .specweave/docs/internal/specs/
403
- ├── _features/ # Cross-project feature overviews (v0.18.0+)
404
- │ └── FS-{number}/
405
- │ └── FEATURE.md # ← Feature summary (created via sync-docs)
406
- └── {project-id}/ # ← Project-specific user stories
407
- └── FS-{number}/
408
- ├── README.md # ← Project context
409
- └── us-*.md # ← User story details (created via sync-docs)
410
- # COMPLETE user stories, AC, requirements
411
- # This is the PERMANENT source of truth
412
- # Can be linked to Jira/ADO/GitHub Issues
413
- # Persists after increment completes
414
-
415
- # Examples (v0.18.0+ Three-Layer):
416
- # Feature overview: specs/_features/FS-001/FEATURE.md
417
- # User stories: specs/specweave/FS-001/us-001-user-auth.md, us-002-password-reset.md
418
- # specs/mobile/FS-002/us-001-push-notifications.md
419
- # specs/backend/FS-003/us-001-api-auth.md
420
-
421
- # OLD (v0.17.x): specs/{project}/spec-{number}-{name}.md ← DEPRECATED
422
- # OLD (v0.8.0-v0.16.10): projects/default/specs/... ← DEPRECATED
423
- ```
89
+ Every increment MUST have `metadata.json` or:
90
+ - ❌ Status tracking broken
91
+ - ❌ WIP limits don't work
92
+ - External sync fails (GitHub/Jira/ADO)
93
+ - ❌ All increment commands fail
424
94
 
425
- #### Strategy Docs (Optional, High-Level) ⚠️
426
- ```
427
- .specweave/docs/internal/strategy/
428
- └── {module}/ # ← PM Agent (only if NEW module)
429
- ├── overview.md # High-level product vision, market opportunity
430
- └── business-case.md # (optional) ROI, competitive analysis
431
-
432
- NO requirements.md (goes in living spec.md)
433
- NO user-stories.md (goes in living spec.md)
434
- NO success-criteria.md (goes in living spec.md)
95
+ **Complete template** (values from `.specweave/config.json`):
96
+ ```json
97
+ {
98
+ "id": "0001-feature-name",
99
+ "status": "planned",
100
+ "type": "feature",
101
+ "priority": "P1",
102
+ "created": "2025-11-24T12:00:00Z",
103
+ "lastActivity": "2025-11-24T12:00:00Z",
104
+ "testMode": "<FROM config.testing.defaultTestMode OR 'TDD'>",
105
+ "coverageTarget": <FROM config.testing.defaultCoverageTarget OR 95>,
106
+ "feature_id": null,
107
+ "epic_id": null,
108
+ "externalLinks": {}
109
+ }
435
110
  ```
436
111
 
437
- #### Architecture Docs (Living Documentation)
438
- ```
439
- .specweave/docs/internal/architecture/
440
- ├── system-design.md # ← Architect updates this
441
- ├── adr/ # ← Architect creates ADRs
442
- │ ├── ####-websocket-vs-polling.md
443
- │ ├── ####-database-choice.md
444
- │ └── ####-deployment-platform.md
445
- ├── diagrams/ # ← Architect creates diagrams
446
- │ └── {module}/
447
- │ ├── system-context.mmd # C4 Level 1
448
- │ └── system-container.mmd # C4 Level 2
449
- └── data-models/
450
- └── {module}-schema.sql
451
- ```
112
+ **NOTE**: Always read `testMode` and `coverageTarget` from config, don't hardcode!
113
+
114
+ ### 4. Increment Structure
452
115
 
453
- #### Increment Files (Temporary Implementation Tracker) ✅
116
+ **Complete directory structure**:
454
117
  ```
455
118
  .specweave/increments/0001-feature-name/
456
- ├── spec.md # PM Agent (CAN duplicate living spec.md - temporary reference)
457
- # OR just reference: "See SPEC-0001-feature-name"
458
- # May be deleted after increment completes
459
- ├── plan.md # Architect Agent (technical design, references ADRs)
460
- ├── tasks.md # ← test-aware-planner Agent (tasks with embedded test plans)
461
- │ # v0.7.0+: Tests embedded in each task (BDD format)
462
- │ # Each task includes: Test Plan, Given/When/Then, test files
463
- └── context-manifest.yaml # ← increment-planner creates
119
+ ├── spec.md # WHAT & WHY (user stories, acceptance criteria)
120
+ ├── plan.md # HOW (technical design, architecture)
121
+ ├── tasks.md # STEPS (implementation tasks with embedded tests)
122
+ └── metadata.json # Metadata (MANDATORY)
464
123
  ```
465
124
 
466
- **v0.7.0 Architecture Pivot**: tests.md eliminated, tests are now embedded directly in tasks.md
467
-
468
- **Key Difference**:
469
- - **Living spec.md** = Permanent source of truth (persists after increment)
470
- - **Increment spec.md** = Temporary reference (can be deleted after increment)
125
+ **NO separate tests.md** - tests embedded in tasks.md (v0.7.0+)
471
126
 
472
127
  ---
473
128
 
474
- ### Validation Rules (MANDATORY)
475
-
476
- Before completing feature planning, verify:
477
-
478
- **Living Spec (Living Docs - Source of Truth, Mandatory)**:
479
- - [ ] `.specweave/docs/internal/specs/_features/FS-{number}/FEATURE.md` exists (created via sync-docs)
480
- - [ ] Living spec.md contains ALL user stories (US-001, US-002, etc.) with full details
481
- - [ ] Living spec.md contains ALL acceptance criteria (AC-US1-01, etc.)
482
- - [ ] Living spec.md contains ALL requirements (FR-001, NFR-001, etc.)
483
- - [ ] Living spec.md contains success criteria (metrics, KPIs)
484
- - [ ] Living spec.md may reference `../../strategy/{module}/overview.md` for context
485
- - [ ] No line limit on living spec.md (be thorough - this is permanent!)
486
-
487
- **Strategy Docs (Optional)**:
488
- - [ ] If created, `.specweave/docs/internal/strategy/{module}/overview.md` is high-level only
489
- - [ ] No detailed user stories in strategy docs (US-001, etc. - those go in Spec)
490
- - [ ] No detailed requirements in strategy docs (FR-001, NFR-001, etc. - those go in Spec)
491
- - [ ] Strategy docs provide business context only (market, opportunity, personas)
492
-
493
- **Architecture Docs (Mandatory)**:
494
- - [ ] `.specweave/docs/internal/architecture/adr/` has ≥3 ADRs
495
- - [ ] ADRs follow template (Context, Decision, Alternatives, Consequences)
496
- - [ ] Diagrams created for module (system-context, system-container)
497
-
498
- **Increment spec.md (Optional - can duplicate living spec)**:
499
- - [ ] `spec.md` either duplicates living spec.md OR references it ("See [FS-{number}](../../docs/internal/specs/_features/FS-{number}/FEATURE.md)")
500
- - [ ] If duplicated, content matches living spec.md
501
-
502
- **Increment plan.md (Mandatory)**:
503
- - [ ] `plan.md` references architecture docs (`../../docs/internal/architecture/adr/`)
504
- - [ ] `plan.md` contains technical implementation details
505
-
506
- **Increment tasks.md (Mandatory, v0.7.0+)**:
507
- - [ ] `tasks.md` contains tasks with embedded test plans (NO separate tests.md)
508
- - [ ] Each testable task has Test Plan (Given/When/Then)
509
- - [ ] Each testable task has Test Cases (unit/integration/E2E)
510
- - [ ] Coverage targets specified (80-90% overall)
511
- - [ ] ALL AC-IDs from Spec spec.md are covered by tasks
512
- - [ ] Non-testable tasks have Validation section
513
-
514
- **Agents Followed Process**:
515
- - [ ] PM Agent created Spec spec.md as permanent source of truth
516
- - [ ] PM Agent scanned existing strategy docs before creating new ones
517
- - [ ] Architect Agent read Spec spec.md before creating architecture
518
- - [ ] Architect created ADRs for ALL technical decisions
519
- - [ ] test-aware-planner Agent read Spec spec.md and plan.md before creating tasks.md
520
- - [ ] test-aware-planner covered ALL AC-IDs from Spec with tasks
521
-
522
- ---
523
-
524
- ## Feature Planning Process
525
-
526
- ### Step 1: Analyze Feature Description
527
-
528
- When a user provides a feature description:
529
-
530
- 1. **Extract Requirements**:
531
- - What is the core user value?
532
- - Why is this feature needed?
533
- - What problem does it solve?
534
-
535
- 2. **Identify Scope**:
536
- - What functionality is included?
537
- - What is explicitly excluded?
538
- - Are there dependencies?
539
-
540
- 3. **Determine Priority**:
541
- - P1 (Critical): Must-have for MVP
542
- - P2 (Important): High-value enhancement
543
- - P3 (Nice-to-have): Polish and optimization
544
-
545
- ### Step 2: Generate Short Name
546
-
547
- From feature description, create a short name following these rules:
548
-
549
- 1. **Extract Keywords**:
550
- - Remove stop words (the, a, an, for, with, etc.)
551
- - Identify 2-4 most meaningful words
552
- - Use action-noun format where possible
129
+ ## Workflow (Safe, Self-Contained)
553
130
 
554
- 2. **Format**:
555
- - Lowercase
556
- - Hyphen-separated
557
- - Max 50 characters
558
- - Example: `stripe-payment-integration` from "Integrate Stripe payment processing"
131
+ ### STEP 0: Read Config Values (MANDATORY)
559
132
 
560
- 3. **Validate**:
561
- - Check for existing features with similar names
562
- - Ensure uniqueness
563
- - Avoid abbreviations unless well-known
133
+ **Read testing configuration from `.specweave/config.json`**:
564
134
 
565
- ### Step 3: Auto-Number Feature
135
+ ```bash
136
+ # Read testMode (default: "TDD")
137
+ testMode=$(cat .specweave/config.json | jq -r '.testing.defaultTestMode // "TDD"')
566
138
 
567
- Determine the next feature number:
139
+ # Read coverageTarget (default: 95)
140
+ coverageTarget=$(cat .specweave/config.json | jq -r '.testing.defaultCoverageTarget // 95')
568
141
 
569
- 1. **Scan Existing**:
570
- - Read `.specweave/increments/` directory
571
- - Extract all `0001-9999` prefixes (4-digit format)
572
- - Also check legacy `001-999` formats (3-digit) to prevent conflicts
573
- - Find highest number
142
+ echo "Using testMode: $testMode"
143
+ echo "Using coverageTarget: $coverageTarget"
144
+ ```
574
145
 
575
- 2. **Increment**:
576
- - Add 1 to highest number
577
- - Zero-pad to 4 digits (e.g., 0001, 0002, ..., 0010, 0011, ..., 0999, 1000, ..., 9999)
146
+ **Store these values for use in STEP 4 and STEP 7!**
578
147
 
579
- 3. **Duplicate Detection**:
580
- - Check if increment number already exists
581
- - Throw error if duplicate found (prevents creating 0002 when 0002 exists)
582
- - This prevents the naming conflict shown in the image where two 0002-* increments existed
148
+ ### STEP 1: Get Next Increment Number
583
149
 
584
- 4. **Create Path**:
585
- - Format: `.specweave/increments/0001-short-name/`
586
- - Example: `.specweave/increments/0003-stripe-payment-integration/`
150
+ Use helper script:
151
+ ```bash
152
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js next
153
+ # Returns: "0021"
154
+ ```
587
155
 
588
- ### Step 4: Create Feature Structure
156
+ Or manually scan:
157
+ ```bash
158
+ ls -1 .specweave/increments/ | grep -E '^[0-9]{4}-' | sort | tail -1
159
+ # Get highest number, add 1
160
+ ```
589
161
 
590
- Generate the complete feature directory with all required files:
162
+ ### STEP 2: Check for Duplicates
591
163
 
592
- ```
593
- .specweave/increments/####-short-name/
594
- ├── spec.md # Feature specification (WHAT and WHY)
595
- ├── plan.md # Implementation plan (HOW)
596
- ├── tasks.md # Executable tasks (STEPS) with embedded test plans (v0.7.0+)
597
- ├── metadata.json # Increment metadata (MANDATORY - v0.24.5+)
598
- └── context-manifest.yaml # Context loading specification
164
+ ```bash
165
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js check-increment 0021
166
+ # If exists: STOP and inform user
599
167
  ```
600
168
 
601
- **v0.7.0 Change**: tests.md eliminated - tests are now embedded in each task in tasks.md
169
+ ### STEP 3: Create Directory Structure
602
170
 
603
- **⚠️ CRITICAL (v0.24.5+)**: `metadata.json` is **MANDATORY** regardless of invocation method (natural language prompt or `/specweave:increment`). Without it:
604
- - ❌ Status line shows nothing (no active increment tracking)
605
- - ❌ WIP limits don't work (can't count active increments)
606
- - ❌ External sync breaks (no GitHub/JIRA/ADO links)
607
- - ❌ All increment management commands fail (`/status`, `/pause`, `/resume`, `/done`)
171
+ ```bash
172
+ mkdir -p .specweave/increments/0021-feature-name
173
+ ```
608
174
 
609
- ### Step 5: Generate spec.md
175
+ ### STEP 4: Create spec.md Template
610
176
 
611
- **Purpose**: Define WHAT this feature does and WHY it's needed.
177
+ Create `.specweave/increments/0021-feature-name/spec.md`:
612
178
 
613
- **Structure**:
614
- ```yaml
179
+ ```markdown
615
180
  ---
616
- feature: 0001-short-name
617
- title: "Human-Readable Feature Title"
618
- priority: P1 | P2 | P3
181
+ increment: 0021-feature-name
182
+ title: "Feature Name"
183
+ type: feature
184
+ priority: P1
619
185
  status: planned
620
- created: YYYY-MM-DD
186
+ created: 2025-11-24
187
+ structure: user-stories
188
+ test_mode: <VALUE FROM config.testing.defaultTestMode OR 'TDD'>
189
+ coverage_target: <VALUE FROM config.testing.defaultCoverageTarget OR 95>
621
190
  ---
622
191
 
623
192
  # Feature: [Title]
624
193
 
625
194
  ## Overview
626
- [High-level description of the feature]
627
195
 
628
- ## User Value
629
- [Why this feature matters to users]
196
+ [High-level description - WHAT this feature does and WHY it's needed]
630
197
 
631
198
  ## User Stories
632
199
 
633
- ### US1: [Title] (P1)
200
+ ### US-001: [Story Title] (P1)
201
+
634
202
  **As a** [user type]
635
203
  **I want** [goal]
636
204
  **So that** [benefit]
637
205
 
638
206
  **Acceptance Criteria**:
639
- - [ ] [Specific, measurable criterion]
640
- - [ ] [Another criterion]
207
+ - [ ] **AC-US1-01**: [Specific, testable criterion]
208
+ - [ ] **AC-US1-02**: [Another criterion]
209
+
210
+ ### US-002: [Story Title] (P2)
641
211
 
642
- ### US2: [Title] (P2)
643
- ...
212
+ [Repeat structure]
644
213
 
645
214
  ## Functional Requirements
646
215
 
647
216
  ### FR-001: [Requirement]
648
217
  [Detailed description]
649
218
 
650
- ### FR-002: [Requirement]
651
- ...
652
-
653
219
  ## Success Criteria
654
- [Measurable outcomes that define feature success]
655
-
656
- ## Out of Scope
657
- [What this feature explicitly does NOT include]
658
-
659
- ## Dependencies
660
- [Other features or systems this depends on]
661
-
662
- ## References
663
- - [Related specs]
664
- - [Architecture docs]
665
- - [ADRs]
666
- ```
667
-
668
- **Key Principles**:
669
- - Technology-agnostic (no HOW, only WHAT and WHY)
670
- - Focused on user value
671
- - Measurable acceptance criteria
672
- - Prioritized user stories (P1/P2/P3)
673
-
674
- ### Step 6: Check PM Tool Configuration (PM SYNC)
675
-
676
- **Purpose**: Check if external PM tool sync is configured for automatic increment tracking.
677
-
678
- **Why This Matters**: PM tool integration enables automatic sync of increment progress to external systems (GitHub Issues, Jira, Azure DevOps).
679
-
680
- **⚠️ NOTE**: All SpecWeave plugins (19+) are already installed during `specweave init`. No plugin detection or installation needed!
681
-
682
- **Check External PM Tool Configuration**:
683
-
684
- 1. **Read `.specweave/config.json`**:
685
- - If `externalPM.enabled = true` and `externalPM.tool` is set:
686
- - Corresponding plugin is already installed (specweave-github, specweave-jira, or specweave-ado)
687
- - Prepare to auto-create external issue/work item after increment creation
688
- - If `externalPM.enabled = false` or not configured:
689
- - Skip PM tool sync (local-only mode)
690
-
691
- 2. **Auto-Sync to PM Tool** (v0.8.0+):
692
-
693
- **🚨 CRITICAL: SpecWeave Repo Dog-Food Requirement**:
694
- - IF repo = "anton-abyzov/specweave"
695
- - Read `.specweave/config.json`
696
- - Check: `plugins.settings.specweave-github.repo = "anton-abyzov/specweave"`
697
- - IF NOT configured → ❌ **HARD ERROR** (block increment creation):
698
- ```
699
- ❌ SpecWeave repo MUST use GitHub sync!
700
-
701
- This is a "dog food" requirement (ADR-0007):
702
- - SpecWeave demonstrates its own features
703
- - GitHub Issues show public progress
704
- - Community can track development
705
-
706
- Fix: Create .specweave/config.json with GitHub settings
707
- See: CLAUDE.md for config structure
708
- ```
709
- - IF configured → Continue to auto-sync (required)
710
-
711
- **For All Other Repos** (normal behavior):
712
- - **If PM tool configured and plugin installed**:
713
- ```
714
- 🔗 External PM Tool Sync:
715
- Tool: GitHub Issues
716
- Auto-sync: Enabled
717
-
718
- Creating GitHub issue for increment 0007-user-authentication...
719
- ✅ GitHub Issue #42 created
720
- URL: https://github.com/myorg/myapp/issues/42
721
- Linked to: .specweave/increments/0007-user-authentication/metadata.json
722
-
723
- Progress will sync automatically after each task completion!
724
- ```
725
- - **If PM tool configured but plugin NOT installed**:
726
- ```
727
- ⚠️ External PM Tool Configured: GitHub Issues
728
- Plugin missing: specweave-github
729
-
730
- To enable auto-sync: /plugin install specweave-github
731
- Or continue without PM sync (local-only mode)
732
- ```
733
- - **If PM tool not configured**:
734
- ```
735
- ℹ️ No external PM tool configured (local-only mode)
736
- To enable GitHub/Jira/ADO sync: Run project initialization or update config
737
- ```
738
-
739
- 6. **Wait for user to install** (don't block, but remind):
740
- - If user proceeds without installing, remind them before task execution
741
- - Skills from uninstalled plugins won't be available
742
- - User can install later: plugins activate on next Claude Code session
743
-
744
- **When to Execute**:
745
- - ✅ After spec.md generation (Step 5 complete)
746
- - ✅ Before plan.md generation (gives context for planning)
747
- - ✅ After ALL increment files created (spec.md, plan.md, tasks.md)
748
- - ❌ Don't block increment creation (plugins optional, not required)
749
-
750
- **Example Output (Full Flow)**:
751
-
752
- ```
753
- 📝 Increment created: 0007-user-authentication
754
220
 
755
- Files:
756
- • spec.md (user stories, acceptance criteria)
757
- • plan.md (technical architecture)
758
- • tasks.md (implementation steps with embedded tests)
221
+ [Measurable outcomes - metrics, KPIs]
759
222
 
760
- 🔗 External PM Tool Sync:
761
- Tool: GitHub Issues
762
- Plugin: specweave-github ✅ Installed
223
+ ## Out of Scope
763
224
 
764
- Creating GitHub issue...
765
- ✅ Issue #42 created: "Increment 0007: User Authentication"
766
- URL: https://github.com/myorg/myapp/issues/42
225
+ [What this explicitly does NOT include]
767
226
 
768
- Auto-sync enabled:
769
- • Progress updates posted after each task completion
770
- • Issue closed automatically when increment done
227
+ ## Dependencies
771
228
 
772
- Next steps:
773
- 1. Review spec.md - verify user stories
774
- 2. Approve plan.md - validate architecture
775
- 3. Start work: /specweave:do
229
+ [Other features or systems this depends on]
776
230
  ```
777
231
 
778
- **Integration with Existing Workflow**:
779
- - All plugins are already installed during `specweave init` (no detection needed)
780
- - PM tool sync is **automatic** if configured (zero manual intervention)
781
- - Increment creation continues regardless of PM tool status
782
- - This implements the "seamless integration" philosophy
232
+ ### STEP 5: Create plan.md Template
783
233
 
784
- ### Step 7: Generate plan.md
234
+ Create `.specweave/increments/0021-feature-name/plan.md`:
785
235
 
786
- **Purpose**: Define HOW to implement the feature technically.
787
-
788
- **Structure**:
789
236
  ```markdown
790
237
  # Implementation Plan: [Feature Title]
791
238
 
792
239
  ## Overview
240
+
793
241
  [Technical summary of implementation approach]
794
242
 
795
243
  ## Architecture
796
244
 
797
245
  ### Components
798
- [List major components to build/modify]
246
+ - [Component 1]: [Purpose]
247
+ - [Component 2]: [Purpose]
799
248
 
800
249
  ### Data Model
801
- [Entities, relationships, schema changes]
250
+ - [Entity 1]: [Fields, relationships]
251
+ - [Entity 2]: [Fields, relationships]
802
252
 
803
253
  ### API Contracts
804
- [Endpoints, methods, request/response formats]
254
+ - `POST /api/resource`: [Purpose, request/response]
255
+ - `GET /api/resource/:id`: [Purpose, request/response]
805
256
 
806
- ### Integration Points
807
- [External services, internal modules]
257
+ ## Technology Stack
808
258
 
809
- ## Technology Decisions
259
+ - **Language/Framework**: [Choice]
260
+ - **Libraries**: [List]
261
+ - **Tools**: [List]
810
262
 
811
- ### Technology Stack
812
- - [Language/framework]
813
- - [Libraries]
814
- - [Tools]
263
+ **Architecture Decisions**:
264
+ - [Decision 1]: [Why this choice? Alternatives considered?]
265
+ - [Decision 2]: [Rationale]
815
266
 
816
- ### ADRs Required
817
- - [List architecture decisions to document]
818
-
819
- ## Implementation Approach
267
+ ## Implementation Phases
820
268
 
821
269
  ### Phase 1: Foundation
822
- [Setup, infrastructure, base components]
270
+ - [Setup, infrastructure, base components]
823
271
 
824
272
  ### Phase 2: Core Functionality
825
- [Primary features from P1 user stories]
273
+ - [Primary features from P1 user stories]
826
274
 
827
275
  ### Phase 3: Enhancement
828
- [P2 features and optimizations]
276
+ - [P2 features and optimizations]
829
277
 
830
- ### Phase 4: Polish
831
- [P3 features, error handling, edge cases]
278
+ ## Testing Strategy
279
+
280
+ [High-level testing approach - details in tasks.md]
832
281
 
833
282
  ## Technical Challenges
834
283
 
835
284
  ### Challenge 1: [Description]
836
285
  **Solution**: [Approach]
837
- **Risk**: [Mitigation strategy]
838
-
839
- ## File Structure
840
- ```
841
- [Show directory structure of code to create/modify]
286
+ **Risk**: [Mitigation]
842
287
  ```
843
288
 
844
- ## Testing Strategy
845
- [High-level testing approach - tests embedded in tasks.md (v0.7.0+)]
846
-
847
- ## Deployment Considerations
848
- [Infrastructure, environment, rollout]
849
-
850
- ## Performance Targets
851
- [Response times, throughput, resource usage]
852
-
853
- ## Security Considerations
854
- [Authentication, authorization, data protection]
855
- ```
856
-
857
- **Key Principles**:
858
- - Technology-specific (HOW to build it)
859
- - Architectural decisions documented
860
- - Challenges and solutions identified
861
- - Constitutional compliance checked
862
-
863
- ### Step 8: Generate tasks.md
289
+ ### STEP 6: Create tasks.md Template
864
290
 
865
- **Purpose**: Break down implementation into executable steps with intelligent model selection.
291
+ Create `.specweave/increments/0021-feature-name/tasks.md`:
866
292
 
867
- **CRITICAL**: Use the model detection utility to assign optimal models to tasks:
868
- ```typescript
869
- import { detectModelForTask, formatModelHint } from '../utils/model-selection';
870
- ```
871
-
872
- **Structure**:
873
293
  ```markdown
874
294
  # Tasks: [Feature Title]
875
295
 
876
296
  ## Task Notation
877
297
 
878
- - `[T###]`: Sequential task ID
879
- - `[P]`: Parallelizable (no file conflicts)
880
- - `[US#]`: User story reference
298
+ - `[T###]`: Task ID
299
+ - `[P]`: Parallelizable
881
300
  - `[ ]`: Not started
882
301
  - `[x]`: Completed
883
- - Model hints: ⚡ haiku (fast), 🧠 sonnet (thinking), 💎 opus (critical)
302
+ - Model hints: ⚡ haiku, 🧠 sonnet, 💎 opus
884
303
 
885
- ## Phase 1: Setup and Foundation
304
+ ## Phase 1: Setup
886
305
 
887
306
  - [ ] [T001] [P] ⚡ haiku - Initialize project structure
888
- - [ ] [T002] [P] ⚡ haiku - Setup testing framework
889
- - [ ] [T003] ⚡ haiku - Install dependencies
307
+ - [ ] [T002] ⚡ haiku - Setup testing framework
890
308
 
891
309
  ## Phase 2: Core Implementation
892
310
 
893
- ### US1: [User Story Title] (P1)
894
-
895
- - [ ] [T004] ⚡ haiku - Write test for [component]
896
- - [ ] [T005] ⚡ haiku - Implement [component] in src/path/file.ts
897
- - [ ] [T006] [P] ⚡ haiku - Create [another component]
898
- - [ ] [T007] 🧠 sonnet - Integrate components (requires decision-making)
899
- - [ ] [T008] ⚡ haiku - Verify US1 acceptance criteria
900
-
901
- ### US2: [User Story Title] (P2)
902
-
903
- - [ ] [T009] ⚡ haiku - Write test for [feature]
904
- - [ ] [T010] 🧠 sonnet - Implement [feature] (complex logic)
905
- ...
906
-
907
- ## Phase 3: Testing and Validation
908
-
909
- - [ ] [T050] Run integration tests
910
- - [ ] [T051] Performance testing
911
- - [ ] [T052] Security review
912
- - [ ] [T053] Documentation update
913
-
914
- ## Phase 4: Deployment
915
-
916
- - [ ] [T060] Prepare deployment scripts
917
- - [ ] [T061] Staging deployment
918
- - [ ] [T062] Production deployment
919
-
920
- ## Dependencies
921
-
922
- T005 depends on T004 (test must exist first)
923
- T007 depends on T005, T006 (components must exist)
924
- T051 depends on T050 (integration must pass first)
925
- ```
311
+ ### US-001: [User Story Title] (P1)
926
312
 
927
- **Key Principles**:
928
- - Story-centric organization (not layer-centric)
929
- - Test-first sequence (tests before implementation)
930
- - Exact file paths specified
931
- - Parallelizable tasks marked `[P]`
932
- - Dependencies explicitly stated
933
- - **Model hints for cost optimization**: Each task labeled with optimal model
934
- - ⚡ haiku: Clear instructions, mechanical work (3x faster, 20x cheaper)
935
- - 🧠 sonnet: Complex decisions, creative problem-solving
936
- - 💎 opus: Critical architecture (rare, use sparingly)
937
-
938
- **Model Selection Guidelines**:
939
- 1. **Use Haiku (⚡) when**:
940
- - Task has specific file path (e.g., `src/components/LoginForm.tsx`)
941
- - Acceptance criteria are detailed (3+ specific points)
942
- - Implementation approach is defined in plan.md
943
- - Simple CRUD operations, configuration, setup tasks
944
-
945
- 2. **Use Sonnet (🧠) when**:
946
- - Task requires architecture decisions
947
- - Multiple valid approaches exist
948
- - Integration between components
949
- - Complex business logic
950
- - Error handling strategies
951
-
952
- 3. **Use Opus (💎) when**:
953
- - Critical system architecture
954
- - Security-critical decisions
955
- - Performance-critical algorithms
956
- - Novel problem-solving required
957
-
958
- ### Step 9: Embed Tests in tasks.md (v0.7.0+ Architecture)
959
-
960
- **Purpose**: Ensure every task includes comprehensive test plans directly in tasks.md.
961
-
962
- **v0.7.0 Architecture Pivot**: tests.md eliminated. Tests are now embedded in each task for:
963
- - ✅ Closer proximity to implementation (no sync issues)
964
- - ✅ Bidirectional AC↔Task↔Test linking
965
- - ✅ Test-first development (tests defined before implementation)
966
- - ✅ Clear traceability (each task knows its tests)
967
-
968
- **Task Structure with Embedded Tests**:
969
- ```markdown
970
- ### T-001: Implement login API endpoint
313
+ #### T-003: Implement [component]
971
314
 
972
- **Description**: Create REST API endpoint for user authentication
315
+ **Description**: [What needs to be done]
973
316
 
974
317
  **References**: AC-US1-01, AC-US1-02
975
318
 
976
319
  **Implementation Details**:
977
- - Validate email format
978
- - Check password against bcrypt hash
979
- - Generate JWT token
980
- - Return 401 for invalid credentials
320
+ - [Step 1]
321
+ - [Step 2]
981
322
 
982
323
  **Test Plan**:
983
- - **File**: `tests/unit/auth-service.test.ts`
324
+ - **File**: `tests/unit/component.test.ts`
984
325
  - **Tests**:
985
- - **TC-001**: Valid credentials
986
- - Given valid email and password
987
- - When POST /api/auth/login
988
- - Then return 200 with JWT token
989
- - **TC-002**: Invalid email
990
- - Given malformed email
991
- - When POST /api/auth/login
992
- - Then return 401 with error message
993
- - **TC-003**: Wrong password
994
- - Given correct email, wrong password
995
- - When POST /api/auth/login
996
- - Then return 401, no details leaked
326
+ - **TC-001**: [Test name]
327
+ - Given [precondition]
328
+ - When [action]
329
+ - Then [expected result]
330
+ - **TC-002**: [Test name]
331
+ - Given [precondition]
332
+ - When [action]
333
+ - Then [expected result]
997
334
 
998
335
  **Dependencies**: None
999
- **Estimated Effort**: 4 hours
1000
336
  **Status**: [ ] Not Started
1001
- ```
1002
-
1003
- **Key Features**:
1004
- - **References**: Links to acceptance criteria (bidirectional traceability)
1005
- - **Test Plan**: Specific test file and test functions
1006
- - **BDD Format**: Given/When/Then for clarity
1007
- - **Coverage**: Each testable task MUST have test plan
1008
-
1009
- **test-aware-planner Agent**:
1010
- - Generates tasks.md with embedded tests
1011
- - Ensures 80%+ coverage of testable tasks
1012
- - Marks non-testable tasks (documentation, config)
1013
- - Uses BDD format throughout
1014
-
1015
- **Validation**:
1016
- - Use `/validate-coverage` to check AC and task coverage
1017
- - Target: 80-90% coverage (not 100% - diminishing returns)
1018
- - Integration with `/done` command (runs validation before completion)
1019
-
1020
- ### Step 10: Generate context-manifest.yaml
1021
-
1022
- **Purpose**: Declare exactly what specifications, architecture docs, and ADRs are needed for this feature.
1023
-
1024
- **Structure**:
1025
- ```yaml
1026
- ---
1027
- # Context Manifest for Feature: 0001-short-name
1028
-
1029
- # Specification sections to load
1030
- spec_sections:
1031
- - specs/modules/[relevant-module]/**/*.md
1032
- - specs/constitution.md#[relevant-article]
1033
- - specs/overview.md
1034
-
1035
- # Architecture documents to load
1036
- architecture:
1037
- - architecture/system-design.md#[relevant-section]
1038
- - architecture/data/database-schema.md#[relevant-tables]
1039
- - architecture/[component]/[relevant-doc].md
1040
-
1041
- # Architecture Decision Records to reference
1042
- adrs:
1043
- - adrs/0001-[relevant-decision].md
1044
-
1045
- # Context budget (max tokens to load)
1046
- max_context_tokens: 10000
1047
-
1048
- # Priority level
1049
- priority: high | medium | low
1050
337
 
1051
- # Auto-refresh context on spec changes
1052
- auto_refresh: false
338
+ ## Phase 3: Testing
1053
339
 
1054
- # Related features
1055
- related_features:
1056
- - 0001-[other-feature]
1057
-
1058
- # Tags for search and categorization
1059
- tags:
1060
- - [category]
1061
- - [domain]
1062
- ---
1063
- ```
1064
-
1065
- **Key Principles**:
1066
- - Precision loading (only what's needed)
1067
- - Section-level granularity (e.g., `#authentication-flow`)
1068
- - Token budget to prevent bloat
1069
- - Related features for dependency tracking
1070
-
1071
- ### Step 11: Generate metadata.json (⚠️ MANDATORY - v0.24.5+)
1072
-
1073
- **Purpose**: Create increment metadata for status tracking, WIP limits, and external tool sync.
1074
-
1075
- **CRITICAL**: This step is **NON-NEGOTIABLE** regardless of how the increment was created (natural language prompt, `/specweave:increment`, or any other method).
1076
-
1077
- **Execution Workflow (MUST USE TOOLS)**:
1078
-
1079
- **STEP 1: Check if metadata.json exists**
1080
- ```
1081
- Use Read tool:
1082
- file_path: .specweave/increments/{incrementId}/metadata.json
1083
- ```
1084
-
1085
- **STEP 2: If missing (file not found), create it immediately**
1086
- ```
1087
- Use Write tool:
1088
- file_path: .specweave/increments/{incrementId}/metadata.json
1089
- content: {
1090
- "id": "{incrementId}",
1091
- "status": "planned",
1092
- "type": "{type}",
1093
- "priority": "{priority}",
1094
- "created": "{ISO-8601-timestamp}",
1095
- "lastActivity": "{ISO-8601-timestamp}",
1096
- "testMode": "TDD",
1097
- "coverageTarget": 95,
1098
- "feature_id": null,
1099
- "epic_id": null,
1100
- "externalLinks": {}
1101
- }
340
+ - [ ] [T050] Run integration tests
341
+ - [ ] [T051] Verify all acceptance criteria
1102
342
  ```
1103
343
 
1104
- **Field Extraction (from spec.md frontmatter)**:
1105
- - `id`: Increment directory name (e.g., "0001-user-authentication")
1106
- - `type`: Extract from `type:` in spec.md frontmatter OR default to "feature"
1107
- - `priority`: Extract from `priority:` in spec.md frontmatter OR default to "P1"
1108
- - `created`/`lastActivity`: Current timestamp in ISO-8601 format (e.g., "2025-11-22T19:30:00Z")
1109
- - `testMode`: Extract from `test_mode:` in spec.md frontmatter OR default to "TDD"
1110
- - `coverageTarget`: Extract from `coverage_target:` in spec.md frontmatter OR default to 95
344
+ ### STEP 7: Create metadata.json (MANDATORY)
1111
345
 
1112
- **STEP 3: Validate creation succeeded**
1113
- ```
1114
- Use Read tool again:
1115
- file_path: .specweave/increments/{incrementId}/metadata.json
1116
- ```
346
+ **IMPORTANT**: Read `testMode` and `coverageTarget` from `.specweave/config.json`:
1117
347
 
1118
- If Read succeeds, output:
1119
- ```
1120
- metadata.json created successfully
1121
- Status: planned
1122
- Type: {type}
1123
- Ready for /specweave:do
348
+ ```bash
349
+ # Read config to get defaultTestMode and defaultCoverageTarget
350
+ cat .specweave/config.json | jq -r '.testing.defaultTestMode // "TDD"'
351
+ cat .specweave/config.json | jq -r '.testing.defaultCoverageTarget // 95'
1124
352
  ```
1125
353
 
1126
- **Why This Cannot Be Skipped**:
1127
- Without metadata.json, the increment is **effectively broken**:
1128
- - Status line won't show it as active
1129
- - WIP limit enforcement fails (infinite increments possible!)
1130
- - All increment commands fail (`/status`, `/pause`, `/resume`, `/done`)
1131
- - External tool sync (GitHub/JIRA/ADO) completely broken
1132
- - Hooks can't detect the increment
354
+ Create `.specweave/increments/0021-feature-name/metadata.json`:
1133
355
 
1134
- **Example metadata.json**:
1135
356
  ```json
1136
357
  {
1137
- "id": "0001-user-authentication",
358
+ "id": "0021-feature-name",
1138
359
  "status": "planned",
1139
360
  "type": "feature",
1140
361
  "priority": "P1",
1141
- "created": "2025-11-22T19:30:00Z",
1142
- "lastActivity": "2025-11-22T19:30:00Z",
1143
- "testMode": "TDD",
1144
- "coverageTarget": 95,
362
+ "created": "2025-11-24T12:00:00Z",
363
+ "lastActivity": "2025-11-24T12:00:00Z",
364
+ "testMode": "<VALUE FROM config.testing.defaultTestMode OR 'TDD'>",
365
+ "coverageTarget": <VALUE FROM config.testing.defaultCoverageTarget OR 95>,
1145
366
  "feature_id": null,
1146
367
  "epic_id": null,
1147
368
  "externalLinks": {}
1148
369
  }
1149
370
  ```
1150
371
 
1151
- **⚠️ ENFORCEMENT**: If you complete increment creation without creating metadata.json, you have **failed the task**. This is not optional.
1152
-
1153
- ### Step 12: Validate and Finalize
1154
-
1155
- Before completing:
372
+ **Use Write tool to create this file immediately after creating increment.**
1156
373
 
1157
- 1. **Constitutional Compliance**:
1158
- - Article V: Modular Scalability (proper structure)
1159
- - Article VI: Separation of Concerns (spec vs plan vs tasks)
1160
- - Article IX: Testing Mandate (tasks.md with embedded tests comprehensive)
374
+ **Example Logic**:
375
+ ```javascript
376
+ // Read config
377
+ const config = JSON.parse(fs.readFileSync('.specweave/config.json', 'utf8'));
378
+ const testMode = config?.testing?.defaultTestMode || 'TDD';
379
+ const coverageTarget = config?.testing?.defaultCoverageTarget || 95;
380
+
381
+ // Create metadata with config values
382
+ const metadata = {
383
+ id: "0021-feature-name",
384
+ status: "planned",
385
+ type: "feature",
386
+ priority: "P1",
387
+ created: new Date().toISOString(),
388
+ lastActivity: new Date().toISOString(),
389
+ testMode: testMode, // ← FROM CONFIG!
390
+ coverageTarget: coverageTarget, // ← FROM CONFIG!
391
+ feature_id: null,
392
+ epic_id: null,
393
+ externalLinks: {}
394
+ };
395
+ ```
1161
396
 
1162
- 2. **Quality Checks**:
1163
- - spec.md is technology-agnostic
1164
- - plan.md has sufficient technical detail + test strategy
1165
- - tasks.md has exact file paths + embedded test plans (BDD format)
1166
- - tasks.md covers all P1 AC-IDs with test cases
1167
- - **metadata.json exists and is valid** (v0.24.5+ MANDATORY)
1168
- - context-manifest.yaml is precise
397
+ ### STEP 8: Guide User to Complete Planning
1169
398
 
1170
- 3. **Update Features Index**:
1171
- - Add feature to `features/README.md`
1172
- - Update current features list
399
+ **Output this guidance to user**:
1173
400
 
1174
- 4. **Notify User**:
1175
- - Feature number and path
1176
- - Next steps (review spec, approve plan)
1177
- - How to start implementation
401
+ ```
402
+ Increment structure created: .specweave/increments/0021-feature-name/
1178
403
 
1179
- ## Best Practices
404
+ 📋 Basic templates created:
405
+ • spec.md (user stories, acceptance criteria)
406
+ • plan.md (technical design, architecture)
407
+ • tasks.md (implementation steps with test plans)
408
+ • metadata.json (increment metadata)
1180
409
 
1181
- ### Writing Effective Specs
410
+ 🚀 To complete planning, run these commands in sequence:
1182
411
 
1183
- 1. **Focus on User Value**:
1184
- - Start with "As a user, I want..."
1185
- - Explain WHY, not just WHAT
1186
- - Measurable success criteria
412
+ 1. Complete product specification:
413
+ Tell Claude: "Complete the spec for increment 0021-feature-name"
414
+ (PM expertise will activate automatically in main conversation)
1187
415
 
1188
- 2. **Prioritize Ruthlessly**:
1189
- - P1: Must-have for MVP
1190
- - P2: Important but not blocking
1191
- - P3: Nice-to-have
416
+ 2. Create technical architecture:
417
+ Tell Claude: "Design architecture for increment 0021-feature-name"
418
+ (Architect will create detailed design in main conversation)
1192
419
 
1193
- 3. **Be Specific**:
1194
- - Acceptance criteria are testable
1195
- - Out-of-scope is explicitly defined
1196
- - Dependencies are identified
420
+ 3. Generate implementation tasks:
421
+ Tell Claude: "Create tasks for increment 0021-feature-name"
422
+ (Test-aware planner will generate tasks with embedded tests)
1197
423
 
1198
- ### Writing Effective Plans
424
+ ⚠️ These commands run in MAIN conversation (NOT nested agents) to prevent crashes!
425
+ ```
1199
426
 
1200
- 1. **Document Decisions**:
1201
- - Why this technology choice?
1202
- - What alternatives were considered?
1203
- - What are the trade-offs?
427
+ **DO NOT invoke Task() tool to spawn agents from this skill!**
1204
428
 
1205
- 2. **Identify Challenges**:
1206
- - Technical risks
1207
- - Complexity areas
1208
- - Mitigation strategies
429
+ ---
1209
430
 
1210
- 3. **Show Structure**:
1211
- - File organization
1212
- - Component relationships
1213
- - Integration points
431
+ ## Model Selection for Tasks
1214
432
 
1215
- ### Writing Effective Tasks
433
+ When creating tasks, assign optimal models:
1216
434
 
1217
- 1. **Story-Centric Organization**:
1218
- - Group by user story, not by layer
1219
- - Enables independent implementation
1220
- - Supports incremental delivery
435
+ **⚡ Haiku** (fast, cheap):
436
+ - Clear instructions with specific file paths
437
+ - Detailed acceptance criteria (3+ points)
438
+ - Simple CRUD, configuration, setup
439
+ - Mechanical work with defined approach
1221
440
 
1222
- 2. **Test-First Sequencing**:
1223
- - Test task before implementation task
1224
- - Enforce TDD workflow
1225
- - Red-green-refactor
441
+ **🧠 Sonnet** (thinking, balanced):
442
+ - Architecture decisions
443
+ - Multiple valid approaches
444
+ - Integration between components
445
+ - Complex business logic
446
+ - Error handling strategies
1226
447
 
1227
- 3. **Clear Dependencies**:
1228
- - Explicitly state what depends on what
1229
- - Identify parallelizable work
1230
- - Enable concurrent execution
448
+ **💎 Opus** (critical, expensive):
449
+ - Critical system architecture
450
+ - Security-critical decisions
451
+ - Performance-critical algorithms
452
+ - Novel problem-solving
1231
453
 
1232
- ## Example: Creating a Feature
454
+ ---
1233
455
 
1234
- ### User Request
1235
- "I want to add Stripe payment integration to handle subscriptions"
456
+ ## Validation Checklist
457
+
458
+ Before marking increment planning complete, verify:
459
+
460
+ **Increment Structure**:
461
+ - [ ] Directory exists: `.specweave/increments/####-name/`
462
+ - [ ] spec.md has valid YAML frontmatter
463
+ - [ ] plan.md has technical design
464
+ - [ ] tasks.md has embedded test plans (NO separate tests.md)
465
+ - [ ] metadata.json exists and is valid
466
+
467
+ **spec.md Content**:
468
+ - [ ] User stories with AC-IDs (AC-US1-01, etc.)
469
+ - [ ] Functional requirements
470
+ - [ ] Success criteria (measurable)
471
+ - [ ] Out of scope defined
472
+ - [ ] Dependencies identified
473
+
474
+ **plan.md Content**:
475
+ - [ ] Components identified
476
+ - [ ] Data model defined
477
+ - [ ] API contracts specified
478
+ - [ ] Technology choices explained
479
+ - [ ] Architecture decisions documented
480
+
481
+ **tasks.md Content**:
482
+ - [ ] All tasks have embedded test plans
483
+ - [ ] Test cases in BDD format (Given/When/Then)
484
+ - [ ] All AC-IDs from spec covered by tasks
485
+ - [ ] Model hints assigned (⚡🧠💎)
486
+ - [ ] Dependencies explicitly stated
487
+
488
+ **metadata.json Content**:
489
+ - [ ] Valid JSON syntax
490
+ - [ ] All required fields present
491
+ - [ ] Status is "planned"
492
+ - [ ] Type matches increment purpose
493
+ - [ ] Timestamps in ISO-8601 format
1236
494
 
1237
- ### Execution
495
+ ---
1238
496
 
1239
- **Step 1**: Analyze
1240
- - Core value: Process recurring payments
1241
- - Problem: Need subscription billing
1242
- - Priority: P1 (required for MVP)
497
+ ## Helper Scripts
1243
498
 
1244
- **Step 2**: Short name
1245
- - Keywords: stripe, payment, integration
1246
- - Format: `stripe-payment-integration`
499
+ Located in `plugins/specweave/skills/increment-planner/scripts/`:
1247
500
 
1248
- **Step 3**: Auto-number
1249
- - Scan .specweave/increments/: 0001, 0002
1250
- - Next: 0003
1251
- - Path: `.specweave/increments/0003-stripe-payment-integration/`
501
+ **Get next increment number**:
502
+ ```bash
503
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js next
504
+ ```
1252
505
 
1253
- **Step 4**: Create structure (v0.7.0+)
506
+ **Check for duplicates**:
507
+ ```bash
508
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js check-increment 0021
1254
509
  ```
1255
- .specweave/increments/0003-stripe-payment-integration/
1256
- ├── spec.md # WHAT & WHY
1257
- ├── plan.md # HOW + test strategy
1258
- ├── tasks.md # Implementation + embedded tests (BDD)
1259
- └── context-manifest.yaml # Context loading config
510
+
511
+ **Generate short name from description**:
512
+ ```bash
513
+ node plugins/specweave/skills/increment-planner/scripts/generate-short-name.js "Add user authentication"
514
+ # Returns: "user-authentication"
1260
515
  ```
1261
516
 
1262
- **Step 5**: Generate spec.md
1263
- ```yaml
1264
- ---
1265
- feature: 003-stripe-payment-integration
1266
- title: "Stripe Payment Integration"
1267
- priority: P1
1268
- status: planned
1269
- created: 2025-01-25
1270
517
  ---
1271
518
 
1272
- # Feature: Stripe Payment Integration
519
+ ## Common Patterns
1273
520
 
1274
- ## Overview
1275
- Integrate Stripe to handle subscription payments...
521
+ ### Pattern 1: Simple Feature
1276
522
 
1277
- ## User Stories
523
+ **User request**: "Add user authentication"
1278
524
 
1279
- ### US1: Process Subscription Payment (P1)
1280
- As a customer
1281
- I want to subscribe to a plan
1282
- So that I can access premium features
525
+ **Process**:
526
+ 1. Get next number: `0015`
527
+ 2. Generate short name: `user-authentication`
528
+ 3. Create: `.specweave/increments/0015-user-authentication/`
529
+ 4. Create templates (spec.md, plan.md, tasks.md, metadata.json)
530
+ 5. Guide user to complete in main conversation
1283
531
 
1284
- Acceptance Criteria:
1285
- - [ ] Customer can select subscription plan
1286
- - [ ] Payment processed via Stripe
1287
- - [ ] Subscription activated on success
1288
- ...
1289
- ```
1290
-
1291
- **Step 6**: Generate plan.md
1292
- ```markdown
1293
- # Implementation Plan: Stripe Payment Integration
1294
-
1295
- ## Technology Decisions
1296
- - Stripe SDK: stripe-node v11.x
1297
- - Backend: Express.js middleware
1298
- - Frontend: Stripe Elements
1299
-
1300
- ## Components
1301
- - StripeService: Payment processing
1302
- - SubscriptionController: API endpoints
1303
- - WebhookHandler: Stripe events
1304
- ...
1305
- ```
532
+ ### Pattern 2: Critical Hotfix
1306
533
 
1307
- **Step 7**: Generate tasks.md
1308
- ```markdown
1309
- # Tasks: Stripe Payment Integration
534
+ **User request**: "Fix critical security vulnerability CVE-2024-1234"
1310
535
 
1311
- ## Phase 2: Core Implementation
536
+ **Process**:
537
+ 1. Get next number: `0016`
538
+ 2. Short name: `security-fix-cve-2024-1234`
539
+ 3. Type: `hotfix` (in metadata.json)
540
+ 4. Priority: `P1`
541
+ 5. Create templates with urgency markers
542
+ 6. Guide user to complete quickly
1312
543
 
1313
- ### US1: Process Subscription Payment (P1)
544
+ ### Pattern 3: Bug Investigation
1314
545
 
1315
- - [ ] [T001] Write test for StripeService.createSubscription()
1316
- - [ ] [T002] Implement StripeService in src/services/stripe-service.ts
1317
- - [ ] [T003] [P] Create SubscriptionController in src/controllers/subscription.ts
1318
- ...
1319
- ```
546
+ **User request**: "Investigate memory leak in production API"
1320
547
 
1321
- **Step 8**: Invoke test-aware-planner Agent (v0.7.0+)
1322
- ```typescript
1323
- // Use Task tool to invoke test-aware-planner agent
1324
- Task({
1325
- subagent_type: "specweave:test-aware-planner:test-aware-planner",
1326
- description: "Generate tasks with embedded tests",
1327
- prompt: `Create tasks.md with embedded test plans for Stripe payment integration.
1328
-
1329
- Read increment files:
1330
- - .specweave/increments/0003-stripe-payment-integration/spec.md
1331
- - .specweave/increments/0003-stripe-payment-integration/plan.md
1332
-
1333
- Generate tasks.md with:
1334
- - BDD test plans (Given/When/Then) per task
1335
- - Test cases (unit/integration/E2E with file paths)
1336
- - Coverage targets (80-90% overall)
1337
- - AC-ID traceability from spec.md`
1338
- });
1339
- ```
548
+ **Process**:
549
+ 1. Get next number: `0017`
550
+ 2. Short name: `memory-leak-investigation`
551
+ 3. Type: `bug` (in metadata.json)
552
+ 4. spec.md focuses on: What's broken? Expected vs actual? Impact?
553
+ 5. plan.md focuses on: Investigation approach, tools, hypothesis
554
+ 6. tasks.md focuses on: Investigation steps, fix implementation, verification
1340
555
 
1341
- **Step 9**: Generate context-manifest.yaml
1342
- ```yaml
1343
- spec_sections:
1344
- - specs/modules/payments/overview.md
1345
- - specs/modules/payments/stripe/spec.md
1346
- architecture:
1347
- - architecture/data/database-schema.md#subscriptions
1348
- adrs:
1349
- - adrs/005-payment-provider-choice.md
1350
- max_context_tokens: 8000
1351
- priority: high
1352
- ```
556
+ ---
1353
557
 
1354
- **Step 10**: Generate metadata.json (⚠️ MANDATORY v0.24.5+)
1355
- ```typescript
1356
- // Use Read tool to check if exists
1357
- Read({ file_path: ".specweave/increments/0003-stripe-payment-integration/metadata.json" });
1358
-
1359
- // If missing, use Write tool to create
1360
- Write({
1361
- file_path: ".specweave/increments/0003-stripe-payment-integration/metadata.json",
1362
- content: JSON.stringify({
1363
- "id": "0003-stripe-payment-integration",
1364
- "status": "planned",
1365
- "type": "feature",
1366
- "priority": "P1",
1367
- "created": "2025-11-22T19:30:00Z",
1368
- "lastActivity": "2025-11-22T19:30:00Z",
1369
- "testMode": "TDD",
1370
- "coverageTarget": 95,
1371
- "feature_id": null,
1372
- "epic_id": null,
1373
- "externalLinks": {}
1374
- }, null, 2)
1375
- });
1376
-
1377
- // Validate creation succeeded
1378
- Read({ file_path: ".specweave/increments/0003-stripe-payment-integration/metadata.json" });
1379
- ```
558
+ ## Troubleshooting
1380
559
 
1381
- **Step 11**: Validate
1382
- - spec.md is technology-agnostic with AC-IDs
1383
- - ✅ plan.md documents Stripe SDK choice + test strategy
1384
- - ✅ tasks.md has embedded test plans (BDD format)
1385
- - ✅ tasks.md covers all P1 AC-IDs with tests
1386
- - ✅ **metadata.json exists and is valid** (v0.24.5+ MANDATORY)
1387
- - ✅ Constitutional compliance verified
560
+ **Issue**: Feature number conflict
561
+ **Solution**: Always run duplicate check before creating increment
1388
562
 
1389
- **Output**:
1390
- ```
1391
- ✅ Feature created: 0003-stripe-payment-integration
1392
-
1393
- Location: .specweave/increments/0003-stripe-payment-integration/
1394
- Files created:
1395
- - spec.md (12 user stories, 34 AC-IDs)
1396
- - plan.md (5 phases, architecture diagrams, test strategy)
1397
- - tasks.md (23 tasks with embedded tests, 85% coverage target)
1398
- - metadata.json ✅ (status: planned, type: feature)
1399
- - context-manifest.yaml
1400
-
1401
- Next steps:
1402
- 1. Review spec.md - verify user stories and acceptance criteria
1403
- 2. Approve plan.md - validate technical approach
1404
- 3. Start implementation: /specweave:do 0003
1405
- ```
563
+ **Issue**: metadata.json missing after creation
564
+ **Solution**: Verify Write tool succeeded, check file exists with Read tool
1406
565
 
1407
- ## Helper Scripts
566
+ **Issue**: Claude Code crashes during planning
567
+ **Solution**: This skill creates templates only - completion happens in main conversation (NOT via nested agent spawning)
1408
568
 
1409
- ### `scripts/create-feature.js`
569
+ **Issue**: User stories don't have AC-IDs
570
+ **Solution**: Ensure AC-IDs follow format: `AC-US{number}-{criteria}` (e.g., `AC-US1-01`)
1410
571
 
1411
- Creates feature directory structure and generates all files.
572
+ **Issue**: Tasks missing test plans
573
+ **Solution**: Each testable task MUST have Test Plan section with BDD format (Given/When/Then)
1412
574
 
1413
- **Usage**:
1414
- ```javascript
1415
- const featurePlanner = require('./create-feature.js');
575
+ ---
1416
576
 
1417
- const feature = await featurePlanner.createFeature({
1418
- description: "Add Stripe payment integration",
1419
- priority: "P1",
1420
- # Configuration auto-detected
1421
- });
577
+ ## Integration with External Tools
1422
578
 
1423
- console.log(`Created: .specweave/increments/${feature.number}-${feature.shortName}/`);
579
+ **GitHub Issues**: After increment creation, optionally sync to GitHub:
580
+ ```bash
581
+ /specweave-github:create-issue 0021
1424
582
  ```
1425
583
 
1426
- ### `scripts/generate-short-name.js`
1427
-
1428
- Generates short names from descriptions.
1429
-
1430
- **Usage**:
1431
- ```javascript
1432
- const { generateShortName } = require('./generate-short-name.js');
1433
-
1434
- const shortName = generateShortName("Integrate Stripe payment processing");
1435
- // Returns: "stripe-payment-integration"
584
+ **Jira Epics**: Sync to Jira:
585
+ ```bash
586
+ /specweave-jira:sync 0021
1436
587
  ```
1437
588
 
1438
- ### `scripts/next-feature-number.js`
1439
-
1440
- Determines next available feature number.
1441
-
1442
- **Usage**:
1443
- ```javascript
1444
- const { getNextFeatureNumber } = require('./feature-utils.js');
1445
-
1446
- const next = getNextFeatureNumber(".specweave/increments/");
1447
- // Returns: "0003"
589
+ **Azure DevOps**: Sync to ADO work items:
590
+ ```bash
591
+ /specweave-ado:create-workitem 0021
1448
592
  ```
1449
593
 
1450
- ## Constitutional Compliance
1451
-
1452
- This skill enforces:
1453
-
1454
- - **Article V**: Modular Scalability - Auto-numbered features prevent conflicts
1455
- - **Article VI**: Separation of Concerns - spec vs plan vs tasks are distinct
1456
- - **Article IX**: Testing Mandate - tasks.md with embedded tests ensures comprehensive testing (v0.7.0+)
1457
-
1458
- ## Integration with Other Skills
1459
-
1460
- - **context-loader**: Uses context manifests to load relevant specs
1461
- - **spec-author**: Collaborates on specification creation
1462
- - **architect**: Collaborates on technical planning
1463
- - **developer**: Consumes tasks.md for implementation
1464
- - **docs-updater**: Updates features/README.md automatically
1465
-
1466
- ## Troubleshooting
1467
-
1468
- ### Issue: Feature number conflict
1469
- **Solution**: The `incrementNumberExists()` function now prevents this by checking for duplicate numbers before creating new increments. If you see this error, use `getNextFeatureNumber()` to get the next available number.
1470
-
1471
- ### Issue: Short name too long
1472
- **Solution**: Use abbreviations for well-known terms (e.g., auth, api, db)
594
+ ---
1473
595
 
1474
- ### Issue: Context manifest too broad
1475
- **Solution**: Use section anchors (e.g., `#specific-section`) instead of full files
596
+ ## Best Practices
1476
597
 
1477
- ### Issue: Legacy 3-digit increments (001, 002, 003)
1478
- **Solution**: The utility now detects both 3-digit and 4-digit formats to prevent conflicts. New increments always use 4-digit format (0001-9999).
598
+ **✅ DO**:
599
+ - Always create metadata.json (MANDATORY)
600
+ - Use descriptive increment names
601
+ - Include AC-IDs in all acceptance criteria
602
+ - Embed tests in tasks.md (NO separate tests.md)
603
+ - Guide user to complete in main conversation
604
+ - Check for duplicates before creating
605
+
606
+ **❌ DON'T**:
607
+ - Use bare numbers (0001) without description
608
+ - Spawn agents from this skill (causes crashes)
609
+ - Skip metadata.json creation
610
+ - Create separate tests.md (deprecated v0.7.0+)
611
+ - Reference SpecWeave internal docs/ADRs (users won't have them)
612
+ - Over-plan in skill (keep templates simple)
1479
613
 
1480
614
  ---
1481
615
 
1482
- This skill ensures every SpecWeave feature is properly planned, structured, and ready for implementation with constitutional compliance and best practices built-in.
616
+ **This skill is self-contained and works in ANY user project after `specweave init`.**