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,673 @@
1
+ # SDD Design Command
2
+
3
+ Generate technical design from requirements.
4
+
5
+ ---
6
+
7
+ ## Instructions for Claude
8
+
9
+ You are executing the `/sdd-design [feature-name]` command to create a technical design specification.
10
+
11
+ ### Command Format
12
+
13
+ ```bash
14
+ /sdd-design authentication
15
+ /sdd-design payment-processing
16
+ /sdd-design user-dashboard
17
+ ```
18
+
19
+ ### Your Task
20
+
21
+ Generate a comprehensive technical design that implements the requirements while adhering to constitutional governance.
22
+
23
+ ---
24
+
25
+ ## Process
26
+
27
+ ### 1. Read Context (Article VI)
28
+
29
+ **CRITICAL**: Read these files BEFORE designing:
30
+
31
+ ```bash
32
+ # Steering Context
33
+ steering/structure.md # Architecture patterns to follow
34
+ steering/tech.md # Technology stack to use
35
+ steering/product.md # Product goals and users
36
+
37
+ # Requirements
38
+ storage/specs/{{feature-name}}-requirements.md # What to implement
39
+ ```
40
+
41
+ **Extract**:
42
+ - Architecture pattern (monolith, microservices, library-first)
43
+ - Approved technologies (languages, frameworks, databases)
44
+ - Requirements to implement
45
+ - Non-functional requirements (performance, security, scale)
46
+
47
+ ---
48
+
49
+ ### 2. Verify Requirements Exist
50
+
51
+ Check if requirements file exists:
52
+
53
+ **If NOT found**:
54
+ ```markdown
55
+ ❌ **Requirements file not found**
56
+
57
+ Expected: storage/specs/{{feature-name}}-requirements.md
58
+
59
+ Please run `/sdd-requirements {{feature-name}}` first.
60
+
61
+ Design cannot proceed without requirements (Article V: Traceability).
62
+ ```
63
+
64
+ **If found**: Proceed with design
65
+
66
+ ---
67
+
68
+ ### 3. Generate Design Document
69
+
70
+ Use template from `templates/design.md`:
71
+
72
+ #### A. Architecture Design (C4 Model)
73
+
74
+ Create **3 levels** of C4 diagrams:
75
+
76
+ **Level 1: Context Diagram**
77
+ - Show system in context
78
+ - External users
79
+ - External systems
80
+ - Integration points
81
+
82
+ **Level 2: Container Diagram**
83
+ - Major deployable units
84
+ - Databases
85
+ - Message queues
86
+ - External APIs
87
+
88
+ **Level 3: Component Diagram**
89
+ - Internal components of main container
90
+ - Controllers, services, repositories
91
+ - Data flow between components
92
+
93
+ **Example**:
94
+ ```markdown
95
+ ### C4 Model: Container Diagram
96
+
97
+ ```
98
+ +--------------------------------------+
99
+ | Authentication System |
100
+ | |
101
+ | +-------------+ +-------------+ |
102
+ | | | | | |
103
+ | | Web App +-->+ API Server | |
104
+ | | (Next.js) | | (Node.js) | |
105
+ | | | | | |
106
+ | +-------------+ +------+------+ |
107
+ | | |
108
+ +---------------------------+----------+
109
+ |
110
+ | SQL
111
+ v
112
+ +--------+--------+
113
+ | PostgreSQL |
114
+ +-----------------+
115
+ ```
116
+ ```
117
+
118
+ #### B. Requirements Mapping
119
+
120
+ **CRITICAL (Article V)**: Map EVERY requirement to design decisions.
121
+
122
+ Create matrix:
123
+ ```markdown
124
+ | Component | Requirements | Design Rationale |
125
+ |-----------|-------------|------------------|
126
+ | AuthService | REQ-AUTH-001, REQ-AUTH-002 | Business logic encapsulation |
127
+ | AuthController | REQ-AUTH-003 | API exposure |
128
+ | UserRepository | REQ-AUTH-004 | Data persistence |
129
+ | JWTMiddleware | REQ-SEC-001 | Security enforcement |
130
+ ```
131
+
132
+ **Coverage Validation**:
133
+ - [ ] All functional requirements mapped
134
+ - [ ] All non-functional requirements addressed
135
+ - [ ] 100% requirements coverage
136
+
137
+ ---
138
+
139
+ ### 4. API Design
140
+
141
+ For each API endpoint:
142
+
143
+ **Structure**:
144
+ ```markdown
145
+ #### POST /api/auth/login
146
+
147
+ **Purpose**: Authenticate user with credentials
148
+
149
+ **Maps to Requirements**: REQ-AUTH-001
150
+
151
+ **Request**:
152
+ ```http
153
+ POST /api/auth/login
154
+ Content-Type: application/json
155
+
156
+ {
157
+ "email": "user@example.com",
158
+ "password": "secret123"
159
+ }
160
+ ```
161
+
162
+ **Response (Success)**:
163
+ ```http
164
+ HTTP/1.1 200 OK
165
+ Set-Cookie: session=xxx; HttpOnly; Secure
166
+
167
+ {
168
+ "user": {
169
+ "id": "uuid",
170
+ "email": "user@example.com"
171
+ },
172
+ "expiresAt": "2025-11-17T10:00:00Z"
173
+ }
174
+ ```
175
+
176
+ **Response (Error)**:
177
+ ```http
178
+ HTTP/1.1 401 Unauthorized
179
+
180
+ {
181
+ "error": "Invalid credentials"
182
+ }
183
+ ```
184
+
185
+ **Status Codes**:
186
+ - 200: Success
187
+ - 401: Invalid credentials
188
+ - 429: Rate limit exceeded
189
+ - 500: Server error
190
+
191
+ **Acceptance Criteria** (from REQ-AUTH-001):
192
+ - ✅ Validates email and password
193
+ - ✅ Returns session cookie
194
+ - ✅ Redirects to dashboard
195
+ ```
196
+
197
+ **Generate OpenAPI Spec** (if REST API):
198
+ ```yaml
199
+ openapi: 3.0.0
200
+ info:
201
+ title: Authentication API
202
+ version: 1.0.0
203
+ paths:
204
+ /api/auth/login:
205
+ post:
206
+ summary: User login
207
+ requestBody:
208
+ required: true
209
+ content:
210
+ application/json:
211
+ schema:
212
+ type: object
213
+ properties:
214
+ email:
215
+ type: string
216
+ format: email
217
+ password:
218
+ type: string
219
+ minLength: 12
220
+ ```
221
+
222
+ ---
223
+
224
+ ### 5. Database Design
225
+
226
+ #### A. Entity-Relationship Diagram
227
+
228
+ ```markdown
229
+ +-------------------+ +-------------------+
230
+ | users | | sessions |
231
+ +-------------------+ +-------------------+
232
+ | id (PK) | | id (PK) |
233
+ | email | | user_id (FK) |
234
+ | password_hash | | token |
235
+ | created_at | | expires_at |
236
+ +-------------------+ | created_at |
237
+ | +-------------------+
238
+ +------------------------------+
239
+ 1:N
240
+ ```
241
+
242
+ #### B. Schema Definition (DDL)
243
+
244
+ **Maps to Requirements**: Document which requirements need which tables.
245
+
246
+ ```sql
247
+ -- REQ-AUTH-004: User storage
248
+ CREATE TABLE users (
249
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
250
+ email VARCHAR(255) NOT NULL UNIQUE,
251
+ password_hash VARCHAR(255) NOT NULL,
252
+ created_at TIMESTAMP NOT NULL DEFAULT NOW(),
253
+ updated_at TIMESTAMP NOT NULL DEFAULT NOW()
254
+ );
255
+
256
+ CREATE INDEX idx_users_email ON users(email);
257
+
258
+ -- REQ-AUTH-005: Session management
259
+ CREATE TABLE sessions (
260
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
261
+ user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
262
+ token VARCHAR(255) NOT NULL UNIQUE,
263
+ expires_at TIMESTAMP NOT NULL,
264
+ created_at TIMESTAMP NOT NULL DEFAULT NOW()
265
+ );
266
+
267
+ CREATE INDEX idx_sessions_token ON sessions(token);
268
+ CREATE INDEX idx_sessions_user_id ON sessions(user_id);
269
+ ```
270
+
271
+ #### C. Migration Strategy
272
+
273
+ ```markdown
274
+ **Migration Tool**: Prisma Migrate
275
+
276
+ **Initial Migration**:
277
+ ```prisma
278
+ // prisma/schema.prisma
279
+ model User {
280
+ id String @id @default(uuid())
281
+ email String @unique
282
+ passwordHash String
283
+ createdAt DateTime @default(now())
284
+ updatedAt DateTime @updatedAt
285
+ sessions Session[]
286
+ }
287
+
288
+ model Session {
289
+ id String @id @default(uuid())
290
+ userId String
291
+ token String @unique
292
+ expiresAt DateTime
293
+ createdAt DateTime @default(now())
294
+ user User @relation(fields: [userId], references: [id])
295
+ }
296
+ ```
297
+ ```
298
+
299
+ ---
300
+
301
+ ### 6. Component Design (Library-First, Article I)
302
+
303
+ **CRITICAL**: Design features as libraries first.
304
+
305
+ ```markdown
306
+ ### Authentication Library
307
+
308
+ **Location**: `lib/auth/`
309
+
310
+ **Responsibilities**:
311
+ - Business logic for authentication
312
+ - Password hashing
313
+ - Session management
314
+ - JWT generation/validation
315
+
316
+ **Directory Structure**:
317
+ ```
318
+ lib/auth/
319
+ ├── src/
320
+ │ ├── index.ts # Public API
321
+ │ ├── service.ts # AuthService class
322
+ │ ├── repository.ts # UserRepository class
323
+ │ ├── password.ts # Password hashing utilities
324
+ │ ├── jwt.ts # JWT utilities
325
+ │ └── types.ts # TypeScript types
326
+ ├── tests/
327
+ │ ├── service.test.ts
328
+ │ ├── repository.test.ts
329
+ │ └── integration.test.ts
330
+ ├── cli.ts # CLI interface (Article II)
331
+ └── package.json
332
+ ```
333
+
334
+ **Public API**:
335
+ ```typescript
336
+ // lib/auth/src/index.ts
337
+ export { AuthService } from './service';
338
+ export { UserRepository } from './repository';
339
+ export type { User, Session, LoginRequest, LoginResponse } from './types';
340
+ ```
341
+
342
+ **CLI Interface** (Article II):
343
+ ```bash
344
+ # lib/auth/cli.ts commands:
345
+ auth create-user --email=user@example.com --password=secret
346
+ auth login --email=user@example.com --password=secret
347
+ auth logout --session-id=uuid
348
+ auth validate-session --token=xxx
349
+ ```
350
+ ```
351
+
352
+ ---
353
+
354
+ ### 7. Security Design (REQ-SEC-001)
355
+
356
+ Always include security design:
357
+
358
+ ```markdown
359
+ ### Authentication
360
+ - **Method**: JWT tokens
361
+ - **Storage**: HTTP-only cookies
362
+ - **Expiry**: 24 hours
363
+ - **Refresh**: 7-day refresh tokens
364
+
365
+ ### Authorization
366
+ - **Method**: Role-Based Access Control (RBAC)
367
+ - **Roles**: admin, user, guest
368
+ - **Permissions**: Defined per endpoint
369
+
370
+ ### Data Protection
371
+ - **Passwords**: bcrypt hash (cost factor 12)
372
+ - **Tokens**: Cryptographically signed JWT
373
+ - **HTTPS**: TLS 1.3 enforced
374
+ - **Sensitive Data**: PII encrypted at rest
375
+
376
+ ### Input Validation
377
+ - **XSS Prevention**: Output encoding
378
+ - **SQL Injection**: Parameterized queries (ORM)
379
+ - **CSRF**: CSRF tokens on state-changing operations
380
+ - **Rate Limiting**: 5 failed login attempts → account lock
381
+ ```
382
+
383
+ ---
384
+
385
+ ### 8. Performance Design (REQ-PERF-001)
386
+
387
+ ```markdown
388
+ ### Caching Strategy
389
+ - **Layer**: Redis
390
+ - **TTL**: User sessions (24 hours)
391
+ - **Invalidation**: On logout
392
+
393
+ ### Database Optimization
394
+ - **Indexes**: email (unique), session token (unique)
395
+ - **Connection Pooling**: 20 connections max
396
+ - **Query Optimization**: Eager load user with session
397
+
398
+ ### API Performance Targets
399
+ - **Response Time**: < 200ms (95th percentile)
400
+ - **Throughput**: 1000 requests/second
401
+ - **Concurrency**: 10,000 concurrent users
402
+ ```
403
+
404
+ ---
405
+
406
+ ### 9. Constitutional Compliance Validation
407
+
408
+ #### Article I: Library-First
409
+ - [ ] Feature designed as library (`lib/{{feature}}/`)
410
+ - [ ] Library has independent test suite
411
+ - [ ] Library has public API (`index.ts`)
412
+ - [ ] No dependencies on application code
413
+
414
+ #### Article II: CLI Interface
415
+ - [ ] CLI interface specified (`cli.ts`)
416
+ - [ ] All major operations exposed via CLI
417
+ - [ ] Help text documented
418
+ - [ ] Exit codes defined
419
+
420
+ #### Article VII: Simplicity Gate (Phase -1)
421
+ - [ ] Count projects (independently deployable units)
422
+ - [ ] If > 3 projects: Document Phase -1 Gate justification
423
+
424
+ #### Article VIII: Anti-Abstraction Gate (Phase -1)
425
+ - [ ] Check for custom abstraction layers
426
+ - [ ] If custom wrappers exist: Document justification
427
+ - [ ] Prefer framework APIs directly
428
+
429
+ **Validation Section**:
430
+ ```markdown
431
+ ## Constitutional Compliance
432
+
433
+ ### Article I: Library-First ✅
434
+ - Authentication implemented as library: `lib/auth/`
435
+ - Independent test suite: `lib/auth/tests/`
436
+ - Public API: `lib/auth/src/index.ts`
437
+
438
+ ### Article II: CLI Interface ✅
439
+ - CLI commands: create-user, login, logout, validate-session
440
+ - Help text: `auth --help`
441
+
442
+ ### Article VII: Simplicity Gate ✅
443
+ - Project count: 1 (monorepo with libraries)
444
+ - Within limit (≤ 3)
445
+
446
+ ### Article VIII: Anti-Abstraction ✅
447
+ - Uses Prisma ORM directly (no custom wrapper)
448
+ - Uses bcrypt directly (no custom abstraction)
449
+ ```
450
+
451
+ ---
452
+
453
+ ### 10. Architecture Decision Records (ADR)
454
+
455
+ Document key decisions:
456
+
457
+ ```markdown
458
+ ### ADR-001: Use JWT for Session Management
459
+
460
+ **Status**: Accepted
461
+ **Date**: 2025-11-16
462
+
463
+ **Context**:
464
+ Need stateless authentication for REQ-AUTH-001.
465
+
466
+ **Decision**:
467
+ Use JWT tokens stored in HTTP-only cookies.
468
+
469
+ **Consequences**:
470
+ - ✅ Stateless (scalable)
471
+ - ✅ No session storage needed
472
+ - ❌ Token revocation requires blocklist
473
+ - ❌ Larger cookie size
474
+
475
+ **Alternatives Considered**:
476
+ - Session-based: Rejected (requires session store, not scalable)
477
+ - OAuth 2.0: Deferred to future (overkill for v1)
478
+ ```
479
+
480
+ Document ADRs for:
481
+ - Database choice
482
+ - Authentication method
483
+ - API style (REST vs GraphQL)
484
+ - Caching strategy
485
+ - Major framework choices
486
+
487
+ ---
488
+
489
+ ### 11. Save Design Document (Bilingual)
490
+
491
+ **IMPORTANT**: Create BOTH English and Japanese versions.
492
+
493
+ **English version (Primary/Reference)**:
494
+ `storage/specs/{{feature-name}}-design.md`
495
+
496
+ **Japanese version (Translation)**:
497
+ `storage/specs/{{feature-name}}-design.ja.md`
498
+
499
+ **File Naming**:
500
+ - Use kebab-case
501
+ - Match requirements file name
502
+ - Add `-design` suffix
503
+ - Add `.ja` before `.md` for Japanese version
504
+
505
+ **Examples**:
506
+ - `storage/specs/authentication-design.md` (English)
507
+ - `storage/specs/authentication-design.ja.md` (Japanese)
508
+ - `storage/specs/payment-processing-design.md` (English)
509
+ - `storage/specs/payment-processing-design.ja.md` (Japanese)
510
+
511
+ **Generation Order**:
512
+ 1. Generate English version FIRST
513
+ 2. Then generate Japanese translation
514
+ 3. Keep technical terms in English (API endpoints, database names, requirement IDs)
515
+ 4. Translate explanations and design rationale
516
+ 5. Keep code examples and diagrams identical in both versions
517
+
518
+ ---
519
+
520
+ ### 12. Validation
521
+
522
+ Run constitutional validation:
523
+
524
+ ```bash
525
+ @constitution-enforcer validate storage/specs/{{feature-name}}-design.md
526
+ ```
527
+
528
+ **Checks**:
529
+ - Article I: Library-First enforced
530
+ - Article II: CLI interfaces specified
531
+ - Article V: All requirements mapped
532
+ - Article VII: Project count ≤ 3 (or justified)
533
+ - Article VIII: No custom abstractions (or justified)
534
+
535
+ ---
536
+
537
+ ### 13. Generate Summary
538
+
539
+ ```markdown
540
+ ## ✅ Technical Design Complete
541
+
542
+ **Feature**: {{FEATURE_NAME}}
543
+ **File**: storage/specs/{{feature-name}}-design.md
544
+
545
+ ### Architecture Summary:
546
+ - **Pattern**: [Library-first / Microservices / Monolith]
547
+ - **Components**: [N] components
548
+ - **Libraries**: lib/{{feature}}/
549
+ - **Database Tables**: [N] tables
550
+
551
+ ### Requirements Coverage:
552
+ - **Total Requirements**: [N]
553
+ - **Requirements Mapped**: [N] (100%)
554
+ - **Unmapped Requirements**: 0 ✅
555
+
556
+ ### API Endpoints:
557
+ - POST /api/{{feature}}/... ([N] endpoints total)
558
+
559
+ ### Database:
560
+ - Tables: [N]
561
+ - Indexes: [N]
562
+ - Foreign Keys: [N]
563
+
564
+ ### ADRs Created:
565
+ - ADR-001: [Decision]
566
+ - ADR-002: [Decision]
567
+
568
+ ### Constitutional Compliance:
569
+ - ✅ Article I: Library-First structure
570
+ - ✅ Article II: CLI interfaces defined
571
+ - ✅ Article V: 100% requirements coverage
572
+ - ✅ Article VI: Aligned with steering context
573
+ - ✅ Article VII: Project count within limit
574
+ - ✅ Article VIII: No custom abstractions
575
+
576
+ ### Next Steps:
577
+ 1. Review design with team
578
+ 2. Get architecture approval
579
+ 3. Break down into tasks: `/sdd-tasks {{feature-name}}`
580
+ ```
581
+
582
+ ---
583
+
584
+ ## Tool Usage
585
+
586
+ ### Required:
587
+ - **Read**: Steering files, requirements document
588
+ - **Write**: Design document
589
+ - **Grep/Glob**: Analyze existing codebase (brownfield)
590
+
591
+ ### Optional:
592
+ - **AskUserQuestion**: Clarify design decisions
593
+ - **WebSearch**: Research design patterns
594
+ - **mcp__context7__get-library-docs**: Framework documentation
595
+
596
+ ---
597
+
598
+ ## Phase -1 Gate Triggers
599
+
600
+ ### Trigger Simplicity Gate (Article VII)
601
+
602
+ If project count > 3:
603
+ ```markdown
604
+ ⚠️ **Phase -1 Gate: Simplicity**
605
+
606
+ This design proposes [N] projects (> 3 limit).
607
+
608
+ **Required Justification**:
609
+ 1. Business requirements necessitating separation
610
+ 2. Team capacity for managing [N] projects
611
+ 3. Deployment strategy
612
+
613
+ Please provide justification or reduce project count.
614
+
615
+ **Approval Required**: @system-architect + @project-manager
616
+ ```
617
+
618
+ ### Trigger Anti-Abstraction Gate (Article VIII)
619
+
620
+ If custom abstraction layers detected:
621
+ ```markdown
622
+ ⚠️ **Phase -1 Gate: Anti-Abstraction**
623
+
624
+ This design includes custom abstraction layers:
625
+ - [Abstraction 1]: Wrapper around [framework]
626
+ - [Abstraction 2]: Custom [pattern]
627
+
628
+ **Required Justification**:
629
+ 1. Multi-framework support needed
630
+ 2. Team expertise rationale
631
+ 3. Migration path
632
+
633
+ Please justify or use framework APIs directly.
634
+
635
+ **Approval Required**: @system-architect + @software-developer
636
+ ```
637
+
638
+ ---
639
+
640
+ ## Edge Cases
641
+
642
+ ### Missing Requirements
643
+
644
+ If requirements file doesn't exist:
645
+ ```markdown
646
+ ❌ **Error**: Requirements not found
647
+
648
+ Expected: storage/specs/{{feature-name}}-requirements.md
649
+
650
+ Please run `/sdd-requirements {{feature-name}}` first.
651
+
652
+ Design requires requirements for traceability (Article V).
653
+ ```
654
+
655
+ ### Missing Steering
656
+
657
+ If steering files don't exist:
658
+ ```markdown
659
+ ⚠️ **Warning**: Steering context not found
660
+
661
+ Designing without steering context may result in:
662
+ - Architecture misalignment
663
+ - Technology stack mismatch
664
+ - Product goal misalignment
665
+
666
+ Recommendation: Run `/sdd-steering` first.
667
+
668
+ Continue anyway? [Prompt user]
669
+ ```
670
+
671
+ ---
672
+
673
+ **Execution**: Begin technical design generation now for the specified feature.