musubi-sdd 0.1.0

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 (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.ja.md +531 -0
  3. package/README.md +531 -0
  4. package/bin/musubi-init.js +321 -0
  5. package/bin/musubi.js +359 -0
  6. package/package.json +55 -0
  7. package/src/agents/registry.js +242 -0
  8. package/src/templates/agents/claude-code/CLAUDE.md +232 -0
  9. package/src/templates/agents/claude-code/commands/sdd-design.md +673 -0
  10. package/src/templates/agents/claude-code/commands/sdd-implement.md +777 -0
  11. package/src/templates/agents/claude-code/commands/sdd-requirements.md +438 -0
  12. package/src/templates/agents/claude-code/commands/sdd-steering.md +334 -0
  13. package/src/templates/agents/claude-code/commands/sdd-tasks.md +582 -0
  14. package/src/templates/agents/claude-code/commands/sdd-validate.md +710 -0
  15. package/src/templates/agents/claude-code/skills/ai-ml-engineer/SKILL.md +3055 -0
  16. package/src/templates/agents/claude-code/skills/api-designer/SKILL.md +1364 -0
  17. package/src/templates/agents/claude-code/skills/bug-hunter/SKILL.md +482 -0
  18. package/src/templates/agents/claude-code/skills/change-impact-analyzer/SKILL.md +397 -0
  19. package/src/templates/agents/claude-code/skills/cloud-architect/SKILL.md +1468 -0
  20. package/src/templates/agents/claude-code/skills/code-reviewer/SKILL.md +906 -0
  21. package/src/templates/agents/claude-code/skills/constitution-enforcer/SKILL.md +466 -0
  22. package/src/templates/agents/claude-code/skills/database-administrator/SKILL.md +3522 -0
  23. package/src/templates/agents/claude-code/skills/database-schema-designer/SKILL.md +1158 -0
  24. package/src/templates/agents/claude-code/skills/devops-engineer/SKILL.md +647 -0
  25. package/src/templates/agents/claude-code/skills/orchestrator/SKILL.md +574 -0
  26. package/src/templates/agents/claude-code/skills/performance-optimizer/SKILL.md +464 -0
  27. package/src/templates/agents/claude-code/skills/project-manager/SKILL.md +769 -0
  28. package/src/templates/agents/claude-code/skills/quality-assurance/SKILL.md +1059 -0
  29. package/src/templates/agents/claude-code/skills/release-coordinator/SKILL.md +653 -0
  30. package/src/templates/agents/claude-code/skills/requirements-analyst/SKILL.md +1287 -0
  31. package/src/templates/agents/claude-code/skills/security-auditor/SKILL.md +1107 -0
  32. package/src/templates/agents/claude-code/skills/site-reliability-engineer/SKILL.md +404 -0
  33. package/src/templates/agents/claude-code/skills/software-developer/SKILL.md +1254 -0
  34. package/src/templates/agents/claude-code/skills/steering/SKILL.md +383 -0
  35. package/src/templates/agents/claude-code/skills/system-architect/SKILL.md +1288 -0
  36. package/src/templates/agents/claude-code/skills/technical-writer/SKILL.md +712 -0
  37. package/src/templates/agents/claude-code/skills/test-engineer/SKILL.md +1262 -0
  38. package/src/templates/agents/claude-code/skills/traceability-auditor/SKILL.md +298 -0
  39. package/src/templates/agents/claude-code/skills/ui-ux-designer/SKILL.md +1009 -0
  40. package/src/templates/agents/codex/AGENTS.md +138 -0
  41. package/src/templates/agents/codex/commands/sdd-design.md +673 -0
  42. package/src/templates/agents/codex/commands/sdd-implement.md +777 -0
  43. package/src/templates/agents/codex/commands/sdd-requirements.md +438 -0
  44. package/src/templates/agents/codex/commands/sdd-steering.md +334 -0
  45. package/src/templates/agents/codex/commands/sdd-tasks.md +582 -0
  46. package/src/templates/agents/codex/commands/sdd-validate.md +710 -0
  47. package/src/templates/agents/cursor/AGENTS.md +138 -0
  48. package/src/templates/agents/cursor/commands/sdd-design.md +673 -0
  49. package/src/templates/agents/cursor/commands/sdd-implement.md +777 -0
  50. package/src/templates/agents/cursor/commands/sdd-requirements.md +438 -0
  51. package/src/templates/agents/cursor/commands/sdd-steering.md +334 -0
  52. package/src/templates/agents/cursor/commands/sdd-tasks.md +582 -0
  53. package/src/templates/agents/cursor/commands/sdd-validate.md +710 -0
  54. package/src/templates/agents/gemini-cli/GEMINI.md +128 -0
  55. package/src/templates/agents/gemini-cli/commands/sdd-design.toml +359 -0
  56. package/src/templates/agents/gemini-cli/commands/sdd-implement.toml +484 -0
  57. package/src/templates/agents/gemini-cli/commands/sdd-requirements.toml +291 -0
  58. package/src/templates/agents/gemini-cli/commands/sdd-steering.toml +209 -0
  59. package/src/templates/agents/gemini-cli/commands/sdd-tasks.toml +441 -0
  60. package/src/templates/agents/gemini-cli/commands/sdd-validate.toml +553 -0
  61. package/src/templates/agents/github-copilot/AGENTS.md +138 -0
  62. package/src/templates/agents/github-copilot/commands/sdd-design.md +673 -0
  63. package/src/templates/agents/github-copilot/commands/sdd-implement.md +777 -0
  64. package/src/templates/agents/github-copilot/commands/sdd-requirements.md +438 -0
  65. package/src/templates/agents/github-copilot/commands/sdd-steering.md +334 -0
  66. package/src/templates/agents/github-copilot/commands/sdd-tasks.md +582 -0
  67. package/src/templates/agents/github-copilot/commands/sdd-validate.md +710 -0
  68. package/src/templates/agents/qwen-code/QWEN.md +128 -0
  69. package/src/templates/agents/qwen-code/commands/sdd-design.md +673 -0
  70. package/src/templates/agents/qwen-code/commands/sdd-implement.md +777 -0
  71. package/src/templates/agents/qwen-code/commands/sdd-requirements.md +438 -0
  72. package/src/templates/agents/qwen-code/commands/sdd-steering.md +334 -0
  73. package/src/templates/agents/qwen-code/commands/sdd-tasks.md +582 -0
  74. package/src/templates/agents/qwen-code/commands/sdd-validate.md +710 -0
  75. package/src/templates/agents/windsurf/AGENTS.md +138 -0
  76. package/src/templates/agents/windsurf/commands/sdd-design.md +673 -0
  77. package/src/templates/agents/windsurf/commands/sdd-implement.md +777 -0
  78. package/src/templates/agents/windsurf/commands/sdd-requirements.md +438 -0
  79. package/src/templates/agents/windsurf/commands/sdd-steering.md +334 -0
  80. package/src/templates/agents/windsurf/commands/sdd-tasks.md +582 -0
  81. package/src/templates/agents/windsurf/commands/sdd-validate.md +710 -0
  82. package/src/templates/shared/constitution/constitution.md +408 -0
  83. package/src/templates/shared/constitution/ears-format.md +613 -0
  84. package/src/templates/shared/constitution/workflow.md +653 -0
  85. package/src/templates/shared/documents/design.md +737 -0
  86. package/src/templates/shared/documents/requirements.md +329 -0
  87. package/src/templates/shared/documents/research.md +494 -0
  88. package/src/templates/shared/documents/tasks.md +781 -0
  89. package/src/templates/shared/steering/product.md +544 -0
  90. package/src/templates/shared/steering/structure.md +405 -0
  91. package/src/templates/shared/steering/tech.md +537 -0
@@ -0,0 +1,710 @@
1
+ # SDD Validate Command
2
+
3
+ Validate constitutional compliance and requirements coverage.
4
+
5
+ ---
6
+
7
+ ## Instructions for Claude
8
+
9
+ You are executing the `/sdd-validate [feature-name]` command to validate constitutional compliance and requirements coverage for a feature.
10
+
11
+ ### Command Format
12
+
13
+ ```bash
14
+ /sdd-validate authentication
15
+ /sdd-validate payment-processing
16
+ /sdd-validate user-dashboard
17
+ ```
18
+
19
+ ### Your Task
20
+
21
+ Perform comprehensive validation of the feature implementation against:
22
+ 1. Constitutional Articles (9 articles)
23
+ 2. Requirements coverage (100% traceability)
24
+ 3. Code quality standards
25
+ 4. Security standards
26
+ 5. Test coverage
27
+
28
+ ---
29
+
30
+ ## Process
31
+
32
+ ### 1. Read All Documentation
33
+
34
+ **IMPORTANT**: Always read ENGLISH versions (.md) as they are the reference/source.
35
+
36
+ ```bash
37
+ # Requirements and Design (English versions)
38
+ storage/specs/{{feature-name}}-requirements.md
39
+ storage/specs/{{feature-name}}-design.md
40
+ storage/specs/{{feature-name}}-tasks.md
41
+
42
+ # Steering Context (English versions)
43
+ steering/structure.md
44
+ steering/tech.md
45
+ steering/product.md
46
+ steering/rules/constitution.md
47
+
48
+ # Source Code
49
+ lib/{{feature}}/src/**/*.ts
50
+ lib/{{feature}}/tests/**/*.test.ts
51
+ app/api/{{resource}}/**/*.ts
52
+ ```
53
+
54
+ **Note**: Japanese versions (.ja.md) are translations only. Use English versions for validation.
55
+
56
+ ---
57
+
58
+ ### 2. Constitutional Validation
59
+
60
+ Validate each of the 9 Constitutional Articles:
61
+
62
+ #### Article I: Library-First Principle
63
+
64
+ **Requirement**: All new features SHALL begin as independent libraries.
65
+
66
+ **Validation Steps**:
67
+ 1. Check `lib/{{feature}}/` directory exists
68
+ 2. Verify library structure:
69
+ - [ ] `lib/{{feature}}/src/` exists
70
+ - [ ] `lib/{{feature}}/tests/` exists
71
+ - [ ] `lib/{{feature}}/package.json` exists
72
+ - [ ] Public API exported via `src/index.ts`
73
+ 3. Verify NO dependencies on application code:
74
+ - Grep for imports from `app/`, `pages/`, etc.
75
+ - Library should only import from own `src/` or external packages
76
+
77
+ **Example Output**:
78
+ ```markdown
79
+ ### Article I: Library-First Principle
80
+
81
+ **Status**: ✅ PASS
82
+
83
+ **Evidence**:
84
+ - Library location: `lib/auth/`
85
+ - Public API: `lib/auth/src/index.ts`
86
+ - Independent tests: `lib/auth/tests/`
87
+ - No application dependencies found
88
+
89
+ **Files Checked**:
90
+ - lib/auth/src/service.ts
91
+ - lib/auth/src/repository.ts
92
+ - lib/auth/src/index.ts
93
+ ```
94
+
95
+ **OR if violation**:
96
+ ```markdown
97
+ ### Article I: Library-First Principle
98
+
99
+ **Status**: ❌ FAIL
100
+
101
+ **Violations**:
102
+ 1. Feature implemented in `app/components/` instead of `lib/`
103
+ 2. Missing independent test suite
104
+
105
+ **Required Actions**:
106
+ - Move feature to `lib/{{feature}}/`
107
+ - Create independent test suite
108
+ - Expose public API via `src/index.ts`
109
+ ```
110
+
111
+ ---
112
+
113
+ #### Article II: CLI Interface Mandate
114
+
115
+ **Requirement**: All libraries SHALL expose functionality through CLI interfaces.
116
+
117
+ **Validation Steps**:
118
+ 1. Check `lib/{{feature}}/cli.ts` exists
119
+ 2. Verify CLI functionality:
120
+ - [ ] Executable shebang (`#!/usr/bin/env node`)
121
+ - [ ] Help text (`--help` flag)
122
+ - [ ] Commands for primary operations
123
+ - [ ] Proper exit codes (0=success, non-zero=error)
124
+ 3. Test CLI:
125
+ ```bash
126
+ ./lib/{{feature}}/cli.ts --help
127
+ ```
128
+
129
+ **Example Output**:
130
+ ```markdown
131
+ ### Article II: CLI Interface Mandate
132
+
133
+ **Status**: ✅ PASS
134
+
135
+ **Evidence**:
136
+ - CLI file: `lib/auth/cli.ts`
137
+ - Commands: create-user, login, logout, validate-session
138
+ - Help text: ✅ Available via `--help`
139
+ - Exit codes: ✅ Proper handling
140
+
141
+ **CLI Test**:
142
+ ```bash
143
+ $ ./lib/auth/cli.ts --help
144
+ Usage: auth [command] [options]
145
+
146
+ Commands:
147
+ create-user Create a new user
148
+ login Authenticate user
149
+ logout End user session
150
+ validate-session Validate session token
151
+
152
+ Options:
153
+ -h, --help Display help
154
+ -v, --version Display version
155
+ ```
156
+ ```
157
+
158
+ ---
159
+
160
+ #### Article III: Test-First Imperative
161
+
162
+ **Requirement**: Tests SHALL be written before implementation (Red-Green-Blue cycle).
163
+
164
+ **Validation Steps**:
165
+ 1. Check git history for Red-Green-Blue pattern:
166
+ ```bash
167
+ git log --oneline lib/{{feature}}/
168
+ ```
169
+ 2. Verify test commits BEFORE implementation commits:
170
+ - `test: add failing tests for REQ-XXX-001` (RED)
171
+ - `feat: implement REQ-XXX-001` (GREEN)
172
+ - `refactor: improve {{component}}` (BLUE)
173
+ 3. Check test coverage ≥ 80%:
174
+ ```bash
175
+ npm test -- --coverage
176
+ ```
177
+
178
+ **Example Output**:
179
+ ```markdown
180
+ ### Article III: Test-First Imperative
181
+
182
+ **Status**: ✅ PASS
183
+
184
+ **Evidence from Git History**:
185
+ ```
186
+ abc123f test: add failing tests for REQ-AUTH-001
187
+ def456g feat: implement REQ-AUTH-001 (user login)
188
+ ghi789h refactor: extract validator from auth service
189
+ ```
190
+
191
+ **Red-Green-Blue Cycle**: ✅ Verified in git history
192
+
193
+ **Test Coverage**:
194
+ - Statements: 92%
195
+ - Branches: 88%
196
+ - Functions: 95%
197
+ - Lines: 91%
198
+ - **Overall**: 91.5% ✅ (target: 80%)
199
+ ```
200
+
201
+ ---
202
+
203
+ #### Article IV: EARS Requirements Format
204
+
205
+ **Requirement**: All requirements SHALL use EARS format.
206
+
207
+ **Validation Steps**:
208
+ 1. Read `storage/specs/{{feature-name}}-requirements.md`
209
+ 2. Check each requirement for EARS pattern:
210
+ - Ubiquitous: `The [system] SHALL`
211
+ - Event-driven: `WHEN ... THEN`
212
+ - State-driven: `WHILE ... SHALL`
213
+ - Unwanted: `IF ... THEN`
214
+ - Optional: `WHERE ... SHALL`
215
+ 3. Verify keywords:
216
+ - [ ] Uses SHALL/SHALL NOT (not SHOULD/MUST/MAY)
217
+ - [ ] No ambiguous language
218
+ 4. Verify structure:
219
+ - [ ] Unique IDs (REQ-XXX-NNN)
220
+ - [ ] Acceptance criteria defined
221
+ - [ ] Testable and measurable
222
+
223
+ **Example Output**:
224
+ ```markdown
225
+ ### Article IV: EARS Requirements Format
226
+
227
+ **Status**: ✅ PASS
228
+
229
+ **Requirements Checked**: 15
230
+
231
+ **EARS Patterns Used**:
232
+ - Ubiquitous: 5 requirements
233
+ - Event-driven: 7 requirements
234
+ - State-driven: 1 requirement
235
+ - Unwanted behavior: 2 requirements
236
+ - Optional feature: 0 requirements
237
+
238
+ **Keyword Compliance**:
239
+ - ✅ All requirements use SHALL/SHALL NOT
240
+ - ✅ No ambiguous keywords found (SHOULD, MUST, MAY)
241
+
242
+ **Sample Requirement**:
243
+ ```markdown
244
+ ### REQ-AUTH-001: User Login
245
+ WHEN a user provides valid credentials,
246
+ THEN the authentication system SHALL authenticate the user
247
+ AND the system SHALL create a session.
248
+
249
+ **Acceptance Criteria**:
250
+ - Email and password validated
251
+ - Session created with 24-hour expiry
252
+ ```
253
+ ✅ Valid EARS format (Event-driven pattern)
254
+ ```
255
+
256
+ ---
257
+
258
+ #### Article V: Traceability Mandate
259
+
260
+ **Requirement**: 100% traceability SHALL be maintained between Requirements ↔ Design ↔ Code ↔ Tests.
261
+
262
+ **Validation Steps**:
263
+ 1. Extract all requirement IDs from requirements.md
264
+ 2. For each requirement, verify:
265
+ - [ ] Mapped in design.md (requirements coverage matrix)
266
+ - [ ] Implemented in code (grep for REQ-XXX-NNN in source)
267
+ - [ ] Tested (grep for REQ-XXX-NNN in tests)
268
+ 3. Calculate coverage percentages
269
+ 4. Identify gaps
270
+
271
+ **Example Output**:
272
+ ```markdown
273
+ ### Article V: Traceability Mandate
274
+
275
+ **Status**: ✅ PASS
276
+
277
+ **Traceability Matrix**:
278
+
279
+ | Requirement | Design | Code | Tests | Status |
280
+ |-------------|--------|------|-------|--------|
281
+ | REQ-AUTH-001 | ✅ design.md#auth-service | ✅ lib/auth/src/service.ts:45 | ✅ lib/auth/tests/service.test.ts:23 | Complete |
282
+ | REQ-AUTH-002 | ✅ design.md#password-hash | ✅ lib/auth/src/password.ts:12 | ✅ lib/auth/tests/password.test.ts:8 | Complete |
283
+ | REQ-AUTH-003 | ✅ design.md#session-mgmt | ✅ lib/auth/src/service.ts:89 | ✅ lib/auth/tests/service.test.ts:67 | Complete |
284
+ | REQ-PERF-001 | ✅ design.md#caching | ✅ lib/auth/src/cache.ts:23 | ✅ lib/auth/tests/integration.test.ts:112 | Complete |
285
+ | REQ-SEC-001 | ✅ design.md#security | ✅ lib/auth/src/password.ts:34 | ✅ lib/auth/tests/security.test.ts:45 | Complete |
286
+
287
+ **Coverage Summary**:
288
+ - Total Requirements: 5
289
+ - Requirements → Design: 5 (100% ✅)
290
+ - Requirements → Code: 5 (100% ✅)
291
+ - Requirements → Tests: 5 (100% ✅)
292
+ - **Overall Coverage**: 100% ✅
293
+
294
+ **Gap Analysis**: No gaps detected
295
+ ```
296
+
297
+ **OR if gaps detected**:
298
+ ```markdown
299
+ ### Article V: Traceability Mandate
300
+
301
+ **Status**: ❌ FAIL
302
+
303
+ **Gaps Detected**:
304
+ 1. REQ-AUTH-004: No test coverage found
305
+ 2. REQ-PERF-001: Not implemented in code
306
+ 3. REQ-SEC-002: Not mentioned in design
307
+
308
+ **Coverage Summary**:
309
+ - Requirements → Design: 4/5 (80%)
310
+ - Requirements → Code: 4/5 (80%)
311
+ - Requirements → Tests: 3/5 (60%) ❌
312
+
313
+ **Required Actions**:
314
+ - Add tests for REQ-AUTH-004
315
+ - Implement REQ-PERF-001
316
+ - Update design.md to cover REQ-SEC-002
317
+ ```
318
+
319
+ ---
320
+
321
+ #### Article VI: Project Memory (Steering System)
322
+
323
+ **Requirement**: All skills SHALL consult project memory (steering files) before making decisions.
324
+
325
+ **Validation Steps**:
326
+ 1. Verify steering files exist and are current
327
+ 2. Check if implementation aligns with steering:
328
+ - Architecture pattern from `steering/structure.md`
329
+ - Technology stack from `steering/tech.md`
330
+ - Product goals from `steering/product.md`
331
+
332
+ **Example Output**:
333
+ ```markdown
334
+ ### Article VI: Project Memory
335
+
336
+ **Status**: ✅ PASS
337
+
338
+ **Steering Alignment**:
339
+
340
+ **Architecture (steering/structure.md)**:
341
+ - Expected: Library-first pattern
342
+ - Actual: ✅ Feature implemented as library (`lib/auth/`)
343
+
344
+ **Technology Stack (steering/tech.md)**:
345
+ - Expected: TypeScript, Next.js, PostgreSQL, Prisma
346
+ - Actual: ✅ All technologies used correctly
347
+
348
+ **Product Context (steering/product.md)**:
349
+ - Product Goal: B2B SaaS authentication
350
+ - Feature Alignment: ✅ Implements user authentication for B2B use case
351
+ ```
352
+
353
+ ---
354
+
355
+ #### Article VII: Simplicity Gate (Phase -1)
356
+
357
+ **Requirement**: Projects SHALL start with maximum 3 sub-projects initially.
358
+
359
+ **Validation Steps**:
360
+ 1. Count independently deployable projects
361
+ 2. If > 3, check for Phase -1 Gate approval in design.md
362
+
363
+ **Example Output**:
364
+ ```markdown
365
+ ### Article VII: Simplicity Gate
366
+
367
+ **Status**: ✅ PASS
368
+
369
+ **Project Count**: 1 (monorepo with libraries)
370
+
371
+ **Projects**:
372
+ 1. Main application (Next.js with libraries)
373
+
374
+ **Within Limit**: ✅ (≤ 3)
375
+ ```
376
+
377
+ ---
378
+
379
+ #### Article VIII: Anti-Abstraction Gate (Phase -1)
380
+
381
+ **Requirement**: Framework features SHALL be used directly without custom abstraction layers.
382
+
383
+ **Validation Steps**:
384
+ 1. Search for custom abstraction layers:
385
+ - Custom ORM wrappers
386
+ - Custom HTTP client wrappers
387
+ - Custom logging abstractions
388
+ 2. If found, verify Phase -1 Gate approval with justification
389
+
390
+ **Example Output**:
391
+ ```markdown
392
+ ### Article VIII: Anti-Abstraction Gate
393
+
394
+ **Status**: ✅ PASS
395
+
396
+ **Framework Usage Analysis**:
397
+ - **ORM**: Uses Prisma directly ✅ (no custom wrapper)
398
+ - **Password Hashing**: Uses bcrypt directly ✅
399
+ - **HTTP**: Uses Next.js API routes directly ✅
400
+ - **Validation**: Uses Zod directly ✅
401
+
402
+ **Custom Abstractions**: None detected ✅
403
+ ```
404
+
405
+ **OR if violation**:
406
+ ```markdown
407
+ ### Article VIII: Anti-Abstraction Gate
408
+
409
+ **Status**: ⚠️ WARNING
410
+
411
+ **Custom Abstractions Detected**:
412
+ 1. `lib/database/wrapper.ts` - Custom Prisma wrapper
413
+
414
+ **Phase -1 Gate Approval**: ❌ Not found in design.md
415
+
416
+ **Required Actions**:
417
+ - Justify abstraction with multi-framework support need
418
+ - OR remove abstraction and use Prisma directly
419
+ - Document in design.md ADR
420
+ - Get approval from @system-architect + @software-developer
421
+ ```
422
+
423
+ ---
424
+
425
+ #### Article IX: Integration-First Testing
426
+
427
+ **Requirement**: Integration tests SHALL use real services; mocks are discouraged.
428
+
429
+ **Validation Steps**:
430
+ 1. Check integration tests use real services:
431
+ - Real database (Docker, test schema)
432
+ - Real cache (Redis test instance)
433
+ - Real external APIs (sandbox environments)
434
+ 2. Verify mocks are justified
435
+
436
+ **Example Output**:
437
+ ```markdown
438
+ ### Article IX: Integration-First Testing
439
+
440
+ **Status**: ✅ PASS
441
+
442
+ **Integration Tests Analysis**:
443
+
444
+ **Database Tests**:
445
+ - Uses: Real PostgreSQL (Docker Compose)
446
+ - Evidence: `lib/auth/tests/integration.test.ts:12`
447
+ ```typescript
448
+ beforeAll(async () => {
449
+ prisma = new PrismaClient({
450
+ datasourceUrl: process.env.TEST_DATABASE_URL // Real DB
451
+ });
452
+ });
453
+ ```
454
+ - ✅ Real database confirmed
455
+
456
+ **Cache Tests**:
457
+ - Uses: Real Redis (Docker Compose)
458
+ - ✅ Real cache confirmed
459
+
460
+ **External API Tests**:
461
+ - Payment API: Uses sandbox environment ✅
462
+ - Email API: **Mock** ⚠️
463
+ - Justification: No test environment available ✅
464
+ - Documented in: `tests/README.md`
465
+
466
+ **Mock Usage**: 1 justified mock found (Email API)
467
+ - ✅ Justification documented
468
+ ```
469
+
470
+ ---
471
+
472
+ ### 3. Code Quality Validation
473
+
474
+ Run code quality checks:
475
+
476
+ ```bash
477
+ # Linting
478
+ npm run lint
479
+
480
+ # Type checking
481
+ npx tsc --noEmit
482
+
483
+ # Code review
484
+ @code-reviewer review lib/{{feature}}/src/
485
+ ```
486
+
487
+ **Example Output**:
488
+ ```markdown
489
+ ## Code Quality Validation
490
+
491
+ **Linting**: ✅ No issues (ESLint)
492
+ **Type Checking**: ✅ No errors (TypeScript)
493
+ **Code Review**: ✅ Passed
494
+
495
+ **SOLID Principles**:
496
+ - Single Responsibility: ✅ Each class has one responsibility
497
+ - Open/Closed: ✅ Open for extension, closed for modification
498
+ - Liskov Substitution: ✅ Proper inheritance
499
+ - Interface Segregation: ✅ Small, focused interfaces
500
+ - Dependency Inversion: ✅ Depends on abstractions
501
+
502
+ **Best Practices**:
503
+ - ✅ Proper error handling
504
+ - ✅ Input validation
505
+ - ✅ No code duplication
506
+ - ✅ Clear naming conventions
507
+ - ✅ Proper TypeScript types
508
+ ```
509
+
510
+ ---
511
+
512
+ ### 4. Security Validation
513
+
514
+ ```bash
515
+ @security-auditor audit lib/{{feature}}/
516
+ ```
517
+
518
+ **Example Output**:
519
+ ```markdown
520
+ ## Security Validation
521
+
522
+ **OWASP Top 10 Check**:
523
+ - ✅ A01: Broken Access Control - Auth middleware enforced
524
+ - ✅ A02: Cryptographic Failures - bcrypt used (cost 12)
525
+ - ✅ A03: Injection - Parameterized queries (Prisma ORM)
526
+ - ✅ A04: Insecure Design - Security by design principles
527
+ - ✅ A05: Security Misconfiguration - Proper config
528
+ - ✅ A06: Vulnerable Components - npm audit passed
529
+ - ✅ A07: Auth Failures - Proper auth implementation
530
+ - ✅ A08: Data Integrity - Input validation
531
+ - ✅ A09: Logging Failures - Proper logging
532
+ - ✅ A10: SSRF - No server-side requests
533
+
534
+ **Vulnerabilities**: 0 critical, 0 high, 0 medium
535
+ ```
536
+
537
+ ---
538
+
539
+ ### 5. Performance Validation
540
+
541
+ ```bash
542
+ @performance-optimizer analyze lib/{{feature}}/
543
+ ```
544
+
545
+ **Example Output**:
546
+ ```markdown
547
+ ## Performance Validation
548
+
549
+ **Response Time** (from REQ-PERF-001):
550
+ - Target: < 200ms (95th percentile)
551
+ - Actual: 150ms (95th percentile) ✅
552
+ - 99th percentile: 280ms ✅
553
+
554
+ **Database Queries**:
555
+ - N+1 queries: None detected ✅
556
+ - Indexes: ✅ Properly indexed
557
+ - Connection pooling: ✅ Configured (20 connections)
558
+
559
+ **Caching**:
560
+ - Redis cache: ✅ Implemented
561
+ - Hit rate: 85%
562
+ - TTL: 5 minutes
563
+ ```
564
+
565
+ ---
566
+
567
+ ### 6. Generate Validation Report
568
+
569
+ **Save to**: `storage/validation/{{feature-name}}-validation-report.md`
570
+
571
+ **Report Structure**:
572
+ ```markdown
573
+ # Validation Report: {{FEATURE_NAME}}
574
+
575
+ **Date**: {{DATE}}
576
+ **Status**: ✅ PASS / ❌ FAIL
577
+ **Validator**: {{VALIDATOR}}
578
+
579
+ ---
580
+
581
+ ## Executive Summary
582
+
583
+ **Overall Status**: ✅ PASS
584
+
585
+ **Constitutional Compliance**: 9/9 articles ✅
586
+ **Requirements Coverage**: 100% ✅
587
+ **Test Coverage**: 91.5% ✅
588
+ **Security**: 0 vulnerabilities ✅
589
+ **Performance**: Within targets ✅
590
+
591
+ ---
592
+
593
+ ## Constitutional Validation
594
+
595
+ [Include all 9 articles validation results]
596
+
597
+ ---
598
+
599
+ ## Requirements Traceability
600
+
601
+ [Include traceability matrix]
602
+
603
+ ---
604
+
605
+ ## Code Quality
606
+
607
+ [Include code quality results]
608
+
609
+ ---
610
+
611
+ ## Security
612
+
613
+ [Include security audit results]
614
+
615
+ ---
616
+
617
+ ## Performance
618
+
619
+ [Include performance validation results]
620
+
621
+ ---
622
+
623
+ ## Recommendations
624
+
625
+ [Optional improvements, non-blocking issues]
626
+
627
+ ---
628
+
629
+ ## Sign-Off
630
+
631
+ **Validated By**: [Name/Role]
632
+ **Date**: {{DATE}}
633
+ **Approved for Production**: ✅ YES / ❌ NO
634
+ ```
635
+
636
+ ---
637
+
638
+ ### 7. Generate Summary
639
+
640
+ ```markdown
641
+ ## ✅ Validation Complete
642
+
643
+ **Feature**: {{FEATURE_NAME}}
644
+ **Report**: storage/validation/{{feature-name}}-validation-report.md
645
+
646
+ ### Validation Summary:
647
+
648
+ **Constitutional Compliance**:
649
+ - ✅ Article I: Library-First
650
+ - ✅ Article II: CLI Interface
651
+ - ✅ Article III: Test-First
652
+ - ✅ Article IV: EARS Format
653
+ - ✅ Article V: Traceability (100%)
654
+ - ✅ Article VI: Steering Alignment
655
+ - ✅ Article VII: Simplicity (1 project ≤ 3)
656
+ - ✅ Article VIII: No Custom Abstractions
657
+ - ✅ Article IX: Integration Tests (Real Services)
658
+
659
+ **Overall**: 9/9 ✅
660
+
661
+ **Coverage**:
662
+ - Requirements → Design: 100% ✅
663
+ - Requirements → Code: 100% ✅
664
+ - Requirements → Tests: 100% ✅
665
+ - Test Coverage: 91.5% ✅ (target: 80%)
666
+
667
+ **Quality**:
668
+ - Linting: ✅ Pass
669
+ - Type Checking: ✅ Pass
670
+ - Code Review: ✅ Pass
671
+ - Security: 0 vulnerabilities ✅
672
+ - Performance: Within targets ✅
673
+
674
+ **Production Readiness**: ✅ APPROVED
675
+
676
+ ### Next Steps:
677
+ 1. Deploy to staging
678
+ 2. Run acceptance tests
679
+ 3. Get stakeholder sign-off
680
+ 4. Deploy to production: `@devops-engineer deploy production`
681
+ ```
682
+
683
+ ---
684
+
685
+ ## Tool Usage
686
+
687
+ ### Required:
688
+ - **Read**: All specification documents, source code, tests
689
+ - **Grep**: Search for requirement IDs, patterns
690
+ - **Bash**: Run tests, linters, coverage tools
691
+
692
+ ### Skills to Invoke:
693
+ - `@traceability-auditor`: Validate 100% coverage
694
+ - `@code-reviewer`: Code quality review
695
+ - `@security-auditor`: OWASP Top 10 validation
696
+ - `@performance-optimizer`: Performance analysis
697
+
698
+ ---
699
+
700
+ ## Exit Codes
701
+
702
+ Based on validation results:
703
+
704
+ - **Exit 0**: ✅ All validations passed
705
+ - **Exit 1**: ❌ Constitutional violations detected
706
+ - **Exit 2**: ⚠️ Warnings (non-blocking issues)
707
+
708
+ ---
709
+
710
+ **Execution**: Begin validation now for the specified feature.