specweave 1.0.256 → 1.0.259

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 (113) hide show
  1. package/CLAUDE.md +56 -221
  2. package/README.md +31 -0
  3. package/bin/specweave.js +17 -0
  4. package/dist/src/adapters/README.md +4 -4
  5. package/dist/src/adapters/agents-md-generator.d.ts.map +1 -1
  6. package/dist/src/adapters/agents-md-generator.js +0 -2
  7. package/dist/src/adapters/agents-md-generator.js.map +1 -1
  8. package/dist/src/adapters/claude/README.md +3 -3
  9. package/dist/src/adapters/claude/adapter.js +3 -3
  10. package/dist/src/adapters/claude-md-generator.js +1 -1
  11. package/dist/src/adapters/claude-md-generator.js.map +1 -1
  12. package/dist/src/adapters/registry.yaml +1 -1
  13. package/dist/src/cli/commands/create-increment.d.ts +24 -0
  14. package/dist/src/cli/commands/create-increment.d.ts.map +1 -0
  15. package/dist/src/cli/commands/create-increment.js +53 -0
  16. package/dist/src/cli/commands/create-increment.js.map +1 -0
  17. package/dist/src/cli/commands/init.d.ts.map +1 -1
  18. package/dist/src/cli/commands/init.js +48 -31
  19. package/dist/src/cli/commands/init.js.map +1 -1
  20. package/dist/src/cli/commands/update.d.ts.map +1 -1
  21. package/dist/src/cli/commands/update.js +36 -0
  22. package/dist/src/cli/commands/update.js.map +1 -1
  23. package/dist/src/cli/helpers/init/directory-structure.d.ts.map +1 -1
  24. package/dist/src/cli/helpers/init/directory-structure.js +13 -1
  25. package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
  26. package/dist/src/cli/helpers/init/summary-banner.d.ts +11 -0
  27. package/dist/src/cli/helpers/init/summary-banner.d.ts.map +1 -1
  28. package/dist/src/cli/helpers/init/summary-banner.js +49 -3
  29. package/dist/src/cli/helpers/init/summary-banner.js.map +1 -1
  30. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  31. package/dist/src/cli/helpers/issue-tracker/index.js +0 -1
  32. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  33. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.d.ts.map +1 -1
  34. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js +6 -2
  35. package/dist/src/cli/helpers/issue-tracker/sync-config-writer.js.map +1 -1
  36. package/dist/src/core/ac-progress-sync.d.ts +13 -0
  37. package/dist/src/core/ac-progress-sync.d.ts.map +1 -1
  38. package/dist/src/core/ac-progress-sync.js +28 -0
  39. package/dist/src/core/ac-progress-sync.js.map +1 -1
  40. package/dist/src/core/config/types.d.ts +24 -1
  41. package/dist/src/core/config/types.d.ts.map +1 -1
  42. package/dist/src/core/config/types.js +6 -1
  43. package/dist/src/core/config/types.js.map +1 -1
  44. package/dist/src/core/doctor/checkers/project-structure-checker.d.ts +1 -0
  45. package/dist/src/core/doctor/checkers/project-structure-checker.d.ts.map +1 -1
  46. package/dist/src/core/doctor/checkers/project-structure-checker.js +53 -3
  47. package/dist/src/core/doctor/checkers/project-structure-checker.js.map +1 -1
  48. package/dist/src/core/fabric/security-scanner.d.ts.map +1 -1
  49. package/dist/src/core/fabric/security-scanner.js +70 -9
  50. package/dist/src/core/fabric/security-scanner.js.map +1 -1
  51. package/dist/src/core/increment/increment-utils.d.ts +6 -0
  52. package/dist/src/core/increment/increment-utils.d.ts.map +1 -1
  53. package/dist/src/core/increment/increment-utils.js +5 -0
  54. package/dist/src/core/increment/increment-utils.js.map +1 -1
  55. package/dist/src/core/living-docs/discovery.d.ts +2 -0
  56. package/dist/src/core/living-docs/discovery.d.ts.map +1 -1
  57. package/dist/src/core/living-docs/discovery.js +91 -17
  58. package/dist/src/core/living-docs/discovery.js.map +1 -1
  59. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts +5 -0
  60. package/dist/src/core/living-docs/intelligent-analyzer/index.d.ts.map +1 -1
  61. package/dist/src/core/living-docs/intelligent-analyzer/index.js +3 -3
  62. package/dist/src/core/living-docs/intelligent-analyzer/index.js.map +1 -1
  63. package/dist/src/core/living-docs/lsp-bootstrapper.d.ts +64 -0
  64. package/dist/src/core/living-docs/lsp-bootstrapper.d.ts.map +1 -0
  65. package/dist/src/core/living-docs/lsp-bootstrapper.js +118 -0
  66. package/dist/src/core/living-docs/lsp-bootstrapper.js.map +1 -0
  67. package/dist/src/core/project/project-service.d.ts +10 -1
  68. package/dist/src/core/project/project-service.d.ts.map +1 -1
  69. package/dist/src/core/project/project-service.js +37 -2
  70. package/dist/src/core/project/project-service.js.map +1 -1
  71. package/dist/src/core/universal-auto-create.d.ts +64 -0
  72. package/dist/src/core/universal-auto-create.d.ts.map +1 -0
  73. package/dist/src/core/universal-auto-create.js +228 -0
  74. package/dist/src/core/universal-auto-create.js.map +1 -0
  75. package/package.json +1 -1
  76. package/plugins/specweave/PLUGIN.md +0 -3
  77. package/plugins/specweave/commands/living-docs.md +0 -2
  78. package/plugins/specweave/hooks/stop-sync.sh +34 -5
  79. package/plugins/specweave/hooks/user-prompt-submit.sh +115 -326
  80. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +19 -5
  81. package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +14 -4
  82. package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +181 -0
  83. package/plugins/specweave/lib/hooks/sync-living-docs.js +4 -2
  84. package/plugins/specweave/scripts/skill-context.sh +160 -0
  85. package/plugins/specweave/skills/architect/SKILL.md +1 -1
  86. package/plugins/specweave/skills/archive-increments/SKILL.md +13 -3
  87. package/plugins/specweave/skills/auto/SKILL.md +92 -1038
  88. package/plugins/specweave/skills/do/SKILL.md +66 -1106
  89. package/plugins/specweave/skills/docs/SKILL.md +124 -56
  90. package/plugins/specweave/skills/done/SKILL.md +76 -1406
  91. package/plugins/specweave/skills/framework/SKILL.md +1 -1
  92. package/plugins/specweave/skills/increment/SKILL.md +1 -1
  93. package/plugins/specweave/skills/increment-planner/SKILL.md +29 -19
  94. package/plugins/specweave/skills/jobs/SKILL.md +52 -0
  95. package/plugins/specweave/skills/multi-project-spec-mapper/SKILL.md +1 -1
  96. package/plugins/specweave/skills/save/SKILL.md +51 -1372
  97. package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +1 -1
  98. package/plugins/specweave/skills/tdd-orchestrator/SKILL.md +1 -1
  99. package/plugins/specweave/skills/validate/SKILL.md +65 -848
  100. package/plugins/specweave-backend/skills/database-optimizer/SKILL.md +1 -1
  101. package/plugins/specweave-backend/skills/graphql/SKILL.md +1 -1
  102. package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +1 -1
  103. package/plugins/specweave-frontend/skills/frontend/SKILL.md +1 -1
  104. package/plugins/specweave-frontend/skills/frontend-architect/SKILL.md +1 -1
  105. package/plugins/specweave-frontend/skills/frontend-design/SKILL.md +1 -1
  106. package/plugins/specweave-frontend/skills/i18n-expert/SKILL.md +1 -1
  107. package/plugins/specweave-payments/skills/billing-automation/SKILL.md +1 -1
  108. package/plugins/specweave-testing/skills/accessibility-testing/SKILL.md +1 -1
  109. package/src/templates/CLAUDE.md.template +50 -356
  110. package/src/templates/config.json.template +5 -1
  111. package/plugins/specweave/commands/brownfield-analyzer.md +0 -408
  112. package/plugins/specweave/commands/brownfield-onboarder.md +0 -837
  113. package/plugins/specweave/commands/export-skills.md +0 -179
@@ -14,905 +14,122 @@ hooks:
14
14
 
15
15
  !`s="validate"; for d in .specweave/skill-memories .claude/skill-memories "$HOME/.claude/skill-memories"; do p="$d/$s.md"; [ -f "$p" ] && awk '/^## Learnings$/{ok=1;next}/^## /{ok=0}ok' "$p" && break; done 2>/dev/null; true`
16
16
 
17
+ ## Project Context
18
+
19
+ !`.specweave/scripts/skill-context.sh validate 2>/dev/null; true`
20
+
17
21
  You are helping the user validate a SpecWeave increment with optional AI-powered quality assessment.
18
22
 
19
23
  ## Usage
20
24
 
21
- ```bash
25
+ ```
22
26
  /sw:validate <increment-id> [--quality] [--export] [--fix] [--always]
23
27
  ```
24
28
 
25
- ## Arguments
26
-
27
- - `<increment-id>`: Required. Increment ID (e.g., "001", "0001", "1", "0042")
29
+ **Flags**: `--quality` (AI assessment) | `--export` (suggestions to tasks.md) | `--fix` (auto-fix HIGH issues) | `--always` (save quality preference)
28
30
 
29
- ## Flags
31
+ ## Two-Gate Validation System
30
32
 
31
- - `--quality`: **Run LLM-as-Judge gate** (AI quality assessment, ~2k tokens, 1-2 minutes)
32
- - `--export`: Export AI suggestions to tasks.md automatically
33
- - `--fix`: Auto-fix HIGH priority issues (experimental, requires confirmation)
33
+ - **Gate 1 (Rule-Based)**: Always runs, free, 130+ automated checks
34
+ - **Gate 2 (LLM-as-Judge)**: Optional (`--quality`), AI-powered, ~2K tokens
34
35
 
35
- ## Quality Gates
36
-
37
- This command implements a **two-gate validation system**:
38
-
39
- ```
40
- ┌─────────────────────────────────────────────────────────────┐
41
- │ GATE 1: Rule-Based Validation │
42
- │ (Always runs, FREE) │
43
- ├─────────────────────────────────────────────────────────────┤
44
- │ 130+ automated checks: │
45
- │ â€ĸ Structure (file existence, format) │
46
- │ â€ĸ Three-file canonical (ADR-0047 compliance) │
47
- │ â€ĸ Consistency (cross-document alignment) │
48
- │ â€ĸ Completeness (required sections) │
49
- │ â€ĸ Traceability (AC-ID linkage) │
50
- │ │
51
- │ Result: PASS (all checks) or FAIL (with specific errors) │
52
- └─────────────────────────────────────────────────────────────┘
53
- │
54
- â–ŧ
55
- ┌─────────────────────────────────────────────────────────────┐
56
- │ GATE 2: LLM-as-Judge │
57
- │ (Optional, --quality flag) │
58
- ├─────────────────────────────────────────────────────────────┤
59
- │ AI-powered evaluation using chain-of-thought reasoning: │
60
- │ â€ĸ 6 quality dimensions (clarity, testability, etc.) │
61
- │ â€ĸ Evidence-based scoring (0-100 per dimension) │
62
- │ â€ĸ Structured suggestions with code examples │
63
- │ â€ĸ Formal verdict (score + recommendations) │
64
- │ │
65
- │ Pattern: "LLM-as-Judge" (established AI/ML technique) │
66
- │ Cost: ~$0.02-0.05 per assessment │
67
- └─────────────────────────────────────────────────────────────┘
68
- ```
69
-
70
- **Why two gates?**
71
- - **Gate 1** catches structural issues (FREE, instant)
72
- - **Gate 2** catches semantic issues (paid, ~30 seconds)
73
- - Run Gate 1 first to avoid wasting tokens on invalid specs
36
+ Gate 1 catches structural issues first; Gate 2 catches semantic issues.
74
37
 
75
38
  ## Workflow
76
39
 
77
- ### Step 1: Parse and Validate Arguments
78
-
79
- 1. **Extract increment ID**:
80
- - Parse from command: `/sw:validate 001` → "001"
81
- - **Normalize increment ID**:
82
- - If ID contains dash (e.g., "0153-feature-name"), extract numeric portion before first dash → "0153"
83
- - Convert to 4-digit format: "1" → "0001", "153" → "0153"
84
- - Both formats work: `/sw:validate 0153` or `/sw:validate 0153-feature-name`
85
-
86
- 2. **Extract flags**:
87
- - Check for `--quality` flag
88
- - Check for `--export` flag
89
- - Check for `--fix` flag
90
- - Check for `--always` flag
91
-
92
- 3. **Validate increment exists**:
93
- - List directories in `.specweave/increments/`
94
- - Find matching increment (e.g., `0001-authentication`, `0001-auth`, etc.)
95
- - If not found: Show error with available increments
96
-
97
- **Example output if not found**:
98
- ```
99
- ❌ Error: Increment 0001 not found
100
-
101
- Available increments:
102
- â€ĸ 0002-core-enhancements
103
- â€ĸ 0003-payment-processing
104
- â€ĸ 0004-reporting-dashboard
40
+ ### Step 1: Parse Arguments
105
41
 
106
- Usage: /sw:validate-increment <id> [--quality] [--export] [--fix] [--always]
107
- ```
42
+ 1. Extract increment ID: normalize to 4-digit format ("1" -> "0001", "0153-feature-name" -> "0153")
43
+ 2. Extract flags: `--quality`, `--export`, `--fix`, `--always`
44
+ 3. Validate increment exists in `.specweave/increments/`. Show error with available increments if not found.
108
45
 
109
46
  ### Step 1.5: Sync AC Status
110
47
 
111
- **Before running validation, synchronize spec.md ACs with tasks.md completion status**:
48
+ Before validation, sync spec.md ACs with tasks.md completion status to prevent false positives:
112
49
 
113
50
  ```typescript
114
- import { ACStatusManager } from '../../../src/core/increment/ac-status-manager.js';
115
-
116
- // Sync ACs BEFORE validation to prevent false positives
117
- // This ensures spec.md ACs reflect actual task completion from tasks.md
118
- console.log('🔄 Syncing AC status before validation...');
119
51
  const acManager = new ACStatusManager(projectRoot);
120
52
  const acSyncResult = await acManager.syncACStatus(incrementId);
121
-
122
- if (acSyncResult.synced && acSyncResult.updated.length > 0) {
123
- console.log(`✅ Pre-validation sync: Updated ${acSyncResult.updated.length} ACs`);
124
- acSyncResult.updated.forEach(acId => console.log(` ${acId} → [x]`));
125
- } else {
126
- console.log('✅ AC status already in sync');
127
- }
128
53
  ```
129
54
 
130
- **Why this matters**:
131
- - Background hooks (`post-task-completion.sh`) run async and may not complete before validation
132
- - This explicit sync prevents "0 ACs checked" false positives
133
- - Idempotent: safe to call multiple times (no-op if already synced)
134
-
135
- ### Step 2: Run Rule-Based Validation (Always)
136
-
137
- Run 130+ validation rules across 7 categories:
138
-
139
- **CRITICAL: Always run structure validation FIRST to prevent duplicate task files**
140
-
141
- 1. **Structure Rules (5 checks)**:
142
- - Only ONE tasks.md file exists (no tasks-detailed.md, tasks-final.md)
143
- - Only allowed root files present (spec.md, plan.md, tasks.md, metadata.json, README.md)
144
- - Unknown files moved to subdirectories (reports/, scripts/, logs/)
145
- - No root-level pollution (analysis.md, summary.md moved to reports/)
146
- - Metadata.json structure valid
147
-
148
- 2. **Three-File Canonical Structure (10 checks)** - ADR-0047:
149
- - **tasks.md validations (CRITICAL)**:
150
- - ❌ Does NOT contain "**Acceptance Criteria**:" sections
151
- - ✅ MUST have "**Implementation**:" sections for each task
152
- - ✅ MUST have "**Test Plan (BDD)**" sections
153
- - ✅ MUST have **AC-IDs** references linking to spec.md
154
- - ❌ Does NOT contain "As a user..." user story language
155
- - **spec.md validations**:
156
- - ❌ Does NOT contain task IDs (T-001, T-002, etc.)
157
- - ❌ Does NOT contain technical class/file names
158
- - ✅ MUST have "## Acceptance Criteria" section
159
- - **plan.md validations**:
160
- - ❌ Does NOT contain "Acceptance Criteria" sections
161
- - ❌ Does NOT contain task checkboxes
162
-
163
- 3. **Consistency Rules (47 checks)**:
164
- - User stories in spec.md → sections in plan.md
165
- - Components in plan.md → tasks in tasks.md
166
- - Test cases (TC-0001) in spec.md → tests.md coverage
167
- - Cross-document consistency (IDs, priorities, dependencies)
168
-
169
- 4. **Completeness Rules (23 checks)**:
170
- - spec.md: Frontmatter, problem statement, user stories, acceptance criteria
171
- - plan.md: Architecture, components, data model, API contracts, security
172
- - tasks.md: Task IDs, descriptions, priorities, estimates
173
-
174
- 5. **Quality Rules (31 checks)**:
175
- - spec.md: Technology-agnostic, testable acceptance criteria
176
- - plan.md: Technical details, ADRs exist, security addressed
177
- - tasks.md: Actionable, reasonable estimates (<1 day)
178
-
179
- 6. **Traceability Rules (19 checks)**:
180
- - TC-0001 format, sequential numbering
181
- - ADR references exist
182
- - Diagram references valid
183
-
184
- 7. **AC Coverage & Traceability**:
185
- - All Acceptance Criteria have implementing tasks (0% uncovered)
186
- - All tasks link to valid User Stories (**User Story**: US-XXX)
187
- - All tasks link to valid Acceptance Criteria (**Satisfies ACs**: AC-USXX-YY)
188
- - No orphan tasks (tasks without AC linkage)
189
- - AC-Task traceability matrix builds successfully
190
- - Per-User Story coverage calculated
191
-
192
- **Display results**:
193
- ```
194
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
195
- VALIDATION RESULTS: Increment 0001-authentication
196
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
197
-
198
- ✅ Rule-Based Validation: PASSED (141/141 checks)
199
- ✓ Structure (5/5)
200
- ✓ Three-File Canonical (10/10) [ADR-0047]
201
- ✓ Consistency (47/47)
202
- ✓ Completeness (23/23)
203
- ✓ Quality (31/31)
204
- ✓ Traceability (19/19)
205
- ✓ AC Coverage & Traceability (6/6)
206
- â€ĸ 100% AC coverage (15/15 ACs covered)
207
- â€ĸ 0 orphan tasks
208
- â€ĸ All tasks linked to valid User Stories
209
-
210
- Files validated:
211
- â€ĸ spec.md (250 lines, 6 user stories)
212
- â€ĸ plan.md (480 lines, 8 components)
213
- â€ĸ tasks.md (42 tasks, P0-P2)
214
- â€ĸ tests.md (12 test cases, 85% coverage)
215
-
216
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
217
- ```
55
+ This is idempotent and prevents "0 ACs checked" false positives from async hooks.
218
56
 
219
- **If errors found**:
220
- ```
221
- ❌ Rule-Based Validation: FAILED (128/141 checks)
222
- ❌ Structure (3/5) - 2 CRITICAL ERRORS
223
- ❌ Three-File Canonical (7/10) - 3 CRITICAL ERRORS [ADR-0047]
224
- ✓ Consistency (45/47) - 2 errors
225
- ✓ Completeness (23/23)
226
- âš ī¸ Quality (28/31) - 3 warnings
227
- ✓ Traceability (19/19)
228
- ❌ AC Coverage & Traceability (3/6) - 3 ERRORS
229
- â€ĸ 73% AC coverage (11/15 ACs covered) - 4 uncovered
230
- â€ĸ 2 orphan tasks detected
231
- â€ĸ All US linkage valid
232
-
233
- CRITICAL STRUCTURE ERRORS (MUST FIX FIRST):
234
- ❌ Duplicate task files detected: tasks.md, tasks-detailed.md
235
- → Only ONE tasks.md allowed per increment
236
- → Move tasks-detailed.md to reports/tasks-detailed.md
237
- ❌ Unknown root-level file: analysis.md
238
- → Move to reports/ directory
239
-
240
- CRITICAL THREE-FILE VIOLATIONS (ADR-0047):
241
- 🚨 tasks.md:45 - Contains "**Acceptance Criteria**:" section
242
- → ACs belong in spec.md ONLY
243
- → Replace with "**Implementation**:" and add AC-ID references
244
- 🚨 tasks.md:78 - Task T-003 missing "**Implementation**:" section
245
- → Add checkable implementation steps
246
- 🚨 spec.md:102 - Contains task ID reference "T-001"
247
- → Tasks belong in tasks.md, use AC-IDs to link instead
248
-
249
- AC COVERAGE ERRORS (3):
250
- 🔴 4 Acceptance Criteria uncovered by tasks:
251
- → AC-US2-03: Real-time notification delivery (no implementing tasks)
252
- → AC-US3-01: API rate limiting (no implementing tasks)
253
- → AC-US3-05: Error handling for network failures (no implementing tasks)
254
- → AC-US4-02: Audit logging for security events (no implementing tasks)
255
- 🔴 2 Orphan tasks (no AC linkage):
256
- → T-008: Refactor authentication module (no **Satisfies ACs** field)
257
- → T-015: Update documentation (no **Satisfies ACs** field)
258
-
259
- ERRORS (2):
260
- 🔴 spec.md:45 - Missing acceptance criteria for US-003
261
- 🔴 Inconsistency: spec.md mentions "real-time updates" but plan.md doesn't address it
262
-
263
- WARNINGS (3):
264
- 🟡 Task T012 exceeds size guideline (5 days, should be <1 day)
265
- 🟡 No security considerations in plan.md
266
- 🟡 ADR-0005 referenced but doesn't exist (plan.md:89)
267
-
268
- Action required:
269
- 1. ❗ FIX STRUCTURE ERRORS FIRST (single source of truth violation)
270
- 2. 🚨 FIX THREE-FILE VIOLATIONS (ADR-0047 compliance):
271
- - Run refactoring script: .specweave/increments/XXXX/scripts/refactor-tasks-ac-to-implementation.sh
272
- - Or manually replace "**Acceptance Criteria**:" with "**Implementation**:"
273
- - Add "**AC-IDs**: AC-US-XX-YY" references to link tasks to spec.md
274
- 3. 🔴 FIX AC COVERAGE ERRORS (US-Task Linkage):
275
- - Create tasks for 4 uncovered ACs (AC-US2-03, AC-US3-01, AC-US3-05, AC-US4-02)
276
- - Add **Satisfies ACs** field to 2 orphan tasks (T-008, T-015)
277
- - Run: /sw:validate 0001 to verify 100% coverage
278
- 4. Fix missing acceptance criteria for US-003
279
- 5. Address "real-time updates" in plan.md or remove from spec.md
280
- 6. Consider breaking down T012 into smaller tasks
281
-
282
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
283
- ```
284
-
285
- ### Step 3: Determine If Quality Assessment Should Run
57
+ ### Step 2: Run Rule-Based Validation
286
58
 
287
- **Check in this order**:
59
+ Run 130+ checks across 7 categories. **Run structure validation FIRST.**
288
60
 
289
- 1. **If `--quality` flag provided**: Run quality assessment (skip prompt)
290
- 2. **Else**: Prompt user
61
+ | Category | Checks | Purpose |
62
+ |----------|--------|---------|
63
+ | Structure | 5 | Single tasks.md, allowed root files, metadata.json valid |
64
+ | Three-File Canonical (ADR-0047) | 10 | tasks.md has Implementation (not ACs), spec.md has no task IDs, plan.md has no AC sections |
65
+ | Consistency | 47 | Cross-document alignment (stories -> plan -> tasks -> tests) |
66
+ | Completeness | 23 | Required sections in spec.md, plan.md, tasks.md |
67
+ | Quality | 31 | Tech-agnostic spec, testable ACs, actionable tasks (<1 day) |
68
+ | Traceability | 19 | TC format, ADR refs, diagram refs |
69
+ | AC Coverage | 6 | All ACs have tasks, no orphan tasks, valid US linkage |
291
70
 
292
- **Prompt format** (if needed):
293
- ```
294
- 🤔 Run AI Quality Assessment? (Optional)
71
+ **Key three-file rules (ADR-0047)**:
72
+ - tasks.md: MUST have `**Implementation**:` and `**AC-IDs**:` references. Must NOT have `**Acceptance Criteria**:` or user story language.
73
+ - spec.md: MUST have `## Acceptance Criteria`. Must NOT have task IDs (T-001).
74
+ - plan.md: Must NOT have AC sections or task checkboxes.
295
75
 
296
- This will:
297
- â€ĸ Evaluate spec clarity, testability, edge cases
298
- â€ĸ Provide detailed improvement suggestions
299
- â€ĸ Use ~2,000 tokens (1-2 minutes)
300
- â€ĸ Cost: ~$0.05 (Claude Opus 4.5)
76
+ Display category pass/fail counts and AC coverage percentage.
301
77
 
302
- Your choice:
303
- [Y] Yes, assess quality
304
- [N] No, skip (default)
305
- [A] Always run (save to config)
78
+ ### Step 3: Determine Quality Assessment
306
79
 
307
- Choice: _
308
- ```
80
+ 1. If `--quality` flag: run quality assessment (skip prompt)
81
+ 2. Else: prompt user with Y/N/A (Always) choice
309
82
 
310
83
  ### Step 4: Run AI Quality Assessment (If Approved)
311
84
 
312
- **IMPORTANT**: Use the `increment-quality-judge-v2` **skill** (auto-activated) or CLI command:
313
-
314
- ```bash
315
- # Preferred: Use CLI command directly
316
- specweave qa 0001 --pre
317
-
318
- # The skill auto-activates when assessing quality
319
- # DO NOT spawn agents - use CLI instead
320
- ```
321
-
322
- Assessment parameters:
323
- - increment_id: "0001"
324
- - files: ["spec.md", "plan.md", "tests.md"]
325
- - dimensions: ["clarity", "testability", "completeness", "feasibility", "maintainability", "edge_cases"]
326
-
327
- **Quality judge evaluates 6 dimensions**:
328
-
329
- 1. **Clarity** (weight: 0.20)
330
- - Is problem statement clear?
331
- - Are objectives well-defined?
332
- - Is terminology consistent?
333
-
334
- 2. **Testability** (weight: 0.25)
335
- - Are acceptance criteria testable?
336
- - Can success be measured objectively?
337
- - Are edge cases identifiable?
338
-
339
- 3. **Completeness** (weight: 0.20)
340
- - All requirements addressed?
341
- - Error handling specified?
342
- - Non-functional requirements included?
343
-
344
- 4. **Feasibility** (weight: 0.15)
345
- - Architecture scalable?
346
- - Technical constraints realistic?
347
- - Timeline achievable?
348
-
349
- 5. **Maintainability** (weight: 0.10)
350
- - Design modular?
351
- - Extension points identified?
352
- - Technical debt addressed?
353
-
354
- 6. **Edge Cases** (weight: 0.10)
355
- - Failure scenarios covered?
356
- - Performance limits specified?
357
- - Security considerations included?
358
-
359
- **Display quality results**:
360
- ```
361
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
362
- AI QUALITY ASSESSMENT
363
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
364
-
365
- Overall Score: 87/100 (GOOD) ✓
366
-
367
- Dimension Scores:
368
- Clarity: 92/100 ✓✓
369
- Testability: 78/100 ✓ (Needs improvement)
370
- Completeness: 90/100 ✓✓
371
- Feasibility: 88/100 ✓✓
372
- Maintainability: 85/100 ✓
373
- Edge Cases: 72/100 âš ī¸ (Action needed)
374
-
375
- Confidence: 92%
376
-
377
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
378
- ISSUES FOUND (3)
379
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
380
-
381
- 🔴 MAJOR: Acceptance criteria not fully testable
382
- Dimension: Testability
383
- Location: spec.md, section "Success Criteria" (line 78)
384
- Issue: "User can log in successfully" is vague
385
- Impact: QA won't know when feature is complete
386
-
387
- 🔴 MAJOR: Rate limiting edge case not addressed
388
- Dimension: Edge Cases
389
- Location: plan.md, section "Security" (line 145)
390
- Issue: No mention of brute-force protection
391
- Impact: Security vulnerability risk (OWASP A07:2021)
392
-
393
- 🔸 MINOR: Performance requirements missing
394
- Dimension: Completeness
395
- Location: spec.md, section "Non-Functional Requirements"
396
- Issue: No latency or throughput targets specified
397
- Impact: Hard to measure success objectively
398
-
399
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
400
- SUGGESTIONS (3)
401
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
402
-
403
- đŸŽ¯ HIGH PRIORITY: Make acceptance criteria measurable
404
-
405
- Current:
406
- "User can log in successfully"
407
-
408
- Improved:
409
- "User can log in with valid credentials within 2 seconds,
410
- receiving a JWT token with 24h expiry. Success rate >99.9%."
411
-
412
- Why: Testable criteria = clear success definition
413
-
414
- đŸŽ¯ HIGH PRIORITY: Specify edge case handling
415
-
416
- Add section: "Error Scenarios"
417
- - Rate limiting: 5 failed attempts → 15 min lockout
418
- - Invalid token: Return 401 with error code AUTH_INVALID
419
- - Expired session: Redirect to login with message
420
- - Network timeout: Retry 3 times with exponential backoff
85
+ Use CLI: `specweave qa <id> --pre` (or `increment-quality-judge-v2` skill auto-activates).
421
86
 
422
- Why: Edge cases cause 60% of production bugs
87
+ **6 quality dimensions**:
423
88
 
424
- 🔹 MEDIUM PRIORITY: Add performance requirements
89
+ | Dimension | Weight |
90
+ |-----------|--------|
91
+ | Clarity | 0.20 |
92
+ | Testability | 0.25 |
93
+ | Completeness | 0.20 |
94
+ | Feasibility | 0.15 |
95
+ | Maintainability | 0.10 |
96
+ | Edge Cases | 0.10 |
425
97
 
426
- Suggested addition to spec.md:
427
- - Login latency: p95 < 500ms, p99 < 1s
428
- - Concurrent logins: Support 100 requests/sec
429
- - Token validation: < 10ms per request
430
- - Uptime SLA: 99.9% (43 min downtime/month)
431
-
432
- Why: Performance is a feature, not an afterthought
433
-
434
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
435
- SUMMARY
436
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
437
-
438
- ✅ This specification is GOOD (87/100)
439
-
440
- Strengths:
441
- â€ĸ Clear problem statement and objectives
442
- â€ĸ Architecture is sound and scalable
443
- â€ĸ Good coverage of functional requirements
444
- â€ĸ Strong maintainability score
445
-
446
- Areas for improvement:
447
- â€ĸ Make acceptance criteria more testable (2 items)
448
- â€ĸ Address edge cases (rate limiting, errors)
449
- â€ĸ Add performance requirements
450
-
451
- Recommendation: Address HIGH priority suggestions before
452
- implementation. MEDIUM priority can be added incrementally.
453
-
454
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
455
- ```
98
+ Display: overall score (0-100), per-dimension scores, issues (MAJOR/MINOR), and actionable suggestions.
456
99
 
457
100
  ### Step 5: Handle Export Flag
458
101
 
459
- **If `--export` flag OR user chooses "Export"**:
460
-
461
- 1. Parse all suggestions from quality assessment
462
- 2. Add to `.specweave/increments/0001-name/tasks.md`
463
- 3. Format as tasks with priority labels
464
-
465
- **Example tasks.md addition**:
466
- ```markdown
467
- ## Quality Improvement Tasks (from AI assessment)
468
-
469
- - [ ] **[HIGH]** Make acceptance criteria measurable (spec.md:78)
470
- Current: "User can log in successfully"
471
- Improved: "User can log in with valid credentials within 2 seconds, receiving JWT with 24h expiry"
472
- Estimated: 1h
473
-
474
- - [ ] **[HIGH]** Specify edge case handling for rate limiting (plan.md:145)
475
- Add: Rate limiting (5 attempts → 15min lockout), invalid token handling, session expiry flow
476
- Estimated: 2h
477
-
478
- - [ ] **[MEDIUM]** Add performance requirements (spec.md:120)
479
- Add: Login latency (p95 <500ms), concurrent logins (100/sec), token validation (<10ms)
480
- Estimated: 1h
481
- ```
482
-
483
- **Display confirmation**:
484
- ```
485
- ✅ Exported 3 suggestions to tasks.md
486
-
487
- Added tasks:
488
- â€ĸ Make acceptance criteria measurable (HIGH, 1h)
489
- â€ĸ Specify edge case handling (HIGH, 2h)
490
- â€ĸ Add performance requirements (MEDIUM, 1h)
491
-
492
- Total estimated effort: 4 hours
493
- ```
494
-
495
- ### Step 6: Handle Fix Flag (Experimental)
496
-
497
- **If `--fix` flag provided**:
498
-
499
- **Warning**: Auto-fix is experimental. Always show diff and ask confirmation.
500
-
501
- 1. **Identify fixable issues**:
502
- - Only attempt to fix HIGH priority issues
503
- - Only fix issues with clear, unambiguous improvements
504
- - Skip issues requiring domain knowledge
505
-
506
- 2. **Generate fixes**:
507
- - Use Edit tool to apply suggestions
508
- - Show diff before applying
509
-
510
- 3. **Show diff and ask confirmation**:
511
- ```
512
- 🔧 Auto-Fix Available (2/3 suggestions)
513
-
514
- Fix 1: Make acceptance criteria measurable
515
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
516
- File: spec.md (line 78)
517
-
518
- - User can log in successfully
519
- + User can log in with valid credentials within 2 seconds,
520
- + receiving a JWT token with 24h expiry. Success rate >99.9%.
521
-
522
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
523
-
524
- Fix 2: Add performance requirements
525
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
526
- File: spec.md (line 120)
527
-
528
- + ## Performance Requirements
529
- +
530
- + - Login latency: p95 < 500ms, p99 < 1s
531
- + - Concurrent logins: Support 100 requests/sec
532
- + - Token validation: < 10ms per request
533
- + - Uptime SLA: 99.9% (43 min downtime/month)
534
-
535
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
536
-
537
- Apply these fixes?
538
- [Y] Yes, apply all
539
- [S] Show more details
540
- [N] No, cancel
541
- [E] Export to tasks instead
542
-
543
- Choice: _
544
- ```
545
-
546
- 4. **If user approves**:
547
- - Apply fixes using Edit tool
548
- - Re-run validation to confirm improvements
549
- - Show summary
550
-
551
- **After applying fixes**:
552
- ```
553
- ✅ Applied 2 fixes successfully
554
-
555
- Changes:
556
- â€ĸ spec.md: Made acceptance criteria measurable (+3 lines)
557
- â€ĸ spec.md: Added performance requirements section (+8 lines)
102
+ If `--export`: parse suggestions, add to tasks.md as prioritized tasks with `[HIGH]`/`[MEDIUM]` labels and estimates.
558
103
 
559
- Re-validating...
104
+ ### Step 6: Handle Fix Flag
560
105
 
561
- ✅ Rule-Based Validation: PASSED (120/120)
562
- 🔍 AI Quality Score: 92/100 (EXCELLENT) ✓✓
106
+ If `--fix`: identify HIGH-priority fixable issues, generate diffs, show to user for confirmation, apply if approved, then re-validate.
563
107
 
564
- Improvement: 87 → 92 (+5 points)
565
-
566
- Remaining issues: 1 (requires manual review)
567
- ```
108
+ Only fix issues with clear unambiguous improvements. Skip domain-specific or ambiguous issues.
568
109
 
569
110
  ### Step 7: Handle Always Flag
570
111
 
571
- **If `--always` flag OR user selects "Always run"**:
572
-
573
- 1. SpecWeave uses auto-detection
574
- ```yaml
575
- validation:
576
- quality_judge:
577
- enabled: true
578
- always_run: true # ← Set to true
579
- auto_prompt: false # ← Disable prompt
580
- thresholds:
581
- excellent: 90
582
- good: 80
583
- acceptable: 70
584
- dimensions:
585
- clarity: true
586
- testability: true
587
- completeness: true
588
- feasibility: true
589
- maintainability: true
590
- edge_cases: true
591
- max_tokens: 2000
592
- export_to_tasks: false # User can still use --export flag
593
- ```
594
-
595
- 2. **Display confirmation**:
596
- ```
597
- ✅ Configuration updated
598
-
599
- Quality assessment will now run automatically for all future validations.
600
-
601
- To disable:
602
- 1. Initialize your project
603
- 2. Set validation.quality_judge.always_run: false
604
-
605
- Or run: /sw:validate-increment <id> (quality will run automatically)
606
- ```
112
+ If `--always`: enable `validation.quality_judge.always_run: true` so future validations auto-run quality assessment.
607
113
 
608
114
  ### Step 8: Generate Validation Report
609
115
 
610
- **Always generate detailed report** at:
611
- `.specweave/increments/0001-name/reports/validation-report.md`
612
-
613
- **Report structure**:
614
- ```markdown
615
- # Validation Report: Increment 0001-authentication
616
-
617
- Generated: 2025-10-28 14:32:15 UTC
618
- Command: /sw:validate-increment 001 --quality
619
-
620
- ## Executive Summary
621
-
622
- **Overall Status**: ✅ PASSED (with recommendations)
116
+ Save detailed report to: `.specweave/increments/<id>/reports/validation-report.md`
623
117
 
624
- - Rule-Based Validation: 120/120 checks passed
625
- - AI Quality Score: 87/100 (GOOD)
626
- - Issues Found: 3 (2 major, 1 minor)
627
- - Suggestions: 3 (2 high, 1 medium priority)
118
+ Report includes: executive summary, rule-based results by category, AI quality scores, issues, suggestions, recommendations, and validation history.
628
119
 
629
- ## Rule-Based Validation Results
120
+ ## Scoring & Grading
630
121
 
631
- ### Consistency (47/47) ✓
632
- - User story → plan alignment: ✓
633
- - Plan → tasks alignment: ✓
634
- - Spec → tests traceability: ✓
635
- - Cross-document consistency: ✓
122
+ | Score | Grade |
123
+ |-------|-------|
124
+ | 90-100 | EXCELLENT |
125
+ | 80-89 | GOOD |
126
+ | 70-79 | ACCEPTABLE |
127
+ | <70 | NEEDS WORK |
636
128
 
637
- ### Completeness (23/23) ✓
638
- - spec.md sections: ✓
639
- - plan.md sections: ✓
640
- - tasks.md structure: ✓
641
-
642
- ### Quality (31/31) ✓
643
- - Technology-agnostic spec: ✓
644
- - Testable acceptance criteria: ✓
645
- - Actionable tasks: ✓
646
-
647
- ### Traceability (19/19) ✓
648
- - TC-0001 format: ✓
649
- - ADR references: ✓
650
- - Diagram references: ✓
651
-
652
- ## AI Quality Assessment
653
-
654
- ### Overall Score: 87/100 (GOOD)
655
-
656
- ### Dimension Scores
657
-
658
- | Dimension | Score | Grade | Status |
659
- |-----------|-------|-------|--------|
660
- | Clarity | 92/100 | ✓✓ | Excellent |
661
- | Testability | 78/100 | ✓ | Needs improvement |
662
- | Completeness | 90/100 | ✓✓ | Excellent |
663
- | Feasibility | 88/100 | ✓✓ | Excellent |
664
- | Maintainability | 85/100 | ✓ | Good |
665
- | Edge Cases | 72/100 | âš ī¸ | Action needed |
666
-
667
- ### Issues Found
668
-
669
- #### 🔴 MAJOR: Acceptance criteria not fully testable
670
- - **Dimension**: Testability
671
- - **Location**: spec.md:78, section "Success Criteria"
672
- - **Issue**: "User can log in successfully" is vague
673
- - **Impact**: QA won't know when feature is complete
674
- - **Recommendation**: Make criteria measurable with specific metrics
675
-
676
- #### 🔴 MAJOR: Rate limiting edge case not addressed
677
- - **Dimension**: Edge Cases
678
- - **Location**: plan.md:145, section "Security"
679
- - **Issue**: No mention of brute-force protection
680
- - **Impact**: Security vulnerability risk (OWASP A07:2021)
681
- - **Recommendation**: Add rate limiting (5 attempts → 15min lockout)
682
-
683
- #### 🔸 MINOR: Performance requirements missing
684
- - **Dimension**: Completeness
685
- - **Location**: spec.md:120
686
- - **Issue**: No latency or throughput targets
687
- - **Impact**: Hard to measure success objectively
688
- - **Recommendation**: Add p95 latency, concurrent users, SLA targets
689
-
690
- ### Suggestions
691
-
692
- [Full suggestions with before/after examples]
693
-
694
- ## Recommendations
695
-
696
- ### Before Implementation
697
- 1. ✅ Fix 2 major issues (testability, edge cases)
698
- 2. ✅ Estimated effort: 3-4 hours
699
-
700
- ### During Implementation
701
- 1. Monitor testability of acceptance criteria
702
- 2. Add security tests for rate limiting
703
- 3. Set up performance monitoring
704
-
705
- ### Post-Implementation
706
- 1. Re-validate to confirm improvements
707
- 2. Update documentation with actual performance metrics
708
- 3. Create runbook for handling edge cases
709
-
710
- ## Files Validated
711
-
712
- - spec.md (250 lines, 6 user stories, 15 requirements)
713
- - plan.md (480 lines, 8 components, 3 ADRs)
714
- - tasks.md (42 tasks, estimated 3-4 weeks)
715
- - tests.md (12 test cases, 85% coverage)
716
-
717
- ## Validation History
718
-
719
- | Date | Rule-Based | Quality Score | Command |
720
- |------|------------|---------------|---------|
721
- | 2025-10-28 | 120/120 | 87/100 | /sw:validate-increment 001 --quality |
722
- | 2025-10-25 | 115/120 | N/A | Auto-validation on save |
723
- | 2025-10-24 | 110/120 | N/A | Auto-validation on save |
724
-
725
- ---
726
-
727
- Generated by SpecWeave validation system
728
- For details: .specweave/docs/internal/delivery/guides/increment-validation.md
729
- ```
730
-
731
- **Notify user**:
732
- ```
733
- 📋 Full validation report saved:
734
- .specweave/increments/0001-authentication/reports/validation-report.md
735
- ```
736
-
737
- ## Examples
738
-
739
- ### Example 1: Basic Validation (Rule-Based Only)
740
-
741
- ```bash
742
- /sw:validate 001
743
- ```
744
-
745
- **Output**:
746
- ```
747
- ✅ Rule-Based Validation: PASSED (120/120 checks)
748
-
749
- 🤔 Run AI Quality Assessment? [Y/n]: _
750
- ```
751
-
752
- ### Example 2: Validation with Quality Assessment
753
-
754
- ```bash
755
- /sw:validate 001 --quality
756
- ```
757
-
758
- **Output**:
759
- ```
760
- ✅ Rule-Based: 120/120
761
- 🔍 AI Quality: 87/100 (GOOD)
762
-
763
- Issues: 2 major, 1 minor
764
- Suggestions: 3 (2 high, 1 medium)
765
-
766
- 📋 Full report: .specweave/increments/0001-auth/reports/validation-report.md
767
- ```
768
-
769
- ### Example 3: Validate and Export Suggestions
770
-
771
- ```bash
772
- /sw:validate 001 --quality --export
773
- ```
774
-
775
- **Output**:
776
- ```
777
- ✅ Rule-Based: 120/120
778
- 🔍 AI Quality: 87/100
779
-
780
- ✅ Exported 3 suggestions to tasks.md
781
- â€ĸ Make acceptance criteria measurable (HIGH)
782
- â€ĸ Specify edge case handling (HIGH)
783
- â€ĸ Add performance requirements (MEDIUM)
784
- ```
785
-
786
- ### Example 4: Auto-Fix Issues
787
-
788
- ```bash
789
- /sw:validate 001 --quality --fix
790
- ```
791
-
792
- **Output**:
793
- ```
794
- ✅ Rule-Based: 120/120
795
- 🔍 AI Quality: 87/100
796
-
797
- 🔧 Auto-fix available for 2/3 issues
798
-
799
- [Shows diff]
800
-
801
- Apply fixes? [Y/s/n/e]: Y
802
-
803
- ✅ Applied 2 fixes
804
- Re-validated: 92/100 (improvement: +5)
805
- ```
806
-
807
- ### Example 5: Make Quality Assessment Default
808
-
809
- ```bash
810
- /sw:validate 001 --always
811
- ```
812
-
813
- **Output**:
814
- ```
815
- ✅ Rule-Based: 120/120
816
- 🔍 AI Quality: 87/100
817
-
818
- ✅ Configuration updated
819
- Quality assessment will run automatically for future validations.
820
- ```
821
-
822
- ## Error Handling
823
-
824
- ### Increment Not Found
825
- ```
826
- ❌ Error: Increment 0001 not found
827
-
828
- Available increments:
829
- â€ĸ 0002-core-enhancements
830
- â€ĸ 0003-payment-processing
831
-
832
- Usage: /sw:validate-increment <id> [--quality] [--export] [--fix] [--always]
833
- ```
834
-
835
- ### Invalid Flags
836
- ```
837
- ❌ Error: Invalid flag '--qualitty'
838
-
839
- Valid flags:
840
- --quality Run AI quality assessment
841
- --export Export suggestions to tasks.md
842
- --fix Auto-fix issues (experimental)
843
- --always Make quality assessment default
844
-
845
- Usage: /sw:validate-increment <id> [--quality] [--export] [--fix] [--always]
846
- ```
847
-
848
- ### Quality Assessment Failed
849
- ```
850
- âš ī¸ Warning: AI quality assessment failed (API error)
851
-
852
- ✅ Rule-based validation completed successfully (120/120)
853
-
854
- You can:
855
- 1. Try again: /sw:validate-increment 001 --quality
856
- 2. Continue with rule-based results
857
- 3. Check logs: .specweave/increments/0001-name/logs/validation.log
858
- ```
859
-
860
- ### No Fixable Issues
861
- ```
862
- â„šī¸ No auto-fixable issues found
863
-
864
- All issues require manual review:
865
- â€ĸ Architectural decision (requires ADR)
866
- â€ĸ Domain-specific requirement (requires expertise)
867
- â€ĸ Ambiguous context (requires clarification)
868
-
869
- Export suggestions to tasks? [Y/n]: _
870
- ```
871
-
872
- ## Integration with Hooks
873
-
874
- This command can be triggered by:
875
-
876
- 1. **Manual execution**: `/sw:validate 001 --quality`
877
- 2. **Post-document-save hook**: Auto-runs rule-based validation
878
- 3. **Pre-implementation hook**: Validates before starting tasks
879
- 4. **CI/CD pipeline**: Automated validation in GitHub Actions
880
-
881
- **Hook integration** (`.claude/hooks/post-document-save.sh`):
882
- ```bash
883
- #!/bin/bash
884
- # Auto-validate on save
885
-
886
- if [[ "$FILE" =~ spec\.md|plan\.md|tasks\.md|tests\.md ]]; then
887
- # Extract increment ID from path
888
- INCREMENT_ID=$(echo "$FILE" | grep -oP '(?<=increments/)\d{4}')
889
-
890
- # Run validation (rule-based only, no quality unless config says so)
891
- /sw:validate-increment "$INCREMENT_ID"
892
- fi
893
- ```
894
-
895
- ## Configuration
896
-
897
- All validation settings use sensible defaults. Quality assessment is prompted each time unless `--quality` flag is used.
898
-
899
- ## Related Commands
900
-
901
- - `/create-increment`: Create new increment (auto-validates on creation)
902
- - `/sw:sync-docs`: Review strategic documentation before implementation
903
- - `/close-increment`: Close increment (validates before closing)
904
- - `/sync-github`: Sync to GitHub (validates before sync)
905
-
906
- ## Related Skills
907
-
908
- - `increment-quality-judge`: AI-powered quality assessment
909
- - `increment-validator`: Rule-based validation (120 checks)
910
- - `increment-planner`: Creates increments with validation built-in
911
-
912
- ---
129
+ **Pass/fail gate**: Rule-based must pass all CRITICAL checks. Quality score is advisory (no hard gate).
913
130
 
914
- **Important**: This command works alongside intent-based validation. Users can say:
915
- - "Validate quality of increment 001" (intent-based)
916
- - `/sw:validate 001 --quality` (slash command)
131
+ ## Related
917
132
 
918
- Both routes activate the same validation logic for consistency.
133
+ - `increment-quality-judge` skill: AI assessment engine
134
+ - `/sw:done`: validates before closing
135
+ - `specweave qa <id>`: CLI equivalent