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,484 @@
1
+ name = "sdd-implement"
2
+ description = "Execute implementation based on tasks following test-first approach"
3
+
4
+ [[instructions]]
5
+ role = "system"
6
+ content = """
7
+ You are executing the /sdd-implement command to implement a feature following test-first development.
8
+
9
+ # Command Format
10
+
11
+ /sdd-implement <feature-name>
12
+
13
+ Example: /sdd-implement authentication
14
+
15
+ # Your Task
16
+
17
+ Implement the feature by executing tasks in the task breakdown document, following RED-GREEN-BLUE test-first approach.
18
+
19
+ # Step 1: Read All Context
20
+
21
+ **IMPORTANT: Read these files FIRST (English versions only):**
22
+
23
+ 1. **Steering Context**:
24
+ - `steering/structure.md` - Architecture patterns
25
+ - `steering/tech.md` - Technology stack
26
+ - `steering/product.md` - Product context
27
+
28
+ 2. **Requirements**:
29
+ - `storage/specs/{{feature-name}}-requirements.md`
30
+
31
+ 3. **Design**:
32
+ - `storage/specs/{{feature-name}}-design.md`
33
+
34
+ 4. **Tasks**:
35
+ - `storage/specs/{{feature-name}}-tasks.md`
36
+
37
+ **Note**: Always read English versions (.md), not Japanese translations (.ja.md)
38
+
39
+ # Step 2: Task Execution Strategy
40
+
41
+ ## Constitutional Article III: Test-First Imperative
42
+
43
+ Follow RED-GREEN-BLUE cycle for EVERY task:
44
+
45
+ ### 🔴 RED Phase
46
+ 1. Write test that fails
47
+ 2. Run test to confirm failure
48
+ 3. Commit: "test: add failing test for [feature]"
49
+
50
+ ### 🟢 GREEN Phase
51
+ 1. Write minimal code to pass test
52
+ 2. Run test to confirm pass
53
+ 3. Commit: "feat: implement [feature]"
54
+
55
+ ### 🔵 BLUE Phase
56
+ 1. Refactor and improve code
57
+ 2. Run tests to ensure still passing
58
+ 3. Commit: "refactor: improve [feature]"
59
+
60
+ ## Task Execution Order
61
+
62
+ Execute tasks in order based on dependency graph from tasks.md:
63
+ 1. Setup & Infrastructure tasks first
64
+ 2. Core library implementation (Article I: Library-First)
65
+ 3. CLI interface (Article II)
66
+ 4. API integration
67
+ 5. Testing & quality
68
+ 6. Documentation
69
+
70
+ # Step 3: Implementation Guidelines
71
+
72
+ ## Code Quality Standards
73
+
74
+ 1. **SOLID Principles**:
75
+ - Single Responsibility
76
+ - Open/Closed
77
+ - Liskov Substitution
78
+ - Interface Segregation
79
+ - Dependency Inversion
80
+
81
+ 2. **Clean Code**:
82
+ - Meaningful names
83
+ - Small functions
84
+ - Clear comments
85
+ - DRY (Don't Repeat Yourself)
86
+ - Error handling
87
+
88
+ 3. **Type Safety**:
89
+ - TypeScript strict mode
90
+ - Explicit types
91
+ - No `any` types
92
+ - Proper generics
93
+
94
+ ## Constitutional Compliance
95
+
96
+ Ensure implementation follows all Constitutional Articles:
97
+
98
+ ### Article I: Library-First Principle
99
+ - Implement core logic in `lib/{{feature-name}}/`
100
+ - Library is framework-agnostic
101
+ - No framework coupling in lib/
102
+
103
+ ### Article II: CLI Interface Mandate
104
+ - Create `lib/{{feature-name}}/cli.ts`
105
+ - Expose all major functions via CLI
106
+ - Use commander.js or similar
107
+
108
+ ### Article III: Test-First Imperative
109
+ - Tests written BEFORE implementation
110
+ - RED-GREEN-BLUE for every component
111
+ - No code without tests
112
+
113
+ ### Article IV: EARS Requirements Format
114
+ - Every function maps to EARS requirement
115
+ - Traceability maintained
116
+
117
+ ### Article V: Traceability Mandate
118
+ - Comment requirement IDs in code
119
+ - Update traceability matrix
120
+
121
+ ### Article VI: Project Memory
122
+ - Follow patterns from steering/structure.md
123
+ - Use stack from steering/tech.md
124
+ - Align with steering/product.md
125
+
126
+ ### Article VIII: Anti-Abstraction Gate
127
+ - Use framework features directly
128
+ - No custom wrappers without justification
129
+ - Document why if abstraction needed
130
+
131
+ ### Article IX: Integration-First Testing
132
+ - Use real services in tests
133
+ - Minimize mocks
134
+ - Test with actual database
135
+
136
+ # Step 4: Implementation Process
137
+
138
+ ## For Each Task
139
+
140
+ ### 1. Read Task Details
141
+ - Understand requirements
142
+ - Review acceptance criteria
143
+ - Check dependencies
144
+
145
+ ### 2. RED Phase - Write Failing Test
146
+
147
+ Example for TASK-003 (PasswordValidator):
148
+
149
+ ```typescript
150
+ // lib/auth/__tests__/password-validator.test.ts
151
+
152
+ import { PasswordValidator } from '../password-validator';
153
+
154
+ describe('PasswordValidator', () => {
155
+ let validator: PasswordValidator;
156
+
157
+ beforeEach(() => {
158
+ validator = new PasswordValidator();
159
+ });
160
+
161
+ // REQ-AUTH-002: Password validation
162
+ describe('validate', () => {
163
+ it('should reject passwords shorter than 8 characters', () => {
164
+ const result = validator.validate('short');
165
+ expect(result.isValid).toBe(false);
166
+ expect(result.errors).toContain('Password must be at least 8 characters');
167
+ });
168
+
169
+ it('should reject passwords without special characters', () => {
170
+ const result = validator.validate('password123');
171
+ expect(result.isValid).toBe(false);
172
+ expect(result.errors).toContain('Password must contain special characters');
173
+ });
174
+
175
+ it('should accept valid passwords', () => {
176
+ const result = validator.validate('SecureP@ss123');
177
+ expect(result.isValid).toBe(true);
178
+ expect(result.errors).toHaveLength(0);
179
+ });
180
+ });
181
+
182
+ // REQ-AUTH-001: Password hashing
183
+ describe('hash and verify', () => {
184
+ it('should hash password with bcrypt', async () => {
185
+ const password = 'MySecureP@ss123';
186
+ const hash = await validator.hash(password);
187
+
188
+ expect(hash).toBeDefined();
189
+ expect(hash).not.toBe(password);
190
+ expect(hash.startsWith('$2b$')).toBe(true); // bcrypt prefix
191
+ });
192
+
193
+ it('should verify correct password', async () => {
194
+ const password = 'MySecureP@ss123';
195
+ const hash = await validator.hash(password);
196
+
197
+ const isValid = await validator.verify(password, hash);
198
+ expect(isValid).toBe(true);
199
+ });
200
+
201
+ it('should reject incorrect password', async () => {
202
+ const password = 'MySecureP@ss123';
203
+ const hash = await validator.hash(password);
204
+
205
+ const isValid = await validator.verify('WrongP@ss123', hash);
206
+ expect(isValid).toBe(false);
207
+ });
208
+ });
209
+ });
210
+ ```
211
+
212
+ Run test: `npm test` → Should FAIL (test is red)
213
+
214
+ Commit: `git commit -m "test: add password validator tests (REQ-AUTH-001, REQ-AUTH-002)"`
215
+
216
+ ### 3. GREEN Phase - Implement Code
217
+
218
+ ```typescript
219
+ // lib/auth/password-validator.ts
220
+
221
+ import bcrypt from 'bcrypt';
222
+
223
+ export interface ValidationResult {
224
+ isValid: boolean;
225
+ errors: string[];
226
+ }
227
+
228
+ /**
229
+ * Password validation and hashing service
230
+ *
231
+ * Requirements:
232
+ * - REQ-AUTH-001: Password hashing with bcrypt
233
+ * - REQ-AUTH-002: Password validation rules
234
+ */
235
+ export class PasswordValidator {
236
+ private readonly MIN_LENGTH = 8;
237
+ private readonly BCRYPT_ROUNDS = 10;
238
+
239
+ /**
240
+ * Validate password against requirements
241
+ * @param password - Password to validate
242
+ * @returns Validation result
243
+ * @requirement REQ-AUTH-002
244
+ */
245
+ validate(password: string): ValidationResult {
246
+ const errors: string[] = [];
247
+
248
+ if (password.length < this.MIN_LENGTH) {
249
+ errors.push(`Password must be at least ${this.MIN_LENGTH} characters`);
250
+ }
251
+
252
+ if (!/[!@#$%^&*(),.?":{}|<>]/.test(password)) {
253
+ errors.push('Password must contain special characters');
254
+ }
255
+
256
+ if (!/[A-Z]/.test(password)) {
257
+ errors.push('Password must contain uppercase letters');
258
+ }
259
+
260
+ if (!/[a-z]/.test(password)) {
261
+ errors.push('Password must contain lowercase letters');
262
+ }
263
+
264
+ if (!/[0-9]/.test(password)) {
265
+ errors.push('Password must contain numbers');
266
+ }
267
+
268
+ return {
269
+ isValid: errors.length === 0,
270
+ errors,
271
+ };
272
+ }
273
+
274
+ /**
275
+ * Hash password using bcrypt
276
+ * @param password - Plain text password
277
+ * @returns Hashed password
278
+ * @requirement REQ-AUTH-001
279
+ */
280
+ async hash(password: string): Promise<string> {
281
+ return bcrypt.hash(password, this.BCRYPT_ROUNDS);
282
+ }
283
+
284
+ /**
285
+ * Verify password against hash
286
+ * @param password - Plain text password
287
+ * @param hash - Hashed password
288
+ * @returns True if password matches
289
+ * @requirement REQ-AUTH-001
290
+ */
291
+ async verify(password: string, hash: string): Promise<boolean> {
292
+ return bcrypt.compare(password, hash);
293
+ }
294
+ }
295
+ ```
296
+
297
+ Run test: `npm test` → Should PASS (test is green)
298
+
299
+ Commit: `git commit -m "feat: implement password validator (REQ-AUTH-001, REQ-AUTH-002)"`
300
+
301
+ ### 4. BLUE Phase - Refactor
302
+
303
+ Improve code quality:
304
+ - Extract magic numbers to constants
305
+ - Add error handling
306
+ - Improve type safety
307
+ - Add JSDoc comments
308
+
309
+ Run test: `npm test` → Should still PASS
310
+
311
+ Commit: `git commit -m "refactor: improve password validator error messages"`
312
+
313
+ ### 5. Update Progress
314
+
315
+ Mark task as complete in tasks.md:
316
+ - TASK-003: ✅ Complete
317
+
318
+ # Step 5: Testing Requirements
319
+
320
+ ## Test Coverage
321
+
322
+ Minimum requirements:
323
+ - **Unit Tests**: 80%+ code coverage
324
+ - **Integration Tests**: All API endpoints
325
+ - **E2E Tests**: Critical user flows
326
+
327
+ ## Test Types
328
+
329
+ 1. **Unit Tests**: Test individual functions/classes
330
+ 2. **Integration Tests**: Test component interactions
331
+ 3. **E2E Tests**: Test complete user workflows
332
+ 4. **Security Tests**: OWASP Top 10 validation
333
+
334
+ ## Running Tests
335
+
336
+ ```bash
337
+ # Run all tests
338
+ npm test
339
+
340
+ # Run with coverage
341
+ npm test -- --coverage
342
+
343
+ # Run specific test file
344
+ npm test password-validator.test.ts
345
+
346
+ # Run in watch mode
347
+ npm test -- --watch
348
+ ```
349
+
350
+ # Step 6: Git Workflow
351
+
352
+ ## Commit Message Format
353
+
354
+ ```
355
+ <type>: <description> (<requirement-ids>)
356
+
357
+ <optional body>
358
+ ```
359
+
360
+ Types:
361
+ - `feat`: New feature
362
+ - `fix`: Bug fix
363
+ - `test`: Add/update tests
364
+ - `refactor`: Code refactoring
365
+ - `docs`: Documentation
366
+ - `chore`: Maintenance
367
+
368
+ Examples:
369
+ - `test: add password validator tests (REQ-AUTH-001, REQ-AUTH-002)`
370
+ - `feat: implement password validator (REQ-AUTH-001, REQ-AUTH-002)`
371
+ - `refactor: extract validation rules to constants`
372
+
373
+ ## Branch Strategy
374
+
375
+ - Feature branch: `feature/{{feature-name}}`
376
+ - Commits follow RED-GREEN-BLUE pattern
377
+ - Squash before merge (optional)
378
+
379
+ # Step 7: Documentation
380
+
381
+ ## Code Documentation
382
+
383
+ 1. **JSDoc Comments**:
384
+ - Every public function
385
+ - Include requirement IDs
386
+ - Parameter descriptions
387
+ - Return value description
388
+
389
+ 2. **README Updates**:
390
+ - Update lib/{{feature-name}}/README.md
391
+ - Usage examples
392
+ - API documentation
393
+
394
+ 3. **Traceability Matrix**:
395
+ - Update requirements mapping
396
+ - Link code to requirements
397
+
398
+ # Step 8: Validation
399
+
400
+ Before marking implementation complete:
401
+
402
+ 1. **All Tests Pass**:
403
+ - Unit tests: 80%+ coverage
404
+ - Integration tests: All passing
405
+ - E2E tests: Critical flows work
406
+
407
+ 2. **Constitutional Compliance**:
408
+ - Library-first: Code in lib/
409
+ - CLI interface: cli.ts exists
410
+ - Test-first: RED-GREEN-BLUE followed
411
+ - Requirements mapped: IDs in code
412
+
413
+ 3. **Code Quality**:
414
+ - No linting errors
415
+ - Type-safe (no any)
416
+ - SOLID principles followed
417
+ - Clean code standards met
418
+
419
+ 4. **Documentation**:
420
+ - JSDoc complete
421
+ - README updated
422
+ - Traceability matrix updated
423
+
424
+ # Step 9: Implementation Summary
425
+
426
+ After completing all tasks, create summary:
427
+
428
+ ```markdown
429
+ ## ✅ Implementation Complete: {{feature-name}}
430
+
431
+ ### Tasks Completed
432
+ - ✅ TASK-001: Database schema migration
433
+ - ✅ TASK-002: Environment configuration
434
+ - ✅ TASK-003: PasswordValidator library
435
+ - ✅ TASK-004: AuthService library
436
+ - ✅ TASK-005: CLI interface
437
+ - ✅ TASK-006: Register API endpoint
438
+ - ✅ TASK-007: Login API endpoint
439
+ - ✅ TASK-008: Integration tests
440
+ - ✅ TASK-009: Security audit
441
+ - ✅ TASK-010: API documentation
442
+
443
+ ### Requirements Fulfilled
444
+ - ✅ REQ-AUTH-001: User registration
445
+ - ✅ REQ-AUTH-002: Password validation
446
+ - ✅ REQ-AUTH-003: User login
447
+
448
+ ### Test Coverage
449
+ - Unit Tests: 85%
450
+ - Integration Tests: 100%
451
+ - E2E Tests: Critical flows covered
452
+
453
+ ### Constitutional Compliance
454
+ - ✅ Article I: Library-first (lib/auth/)
455
+ - ✅ Article II: CLI interface (lib/auth/cli.ts)
456
+ - ✅ Article III: Test-first (RED-GREEN-BLUE followed)
457
+ - ✅ Article IV: EARS requirements mapped
458
+ - ✅ Article V: Traceability maintained
459
+
460
+ ### Files Created/Modified
461
+ - lib/auth/password-validator.ts
462
+ - lib/auth/auth-service.ts
463
+ - lib/auth/cli.ts
464
+ - app/api/auth/register/route.ts
465
+ - app/api/auth/login/route.ts
466
+ - (+ 15 test files)
467
+
468
+ ### Next Steps
469
+ 1. Review implementation
470
+ 2. Validate: /sdd-validate {{feature-name}}
471
+ 3. Deploy to staging
472
+ 4. Create pull request
473
+ ```
474
+
475
+ # Next Steps
476
+
477
+ After implementation:
478
+ 1. User reviews code
479
+ 2. Run validation: /sdd-validate {{feature-name}}
480
+ 3. Create pull request
481
+ 4. Deploy to staging
482
+
483
+ **Execute implementation now, following RED-GREEN-BLUE for every task.**
484
+ """