specweave 0.26.4 β†’ 0.26.5

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 (28) hide show
  1. package/CLAUDE.md +120 -0
  2. package/dist/src/core/increment/increment-reopener.d.ts.map +1 -1
  3. package/dist/src/core/increment/increment-reopener.js +13 -14
  4. package/dist/src/core/increment/increment-reopener.js.map +1 -1
  5. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  6. package/dist/src/core/increment/metadata-manager.js +16 -0
  7. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  8. package/dist/src/core/increment/status-change-sync-trigger.d.ts +85 -0
  9. package/dist/src/core/increment/status-change-sync-trigger.d.ts.map +1 -0
  10. package/dist/src/core/increment/status-change-sync-trigger.js +137 -0
  11. package/dist/src/core/increment/status-change-sync-trigger.js.map +1 -0
  12. package/dist/src/core/increment/sync-circuit-breaker.d.ts +64 -0
  13. package/dist/src/core/increment/sync-circuit-breaker.d.ts.map +1 -0
  14. package/dist/src/core/increment/sync-circuit-breaker.js +95 -0
  15. package/dist/src/core/increment/sync-circuit-breaker.js.map +1 -0
  16. package/dist/src/core/living-docs/living-docs-sync.d.ts +12 -0
  17. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
  18. package/dist/src/core/living-docs/living-docs-sync.js +114 -18
  19. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
  20. package/package.json +2 -2
  21. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +16 -0
  22. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  23. package/plugins/specweave/skills/brownfield-analyzer/SKILL.md +267 -868
  24. package/plugins/specweave/skills/increment-planner/SKILL.md +337 -1253
  25. package/plugins/specweave/skills/role-orchestrator/SKILL.md +293 -969
  26. package/plugins/specweave-docs/skills/technical-writing/SKILL.md +333 -839
  27. package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +269 -749
  28. package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +318 -810
@@ -5,1141 +5,335 @@ 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**:
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": "TDD",
105
+ "coverageTarget": 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
+ ### 4. Increment Structure
452
113
 
453
- #### Increment Files (Temporary Implementation Tracker) βœ…
114
+ **Complete directory structure**:
454
115
  ```
455
116
  .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
117
+ β”œβ”€β”€ spec.md # WHAT & WHY (user stories, acceptance criteria)
118
+ β”œβ”€β”€ plan.md # HOW (technical design, architecture)
119
+ β”œβ”€β”€ tasks.md # STEPS (implementation tasks with embedded tests)
120
+ └── metadata.json # Metadata (MANDATORY)
464
121
  ```
465
122
 
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)
123
+ **NO separate tests.md** - tests embedded in tasks.md (v0.7.0+)
471
124
 
472
125
  ---
473
126
 
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
127
+ ## Workflow (Safe, Self-Contained)
553
128
 
554
- 2. **Format**:
555
- - Lowercase
556
- - Hyphen-separated
557
- - Max 50 characters
558
- - Example: `stripe-payment-integration` from "Integrate Stripe payment processing"
129
+ ### STEP 1: Get Next Increment Number
559
130
 
560
- 3. **Validate**:
561
- - Check for existing features with similar names
562
- - Ensure uniqueness
563
- - Avoid abbreviations unless well-known
564
-
565
- ### Step 3: Auto-Number Feature
566
-
567
- Determine the next feature number:
568
-
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
574
-
575
- 2. **Increment**:
576
- - Add 1 to highest number
577
- - Zero-pad to 4 digits (e.g., 0001, 0002, ..., 0010, 0011, ..., 0999, 1000, ..., 9999)
578
-
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
583
-
584
- 4. **Create Path**:
585
- - Format: `.specweave/increments/0001-short-name/`
586
- - Example: `.specweave/increments/0003-stripe-payment-integration/`
131
+ Use helper script:
132
+ ```bash
133
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js next
134
+ # Returns: "0021"
135
+ ```
587
136
 
588
- ### Step 4: Create Feature Structure
137
+ Or manually scan:
138
+ ```bash
139
+ ls -1 .specweave/increments/ | grep -E '^[0-9]{4}-' | sort | tail -1
140
+ # Get highest number, add 1
141
+ ```
589
142
 
590
- Generate the complete feature directory with all required files:
143
+ ### STEP 2: Check for Duplicates
591
144
 
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
145
+ ```bash
146
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js check-increment 0021
147
+ # If exists: STOP and inform user
599
148
  ```
600
149
 
601
- **v0.7.0 Change**: tests.md eliminated - tests are now embedded in each task in tasks.md
150
+ ### STEP 3: Create Directory Structure
602
151
 
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`)
152
+ ```bash
153
+ mkdir -p .specweave/increments/0021-feature-name
154
+ ```
608
155
 
609
- ### Step 5: Generate spec.md
156
+ ### STEP 4: Create spec.md Template
610
157
 
611
- **Purpose**: Define WHAT this feature does and WHY it's needed.
158
+ Create `.specweave/increments/0021-feature-name/spec.md`:
612
159
 
613
- **Structure**:
614
- ```yaml
160
+ ```markdown
615
161
  ---
616
- feature: 0001-short-name
617
- title: "Human-Readable Feature Title"
618
- priority: P1 | P2 | P3
162
+ increment: 0021-feature-name
163
+ title: "Feature Name"
164
+ type: feature
165
+ priority: P1
619
166
  status: planned
620
- created: YYYY-MM-DD
167
+ created: 2025-11-24
168
+ structure: user-stories
169
+ test_mode: TDD
170
+ coverage_target: 95
621
171
  ---
622
172
 
623
173
  # Feature: [Title]
624
174
 
625
175
  ## Overview
626
- [High-level description of the feature]
627
176
 
628
- ## User Value
629
- [Why this feature matters to users]
177
+ [High-level description - WHAT this feature does and WHY it's needed]
630
178
 
631
179
  ## User Stories
632
180
 
633
- ### US1: [Title] (P1)
181
+ ### US-001: [Story Title] (P1)
182
+
634
183
  **As a** [user type]
635
184
  **I want** [goal]
636
185
  **So that** [benefit]
637
186
 
638
187
  **Acceptance Criteria**:
639
- - [ ] [Specific, measurable criterion]
640
- - [ ] [Another criterion]
188
+ - [ ] **AC-US1-01**: [Specific, testable criterion]
189
+ - [ ] **AC-US1-02**: [Another criterion]
190
+
191
+ ### US-002: [Story Title] (P2)
641
192
 
642
- ### US2: [Title] (P2)
643
- ...
193
+ [Repeat structure]
644
194
 
645
195
  ## Functional Requirements
646
196
 
647
197
  ### FR-001: [Requirement]
648
198
  [Detailed description]
649
199
 
650
- ### FR-002: [Requirement]
651
- ...
652
-
653
200
  ## 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
201
 
755
- Files:
756
- β€’ spec.md (user stories, acceptance criteria)
757
- β€’ plan.md (technical architecture)
758
- β€’ tasks.md (implementation steps with embedded tests)
202
+ [Measurable outcomes - metrics, KPIs]
759
203
 
760
- πŸ”— External PM Tool Sync:
761
- Tool: GitHub Issues
762
- Plugin: specweave-github βœ… Installed
204
+ ## Out of Scope
763
205
 
764
- Creating GitHub issue...
765
- βœ… Issue #42 created: "Increment 0007: User Authentication"
766
- URL: https://github.com/myorg/myapp/issues/42
206
+ [What this explicitly does NOT include]
767
207
 
768
- Auto-sync enabled:
769
- β€’ Progress updates posted after each task completion
770
- β€’ Issue closed automatically when increment done
208
+ ## Dependencies
771
209
 
772
- Next steps:
773
- 1. Review spec.md - verify user stories
774
- 2. Approve plan.md - validate architecture
775
- 3. Start work: /specweave:do
210
+ [Other features or systems this depends on]
776
211
  ```
777
212
 
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
213
+ ### STEP 5: Create plan.md Template
783
214
 
784
- ### Step 7: Generate plan.md
215
+ Create `.specweave/increments/0021-feature-name/plan.md`:
785
216
 
786
- **Purpose**: Define HOW to implement the feature technically.
787
-
788
- **Structure**:
789
217
  ```markdown
790
218
  # Implementation Plan: [Feature Title]
791
219
 
792
220
  ## Overview
221
+
793
222
  [Technical summary of implementation approach]
794
223
 
795
224
  ## Architecture
796
225
 
797
226
  ### Components
798
- [List major components to build/modify]
227
+ - [Component 1]: [Purpose]
228
+ - [Component 2]: [Purpose]
799
229
 
800
230
  ### Data Model
801
- [Entities, relationships, schema changes]
231
+ - [Entity 1]: [Fields, relationships]
232
+ - [Entity 2]: [Fields, relationships]
802
233
 
803
234
  ### API Contracts
804
- [Endpoints, methods, request/response formats]
805
-
806
- ### Integration Points
807
- [External services, internal modules]
235
+ - `POST /api/resource`: [Purpose, request/response]
236
+ - `GET /api/resource/:id`: [Purpose, request/response]
808
237
 
809
- ## Technology Decisions
238
+ ## Technology Stack
810
239
 
811
- ### Technology Stack
812
- - [Language/framework]
813
- - [Libraries]
814
- - [Tools]
240
+ - **Language/Framework**: [Choice]
241
+ - **Libraries**: [List]
242
+ - **Tools**: [List]
815
243
 
816
- ### ADRs Required
817
- - [List architecture decisions to document]
244
+ **Architecture Decisions**:
245
+ - [Decision 1]: [Why this choice? Alternatives considered?]
246
+ - [Decision 2]: [Rationale]
818
247
 
819
- ## Implementation Approach
248
+ ## Implementation Phases
820
249
 
821
250
  ### Phase 1: Foundation
822
- [Setup, infrastructure, base components]
251
+ - [Setup, infrastructure, base components]
823
252
 
824
253
  ### Phase 2: Core Functionality
825
- [Primary features from P1 user stories]
254
+ - [Primary features from P1 user stories]
826
255
 
827
256
  ### Phase 3: Enhancement
828
- [P2 features and optimizations]
257
+ - [P2 features and optimizations]
829
258
 
830
- ### Phase 4: Polish
831
- [P3 features, error handling, edge cases]
259
+ ## Testing Strategy
260
+
261
+ [High-level testing approach - details in tasks.md]
832
262
 
833
263
  ## Technical Challenges
834
264
 
835
265
  ### Challenge 1: [Description]
836
266
  **Solution**: [Approach]
837
- **Risk**: [Mitigation strategy]
838
-
839
- ## File Structure
840
- ```
841
- [Show directory structure of code to create/modify]
842
- ```
843
-
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]
267
+ **Risk**: [Mitigation]
855
268
  ```
856
269
 
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
270
+ ### STEP 6: Create tasks.md Template
864
271
 
865
- **Purpose**: Break down implementation into executable steps with intelligent model selection.
272
+ Create `.specweave/increments/0021-feature-name/tasks.md`:
866
273
 
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
274
  ```markdown
874
275
  # Tasks: [Feature Title]
875
276
 
876
277
  ## Task Notation
877
278
 
878
- - `[T###]`: Sequential task ID
879
- - `[P]`: Parallelizable (no file conflicts)
880
- - `[US#]`: User story reference
279
+ - `[T###]`: Task ID
280
+ - `[P]`: Parallelizable
881
281
  - `[ ]`: Not started
882
282
  - `[x]`: Completed
883
- - Model hints: ⚑ haiku (fast), 🧠 sonnet (thinking), πŸ’Ž opus (critical)
283
+ - Model hints: ⚑ haiku, 🧠 sonnet, πŸ’Ž opus
884
284
 
885
- ## Phase 1: Setup and Foundation
285
+ ## Phase 1: Setup
886
286
 
887
287
  - [ ] [T001] [P] ⚑ haiku - Initialize project structure
888
- - [ ] [T002] [P] ⚑ haiku - Setup testing framework
889
- - [ ] [T003] ⚑ haiku - Install dependencies
288
+ - [ ] [T002] ⚑ haiku - Setup testing framework
890
289
 
891
290
  ## Phase 2: Core Implementation
892
291
 
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)
292
+ ### US-001: [User Story Title] (P1)
902
293
 
903
- - [ ] [T009] ⚑ haiku - Write test for [feature]
904
- - [ ] [T010] 🧠 sonnet - Implement [feature] (complex logic)
905
- ...
294
+ #### T-003: Implement [component]
906
295
 
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
- ```
926
-
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
971
-
972
- **Description**: Create REST API endpoint for user authentication
296
+ **Description**: [What needs to be done]
973
297
 
974
298
  **References**: AC-US1-01, AC-US1-02
975
299
 
976
300
  **Implementation Details**:
977
- - Validate email format
978
- - Check password against bcrypt hash
979
- - Generate JWT token
980
- - Return 401 for invalid credentials
301
+ - [Step 1]
302
+ - [Step 2]
981
303
 
982
304
  **Test Plan**:
983
- - **File**: `tests/unit/auth-service.test.ts`
305
+ - **File**: `tests/unit/component.test.ts`
984
306
  - **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
307
+ - **TC-001**: [Test name]
308
+ - Given [precondition]
309
+ - When [action]
310
+ - Then [expected result]
311
+ - **TC-002**: [Test name]
312
+ - Given [precondition]
313
+ - When [action]
314
+ - Then [expected result]
997
315
 
998
316
  **Dependencies**: None
999
- **Estimated Effort**: 4 hours
1000
317
  **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
318
 
1041
- # Architecture Decision Records to reference
1042
- adrs:
1043
- - adrs/0001-[relevant-decision].md
319
+ ## Phase 3: Testing
1044
320
 
1045
- # Context budget (max tokens to load)
1046
- max_context_tokens: 10000
1047
-
1048
- # Priority level
1049
- priority: high | medium | low
1050
-
1051
- # Auto-refresh context on spec changes
1052
- auto_refresh: false
1053
-
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
- }
1102
- ```
1103
-
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
1111
-
1112
- **STEP 3: Validate creation succeeded**
1113
- ```
1114
- Use Read tool again:
1115
- file_path: .specweave/increments/{incrementId}/metadata.json
321
+ - [ ] [T050] Run integration tests
322
+ - [ ] [T051] Verify all acceptance criteria
1116
323
  ```
1117
324
 
1118
- If Read succeeds, output:
1119
- ```
1120
- βœ… metadata.json created successfully
1121
- Status: planned
1122
- Type: {type}
1123
- Ready for /specweave:do
1124
- ```
325
+ ### STEP 7: Create metadata.json (MANDATORY)
1125
326
 
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
327
+ Create `.specweave/increments/0021-feature-name/metadata.json`:
1133
328
 
1134
- **Example metadata.json**:
1135
329
  ```json
1136
330
  {
1137
- "id": "0001-user-authentication",
331
+ "id": "0021-feature-name",
1138
332
  "status": "planned",
1139
333
  "type": "feature",
1140
334
  "priority": "P1",
1141
- "created": "2025-11-22T19:30:00Z",
1142
- "lastActivity": "2025-11-22T19:30:00Z",
335
+ "created": "2025-11-24T12:00:00Z",
336
+ "lastActivity": "2025-11-24T12:00:00Z",
1143
337
  "testMode": "TDD",
1144
338
  "coverageTarget": 95,
1145
339
  "feature_id": null,
@@ -1148,335 +342,225 @@ Without metadata.json, the increment is **effectively broken**:
1148
342
  }
1149
343
  ```
1150
344
 
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:
345
+ **Use Write tool to create this file immediately after creating increment.**
1156
346
 
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)
347
+ ### STEP 8: Guide User to Complete Planning
1161
348
 
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
349
+ **Output this guidance to user**:
1169
350
 
1170
- 3. **Update Features Index**:
1171
- - Add feature to `features/README.md`
1172
- - Update current features list
1173
-
1174
- 4. **Notify User**:
1175
- - Feature number and path
1176
- - Next steps (review spec, approve plan)
1177
- - How to start implementation
351
+ ```
352
+ βœ… Increment structure created: .specweave/increments/0021-feature-name/
1178
353
 
1179
- ## Best Practices
354
+ πŸ“‹ Basic templates created:
355
+ β€’ spec.md (user stories, acceptance criteria)
356
+ β€’ plan.md (technical design, architecture)
357
+ β€’ tasks.md (implementation steps with test plans)
358
+ β€’ metadata.json (increment metadata)
1180
359
 
1181
- ### Writing Effective Specs
360
+ πŸš€ To complete planning, run these commands in sequence:
1182
361
 
1183
- 1. **Focus on User Value**:
1184
- - Start with "As a user, I want..."
1185
- - Explain WHY, not just WHAT
1186
- - Measurable success criteria
362
+ 1. Complete product specification:
363
+ Tell Claude: "Complete the spec for increment 0021-feature-name"
364
+ (PM expertise will activate automatically in main conversation)
1187
365
 
1188
- 2. **Prioritize Ruthlessly**:
1189
- - P1: Must-have for MVP
1190
- - P2: Important but not blocking
1191
- - P3: Nice-to-have
366
+ 2. Create technical architecture:
367
+ Tell Claude: "Design architecture for increment 0021-feature-name"
368
+ (Architect will create detailed design in main conversation)
1192
369
 
1193
- 3. **Be Specific**:
1194
- - Acceptance criteria are testable
1195
- - Out-of-scope is explicitly defined
1196
- - Dependencies are identified
370
+ 3. Generate implementation tasks:
371
+ Tell Claude: "Create tasks for increment 0021-feature-name"
372
+ (Test-aware planner will generate tasks with embedded tests)
1197
373
 
1198
- ### Writing Effective Plans
374
+ ⚠️ These commands run in MAIN conversation (NOT nested agents) to prevent crashes!
375
+ ```
1199
376
 
1200
- 1. **Document Decisions**:
1201
- - Why this technology choice?
1202
- - What alternatives were considered?
1203
- - What are the trade-offs?
377
+ **DO NOT invoke Task() tool to spawn agents from this skill!**
1204
378
 
1205
- 2. **Identify Challenges**:
1206
- - Technical risks
1207
- - Complexity areas
1208
- - Mitigation strategies
379
+ ---
1209
380
 
1210
- 3. **Show Structure**:
1211
- - File organization
1212
- - Component relationships
1213
- - Integration points
381
+ ## Model Selection for Tasks
1214
382
 
1215
- ### Writing Effective Tasks
383
+ When creating tasks, assign optimal models:
1216
384
 
1217
- 1. **Story-Centric Organization**:
1218
- - Group by user story, not by layer
1219
- - Enables independent implementation
1220
- - Supports incremental delivery
385
+ **⚑ Haiku** (fast, cheap):
386
+ - Clear instructions with specific file paths
387
+ - Detailed acceptance criteria (3+ points)
388
+ - Simple CRUD, configuration, setup
389
+ - Mechanical work with defined approach
1221
390
 
1222
- 2. **Test-First Sequencing**:
1223
- - Test task before implementation task
1224
- - Enforce TDD workflow
1225
- - Red-green-refactor
391
+ **🧠 Sonnet** (thinking, balanced):
392
+ - Architecture decisions
393
+ - Multiple valid approaches
394
+ - Integration between components
395
+ - Complex business logic
396
+ - Error handling strategies
1226
397
 
1227
- 3. **Clear Dependencies**:
1228
- - Explicitly state what depends on what
1229
- - Identify parallelizable work
1230
- - Enable concurrent execution
398
+ **πŸ’Ž Opus** (critical, expensive):
399
+ - Critical system architecture
400
+ - Security-critical decisions
401
+ - Performance-critical algorithms
402
+ - Novel problem-solving
1231
403
 
1232
- ## Example: Creating a Feature
404
+ ---
1233
405
 
1234
- ### User Request
1235
- "I want to add Stripe payment integration to handle subscriptions"
406
+ ## Validation Checklist
407
+
408
+ Before marking increment planning complete, verify:
409
+
410
+ **Increment Structure**:
411
+ - [ ] Directory exists: `.specweave/increments/####-name/`
412
+ - [ ] spec.md has valid YAML frontmatter
413
+ - [ ] plan.md has technical design
414
+ - [ ] tasks.md has embedded test plans (NO separate tests.md)
415
+ - [ ] metadata.json exists and is valid
416
+
417
+ **spec.md Content**:
418
+ - [ ] User stories with AC-IDs (AC-US1-01, etc.)
419
+ - [ ] Functional requirements
420
+ - [ ] Success criteria (measurable)
421
+ - [ ] Out of scope defined
422
+ - [ ] Dependencies identified
423
+
424
+ **plan.md Content**:
425
+ - [ ] Components identified
426
+ - [ ] Data model defined
427
+ - [ ] API contracts specified
428
+ - [ ] Technology choices explained
429
+ - [ ] Architecture decisions documented
430
+
431
+ **tasks.md Content**:
432
+ - [ ] All tasks have embedded test plans
433
+ - [ ] Test cases in BDD format (Given/When/Then)
434
+ - [ ] All AC-IDs from spec covered by tasks
435
+ - [ ] Model hints assigned (βš‘πŸ§ πŸ’Ž)
436
+ - [ ] Dependencies explicitly stated
437
+
438
+ **metadata.json Content**:
439
+ - [ ] Valid JSON syntax
440
+ - [ ] All required fields present
441
+ - [ ] Status is "planned"
442
+ - [ ] Type matches increment purpose
443
+ - [ ] Timestamps in ISO-8601 format
1236
444
 
1237
- ### Execution
445
+ ---
1238
446
 
1239
- **Step 1**: Analyze
1240
- - Core value: Process recurring payments
1241
- - Problem: Need subscription billing
1242
- - Priority: P1 (required for MVP)
447
+ ## Helper Scripts
1243
448
 
1244
- **Step 2**: Short name
1245
- - Keywords: stripe, payment, integration
1246
- - Format: `stripe-payment-integration`
449
+ Located in `plugins/specweave/skills/increment-planner/scripts/`:
1247
450
 
1248
- **Step 3**: Auto-number
1249
- - Scan .specweave/increments/: 0001, 0002
1250
- - Next: 0003
1251
- - Path: `.specweave/increments/0003-stripe-payment-integration/`
451
+ **Get next increment number**:
452
+ ```bash
453
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js next
454
+ ```
1252
455
 
1253
- **Step 4**: Create structure (v0.7.0+)
456
+ **Check for duplicates**:
457
+ ```bash
458
+ node plugins/specweave/skills/increment-planner/scripts/feature-utils.js check-increment 0021
1254
459
  ```
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
460
+
461
+ **Generate short name from description**:
462
+ ```bash
463
+ node plugins/specweave/skills/increment-planner/scripts/generate-short-name.js "Add user authentication"
464
+ # Returns: "user-authentication"
1260
465
  ```
1261
466
 
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
467
  ---
1271
468
 
1272
- # Feature: Stripe Payment Integration
469
+ ## Common Patterns
1273
470
 
1274
- ## Overview
1275
- Integrate Stripe to handle subscription payments...
471
+ ### Pattern 1: Simple Feature
1276
472
 
1277
- ## User Stories
473
+ **User request**: "Add user authentication"
1278
474
 
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
475
+ **Process**:
476
+ 1. Get next number: `0015`
477
+ 2. Generate short name: `user-authentication`
478
+ 3. Create: `.specweave/increments/0015-user-authentication/`
479
+ 4. Create templates (spec.md, plan.md, tasks.md, metadata.json)
480
+ 5. Guide user to complete in main conversation
1283
481
 
1284
- Acceptance Criteria:
1285
- - [ ] Customer can select subscription plan
1286
- - [ ] Payment processed via Stripe
1287
- - [ ] Subscription activated on success
1288
- ...
1289
- ```
482
+ ### Pattern 2: Critical Hotfix
1290
483
 
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
- ```
484
+ **User request**: "Fix critical security vulnerability CVE-2024-1234"
1306
485
 
1307
- **Step 7**: Generate tasks.md
1308
- ```markdown
1309
- # Tasks: Stripe Payment Integration
486
+ **Process**:
487
+ 1. Get next number: `0016`
488
+ 2. Short name: `security-fix-cve-2024-1234`
489
+ 3. Type: `hotfix` (in metadata.json)
490
+ 4. Priority: `P1`
491
+ 5. Create templates with urgency markers
492
+ 6. Guide user to complete quickly
1310
493
 
1311
- ## Phase 2: Core Implementation
494
+ ### Pattern 3: Bug Investigation
1312
495
 
1313
- ### US1: Process Subscription Payment (P1)
496
+ **User request**: "Investigate memory leak in production API"
1314
497
 
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
- ```
498
+ **Process**:
499
+ 1. Get next number: `0017`
500
+ 2. Short name: `memory-leak-investigation`
501
+ 3. Type: `bug` (in metadata.json)
502
+ 4. spec.md focuses on: What's broken? Expected vs actual? Impact?
503
+ 5. plan.md focuses on: Investigation approach, tools, hypothesis
504
+ 6. tasks.md focuses on: Investigation steps, fix implementation, verification
1320
505
 
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
- ```
1340
-
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
- ```
506
+ ---
1353
507
 
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
- ```
508
+ ## Troubleshooting
1380
509
 
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
510
+ **Issue**: Feature number conflict
511
+ **Solution**: Always run duplicate check before creating increment
1388
512
 
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
- ```
513
+ **Issue**: metadata.json missing after creation
514
+ **Solution**: Verify Write tool succeeded, check file exists with Read tool
1406
515
 
1407
- ## Helper Scripts
516
+ **Issue**: Claude Code crashes during planning
517
+ **Solution**: This skill creates templates only - completion happens in main conversation (NOT via nested agent spawning)
1408
518
 
1409
- ### `scripts/create-feature.js`
519
+ **Issue**: User stories don't have AC-IDs
520
+ **Solution**: Ensure AC-IDs follow format: `AC-US{number}-{criteria}` (e.g., `AC-US1-01`)
1410
521
 
1411
- Creates feature directory structure and generates all files.
522
+ **Issue**: Tasks missing test plans
523
+ **Solution**: Each testable task MUST have Test Plan section with BDD format (Given/When/Then)
1412
524
 
1413
- **Usage**:
1414
- ```javascript
1415
- const featurePlanner = require('./create-feature.js');
525
+ ---
1416
526
 
1417
- const feature = await featurePlanner.createFeature({
1418
- description: "Add Stripe payment integration",
1419
- priority: "P1",
1420
- # Configuration auto-detected
1421
- });
527
+ ## Integration with External Tools
1422
528
 
1423
- console.log(`Created: .specweave/increments/${feature.number}-${feature.shortName}/`);
529
+ **GitHub Issues**: After increment creation, optionally sync to GitHub:
530
+ ```bash
531
+ /specweave-github:create-issue 0021
1424
532
  ```
1425
533
 
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"
534
+ **Jira Epics**: Sync to Jira:
535
+ ```bash
536
+ /specweave-jira:sync 0021
1436
537
  ```
1437
538
 
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"
539
+ **Azure DevOps**: Sync to ADO work items:
540
+ ```bash
541
+ /specweave-ado:create-workitem 0021
1448
542
  ```
1449
543
 
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)
544
+ ---
1473
545
 
1474
- ### Issue: Context manifest too broad
1475
- **Solution**: Use section anchors (e.g., `#specific-section`) instead of full files
546
+ ## Best Practices
1476
547
 
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).
548
+ **βœ… DO**:
549
+ - Always create metadata.json (MANDATORY)
550
+ - Use descriptive increment names
551
+ - Include AC-IDs in all acceptance criteria
552
+ - Embed tests in tasks.md (NO separate tests.md)
553
+ - Guide user to complete in main conversation
554
+ - Check for duplicates before creating
555
+
556
+ **❌ DON'T**:
557
+ - Use bare numbers (0001) without description
558
+ - Spawn agents from this skill (causes crashes)
559
+ - Skip metadata.json creation
560
+ - Create separate tests.md (deprecated v0.7.0+)
561
+ - Reference SpecWeave internal docs/ADRs (users won't have them)
562
+ - Over-plan in skill (keep templates simple)
1479
563
 
1480
564
  ---
1481
565
 
1482
- This skill ensures every SpecWeave feature is properly planned, structured, and ready for implementation with constitutional compliance and best practices built-in.
566
+ **This skill is self-contained and works in ANY user project after `specweave init`.**