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,613 @@
1
+ # EARS Format Guide
2
+
3
+ **EARS**: Easy Approach to Requirements Syntax
4
+
5
+ **Version**: 1.0
6
+ **Status**: Mandatory (Constitutional Article IV)
7
+
8
+ ---
9
+
10
+ ## Overview
11
+
12
+ EARS is a structured natural language format for writing unambiguous, testable requirements. All requirements in this project MUST use EARS patterns.
13
+
14
+ **Benefits**:
15
+ - Eliminates ambiguity
16
+ - Improves testability
17
+ - Enables traceability
18
+ - Standardizes requirements format
19
+
20
+ ---
21
+
22
+ ## The 5 EARS Patterns
23
+
24
+ ### 1. Ubiquitous Requirements
25
+
26
+ **Pattern**: `The [system] SHALL [requirement]`
27
+
28
+ **When to Use**: Always-active functionality
29
+
30
+ **Examples**:
31
+
32
+ ```markdown
33
+ ### REQ-AUTH-001: Password Hashing
34
+ The authentication system SHALL hash passwords using bcrypt with cost factor 12.
35
+
36
+ **Acceptance Criteria**:
37
+ - Bcrypt algorithm used
38
+ - Cost factor = 12
39
+ - Passwords never stored in plaintext
40
+ ```
41
+
42
+ ```markdown
43
+ ### REQ-LOG-001: Logging Format
44
+ The logging system SHALL output logs in JSON format.
45
+
46
+ **Acceptance Criteria**:
47
+ - All logs in valid JSON
48
+ - Required fields: timestamp, level, message, context
49
+ - ISO 8601 timestamps
50
+ ```
51
+
52
+ ---
53
+
54
+ ### 2. Event-Driven Requirements
55
+
56
+ **Pattern**: `WHEN [event or condition], the [system] SHALL [response]`
57
+
58
+ **When to Use**: Requirements triggered by events, user actions, or system conditions
59
+
60
+ **Examples**:
61
+
62
+ ```markdown
63
+ ### REQ-AUTH-002: User Login
64
+ WHEN a user provides valid credentials,
65
+ THEN the authentication system SHALL authenticate the user
66
+ AND the system SHALL create a session
67
+ AND the system SHALL redirect to the dashboard.
68
+
69
+ **Acceptance Criteria**:
70
+ - Email and password validated
71
+ - Session created with 24-hour expiry
72
+ - Redirect to /dashboard
73
+ - Login event logged
74
+ ```
75
+
76
+ ```markdown
77
+ ### REQ-NOTIFY-001: Order Confirmation
78
+ WHEN an order is successfully placed,
79
+ THEN the notification system SHALL send an email confirmation
80
+ AND the system SHALL include order details
81
+ AND the system SHALL include tracking number.
82
+
83
+ **Acceptance Criteria**:
84
+ - Email sent within 5 seconds
85
+ - Contains order ID, items, total
86
+ - Contains tracking number
87
+ - Template uses company branding
88
+ ```
89
+
90
+ ---
91
+
92
+ ### 3. State-Driven Requirements
93
+
94
+ **Pattern**: `WHILE [state or condition], the [system] SHALL [response]`
95
+
96
+ **When to Use**: Requirements that apply during a specific state
97
+
98
+ **Examples**:
99
+
100
+ ```markdown
101
+ ### REQ-UI-001: Loading Indicator
102
+ WHILE data is being fetched from the API,
103
+ the UI SHALL display a loading spinner.
104
+
105
+ **Acceptance Criteria**:
106
+ - Spinner visible during API calls
107
+ - Spinner hidden after response
108
+ - Spinner positioned in content area
109
+ - Spinner accessible (aria-label)
110
+ ```
111
+
112
+ ```markdown
113
+ ### REQ-CACHE-001: Cache Invalidation
114
+ WHILE a resource is in the cache,
115
+ the caching system SHALL serve the cached version
116
+ AND the system SHALL validate freshness based on TTL.
117
+
118
+ **Acceptance Criteria**:
119
+ - Cached resource served if TTL not exceeded
120
+ - TTL checked on each request
121
+ - Expired cache entries evicted
122
+ - Cache-Control headers honored
123
+ ```
124
+
125
+ ---
126
+
127
+ ### 4. Unwanted Behavior Requirements
128
+
129
+ **Pattern**: `IF [unwanted condition or error], THEN the [system] SHALL [response]`
130
+
131
+ **When to Use**: Error handling, edge cases, failure scenarios
132
+
133
+ **Examples**:
134
+
135
+ ```markdown
136
+ ### REQ-AUTH-003: Invalid Credentials
137
+ IF a user provides invalid credentials,
138
+ THEN the authentication system SHALL reject the login attempt
139
+ AND the system SHALL return HTTP 401
140
+ AND the system SHALL log the failed attempt
141
+ AND the system SHALL increment the rate limit counter.
142
+
143
+ **Acceptance Criteria**:
144
+ - HTTP 401 response with error message
145
+ - Generic error message (no email/password specifics)
146
+ - Failed attempt logged with timestamp and IP
147
+ - Rate limit applies after 5 failed attempts
148
+ ```
149
+
150
+ ```markdown
151
+ ### REQ-API-001: Request Timeout
152
+ IF an API request exceeds 30 seconds,
153
+ THEN the API gateway SHALL terminate the request
154
+ AND the system SHALL return HTTP 504
155
+ AND the system SHALL log the timeout event.
156
+
157
+ **Acceptance Criteria**:
158
+ - Request terminated at exactly 30 seconds
159
+ - HTTP 504 Gateway Timeout response
160
+ - Timeout logged with request ID and duration
161
+ - Client receives descriptive error message
162
+ ```
163
+
164
+ ---
165
+
166
+ ### 5. Optional Feature Requirements
167
+
168
+ **Pattern**: `WHERE [feature or configuration is enabled], the [system] SHALL [response]`
169
+
170
+ **When to Use**: Feature flags, optional functionality, configuration-dependent behavior
171
+
172
+ **Examples**:
173
+
174
+ ```markdown
175
+ ### REQ-FEATURE-001: Two-Factor Authentication
176
+ WHERE two-factor authentication is enabled for a user,
177
+ the authentication system SHALL require OTP verification
178
+ AND the system SHALL send OTP via email or SMS
179
+ AND the system SHALL validate OTP within 5 minutes.
180
+
181
+ **Acceptance Criteria**:
182
+ - OTP required only if 2FA enabled
183
+ - OTP sent to user's configured channel
184
+ - OTP expires after 5 minutes
185
+ - OTP is 6 digits
186
+ - Invalid OTP returns error
187
+ ```
188
+
189
+ ```markdown
190
+ ### REQ-DEBUG-001: Debug Mode Logging
191
+ WHERE debug mode is enabled,
192
+ the logging system SHALL output debug-level logs
193
+ AND the system SHALL include stack traces
194
+ AND the system SHALL log query execution times.
195
+
196
+ **Acceptance Criteria**:
197
+ - Debug logs only in debug mode
198
+ - Stack traces included in error logs
199
+ - Query times logged to milliseconds
200
+ - Production mode excludes debug logs
201
+ ```
202
+
203
+ ---
204
+
205
+ ## EARS Syntax Rules
206
+
207
+ ### Structure
208
+
209
+ ```markdown
210
+ ### [Requirement ID]: [Short Title]
211
+
212
+ [EARS Pattern Statement]
213
+
214
+ **Acceptance Criteria**:
215
+ - [Criterion 1]
216
+ - [Criterion 2]
217
+ - [Criterion 3]
218
+
219
+ **Priority**: [P0/P1/P2/P3]
220
+ **Status**: [Draft/Approved/Implemented/Tested]
221
+ **Traceability**:
222
+ - Design: [design-reference]
223
+ - Code: [file-path:line-number]
224
+ - Tests: [test-reference]
225
+ ```
226
+
227
+ ### Requirement IDs
228
+
229
+ **Format**: `REQ-[COMPONENT]-[NUMBER]`
230
+
231
+ **Examples**:
232
+ - `REQ-AUTH-001` - Authentication component, requirement #1
233
+ - `REQ-API-042` - API component, requirement #42
234
+ - `REQ-DB-015` - Database component, requirement #15
235
+
236
+ **Rules**:
237
+ - All uppercase
238
+ - Unique within project
239
+ - Sequential numbering per component
240
+ - Never reuse IDs
241
+
242
+ ### Keywords
243
+
244
+ **Mandatory Keywords**:
245
+ - `SHALL` - Mandatory requirement
246
+ - `SHALL NOT` - Mandatory prohibition
247
+
248
+ **Conditional Keywords**:
249
+ - `WHEN` - Event-driven
250
+ - `WHILE` - State-driven
251
+ - `IF` - Unwanted behavior
252
+ - `WHERE` - Optional feature
253
+ - `THEN` - Consequence
254
+ - `AND` - Additional consequence
255
+
256
+ **Avoid**:
257
+ - `SHOULD` - Ambiguous (mandatory or optional?)
258
+ - `MAY` - Ambiguous (optional or allowed?)
259
+ - `WILL` - Ambiguous (future intent or requirement?)
260
+ - `MUST` - Use `SHALL` instead for consistency
261
+
262
+ ---
263
+
264
+ ## Acceptance Criteria
265
+
266
+ Every requirement MUST have acceptance criteria that:
267
+ - Are testable
268
+ - Are measurable
269
+ - Are unambiguous
270
+ - Cover normal and error cases
271
+ - Specify expected behavior
272
+
273
+ **Good Acceptance Criteria**:
274
+ ```markdown
275
+ - Response time < 200ms (95th percentile)
276
+ - HTTP 200 response with valid JSON
277
+ - Password minimum 12 characters
278
+ - Email sent within 5 seconds
279
+ ```
280
+
281
+ **Bad Acceptance Criteria**:
282
+ ```markdown
283
+ - Fast response time (not measurable)
284
+ - Returns success (ambiguous)
285
+ - Strong password (not specific)
286
+ - Email sent quickly (not measurable)
287
+ ```
288
+
289
+ ---
290
+
291
+ ## Complete Example: User Registration
292
+
293
+ ```markdown
294
+ ## Feature: User Registration
295
+
296
+ ### REQ-REG-001: Account Creation
297
+ WHEN a user submits valid registration information,
298
+ THEN the registration system SHALL create a new user account
299
+ AND the system SHALL hash the password using bcrypt
300
+ AND the system SHALL send a verification email
301
+ AND the system SHALL return HTTP 201 with user ID.
302
+
303
+ **Acceptance Criteria**:
304
+ - Email unique in database
305
+ - Password hashed with bcrypt cost 12
306
+ - Verification email sent within 5 seconds
307
+ - HTTP 201 response with user ID and email
308
+ - User record created in database
309
+ - User status set to "pending verification"
310
+
311
+ **Priority**: P0
312
+ **Status**: Approved
313
+ **Traceability**:
314
+ - Design: design.md#user-registration-api
315
+ - Code: src/auth/registration.ts:45-89
316
+ - Tests: tests/auth/registration.test.ts:23-67
317
+
318
+ ---
319
+
320
+ ### REQ-REG-002: Email Validation
321
+ The registration system SHALL validate email format using RFC 5322 regex.
322
+
323
+ **Acceptance Criteria**:
324
+ - Valid emails accepted (user@example.com)
325
+ - Invalid emails rejected (user@, @example.com)
326
+ - HTTP 400 response for invalid email
327
+ - Error message: "Invalid email format"
328
+
329
+ **Priority**: P0
330
+ **Status**: Approved
331
+ **Traceability**:
332
+ - Design: design.md#email-validation
333
+ - Code: src/auth/validators.ts:12-23
334
+ - Tests: tests/auth/validators.test.ts:45-78
335
+
336
+ ---
337
+
338
+ ### REQ-REG-003: Duplicate Email
339
+ IF a user attempts to register with an existing email,
340
+ THEN the registration system SHALL reject the registration
341
+ AND the system SHALL return HTTP 409
342
+ AND the system SHALL return error message "Email already registered".
343
+
344
+ **Acceptance Criteria**:
345
+ - Database uniqueness constraint on email column
346
+ - HTTP 409 Conflict response
347
+ - Error message exactly: "Email already registered"
348
+ - No account created
349
+ - No email sent
350
+
351
+ **Priority**: P0
352
+ **Status**: Approved
353
+ **Traceability**:
354
+ - Design: design.md#duplicate-email-handling
355
+ - Code: src/auth/registration.ts:34-42
356
+ - Tests: tests/auth/registration.test.ts:89-112
357
+
358
+ ---
359
+
360
+ ### REQ-REG-004: Password Strength
361
+ The registration system SHALL enforce password requirements:
362
+ - Minimum 12 characters
363
+ - At least 1 uppercase letter
364
+ - At least 1 lowercase letter
365
+ - At least 1 number
366
+ - At least 1 special character (!@#$%^&*).
367
+
368
+ **Acceptance Criteria**:
369
+ - Weak passwords rejected (HTTP 400)
370
+ - Error message lists unmet requirements
371
+ - Strong passwords accepted
372
+ - Validation before database insert
373
+
374
+ **Priority**: P0
375
+ **Status**: Approved
376
+ **Traceability**:
377
+ - Design: design.md#password-strength
378
+ - Code: src/auth/validators.ts:34-56
379
+ - Tests: tests/auth/validators.test.ts:112-167
380
+
381
+ ---
382
+
383
+ ### REQ-REG-005: Email Verification
384
+ WHERE email verification is enabled,
385
+ the registration system SHALL require users to verify their email
386
+ AND the system SHALL generate a verification token
387
+ AND the system SHALL expire tokens after 24 hours.
388
+
389
+ **Acceptance Criteria**:
390
+ - Verification token generated (UUID v4)
391
+ - Token stored in database with expiry
392
+ - Verification email contains token link
393
+ - Token expires after 24 hours
394
+ - Expired tokens return HTTP 410
395
+ - Verified users can log in
396
+ - Unverified users cannot log in
397
+
398
+ **Priority**: P1
399
+ **Status**: Approved
400
+ **Traceability**:
401
+ - Design: design.md#email-verification
402
+ - Code: src/auth/verification.ts:23-89
403
+ - Tests: tests/auth/verification.test.ts:34-123
404
+ ```
405
+
406
+ ---
407
+
408
+ ## Common Mistakes
409
+
410
+ ### 1. Ambiguous Verbs
411
+
412
+ ❌ **Bad**: The system should validate input.
413
+ ✅ **Good**: The system SHALL validate input against schema.
414
+
415
+ ### 2. Missing Trigger
416
+
417
+ ❌ **Bad**: The system SHALL send email.
418
+ ✅ **Good**: WHEN a user registers, the system SHALL send a verification email.
419
+
420
+ ### 3. Compound Requirements
421
+
422
+ ❌ **Bad**: The system SHALL authenticate users and send emails and log events.
423
+ ✅ **Good**: Split into 3 requirements (REQ-001: authentication, REQ-002: email, REQ-003: logging)
424
+
425
+ ### 4. Implementation Details
426
+
427
+ ❌ **Bad**: The system SHALL use bcrypt version 2a with salt rounds 12.
428
+ ✅ **Good**: The system SHALL hash passwords using a secure one-way hash function.
429
+
430
+ **Note**: Implementation details belong in design.md, not requirements.
431
+
432
+ ### 5. Vague Acceptance Criteria
433
+
434
+ ❌ **Bad**: System is fast and secure.
435
+ ✅ **Good**:
436
+ - Response time < 200ms (95th percentile)
437
+ - Passwords hashed with bcrypt cost 12
438
+ - HTTPS enforced
439
+
440
+ ---
441
+
442
+ ## EARS and Traceability
443
+
444
+ Every EARS requirement MUST be traceable to:
445
+
446
+ ### Design (requirements.md → design.md)
447
+ ```markdown
448
+ **Traceability**:
449
+ - Design: design.md#user-authentication-architecture
450
+ - ADR: decisions/001-use-jwt-tokens.md
451
+ ```
452
+
453
+ ### Code (requirements.md → source code)
454
+ ```markdown
455
+ **Traceability**:
456
+ - Code: src/auth/login.ts:45-89
457
+ - Code: src/auth/jwt.ts:23-67
458
+ ```
459
+
460
+ ### Tests (requirements.md → test code)
461
+ ```markdown
462
+ **Traceability**:
463
+ - Tests: tests/auth/login.test.ts:34-78
464
+ - Tests: tests/integration/auth-flow.test.ts:112-156
465
+ ```
466
+
467
+ **Enforcement**: Use `@traceability-auditor` skill to validate 100% coverage.
468
+
469
+ ---
470
+
471
+ ## EARS for Different Requirement Types
472
+
473
+ ### Functional Requirements
474
+
475
+ Use event-driven or ubiquitous patterns:
476
+ ```markdown
477
+ WHEN user clicks "Submit", the form SHALL validate all fields.
478
+ The API SHALL return JSON responses.
479
+ ```
480
+
481
+ ### Non-Functional Requirements
482
+
483
+ Use ubiquitous or state-driven patterns:
484
+ ```markdown
485
+ The API SHALL respond within 200ms (95th percentile).
486
+ WHILE processing payments, the system SHALL encrypt data using AES-256.
487
+ ```
488
+
489
+ ### Security Requirements
490
+
491
+ Use ubiquitous or unwanted behavior patterns:
492
+ ```markdown
493
+ The authentication system SHALL prevent SQL injection attacks.
494
+ IF a user exceeds 5 failed login attempts, THEN the system SHALL lock the account.
495
+ ```
496
+
497
+ ### Performance Requirements
498
+
499
+ Use ubiquitous with measurable criteria:
500
+ ```markdown
501
+ The search function SHALL return results within 100ms for queries up to 10 keywords.
502
+
503
+ **Acceptance Criteria**:
504
+ - 95th percentile < 100ms
505
+ - 99th percentile < 200ms
506
+ - Tested with 1000 concurrent users
507
+ ```
508
+
509
+ ---
510
+
511
+ ## EARS and Delta Specifications (Brownfield)
512
+
513
+ ### ADDED Requirements
514
+
515
+ ```markdown
516
+ ## ADDED Requirements
517
+
518
+ ### REQ-AUTH-042: Two-Factor Authentication (NEW)
519
+ WHERE two-factor authentication is enabled,
520
+ the authentication system SHALL require OTP verification.
521
+
522
+ **Justification**: Security enhancement requested by compliance team.
523
+ **Impact**: Adds new authentication step; backward compatible (opt-in).
524
+ ```
525
+
526
+ ### MODIFIED Requirements
527
+
528
+ ```markdown
529
+ ## MODIFIED Requirements
530
+
531
+ ### REQ-AUTH-001: Password Hashing (MODIFIED)
532
+
533
+ **Previous**:
534
+ The authentication system SHALL hash passwords using bcrypt with cost factor 10.
535
+
536
+ **Updated**:
537
+ The authentication system SHALL hash passwords using bcrypt with cost factor 12.
538
+
539
+ **Reason**: Increased security standard.
540
+ **Breaking Change**: No (existing hashes remain valid).
541
+ **Migration**: Rehash passwords on next login.
542
+ ```
543
+
544
+ ### REMOVED Requirements
545
+
546
+ ```markdown
547
+ ## REMOVED Requirements
548
+
549
+ ### REQ-AUTH-015: "Remember Me" Feature (REMOVED)
550
+
551
+ **Reason**: Security policy change prohibits long-lived sessions.
552
+ **Breaking Change**: Yes (feature removal).
553
+ **Migration**: Users must log in on each visit.
554
+ **Communication**: Announce 30 days before removal.
555
+ ```
556
+
557
+ ---
558
+
559
+ ## Quick Reference
560
+
561
+ | Pattern | Keyword | Use Case | Example |
562
+ |---------|---------|----------|---------|
563
+ | Ubiquitous | `The [system] SHALL` | Always-active functionality | The API SHALL authenticate requests |
564
+ | Event-Driven | `WHEN ... THEN` | Triggered by events | WHEN user clicks Submit, THEN validate form |
565
+ | State-Driven | `WHILE ... SHALL` | Active during state | WHILE loading, UI SHALL show spinner |
566
+ | Unwanted | `IF ... THEN` | Error handling | IF timeout, THEN return HTTP 504 |
567
+ | Optional | `WHERE ... SHALL` | Feature flags | WHERE 2FA enabled, SHALL require OTP |
568
+
569
+ ---
570
+
571
+ ## Tools and Validation
572
+
573
+ ### Validation Command
574
+
575
+ ```bash
576
+ @constitution-enforcer validate requirements.md
577
+ ```
578
+
579
+ **Checks**:
580
+ - All requirements use EARS patterns
581
+ - All requirements have IDs
582
+ - All requirements have acceptance criteria
583
+ - No ambiguous keywords (SHOULD, MUST, MAY)
584
+
585
+ ### Traceability Command
586
+
587
+ ```bash
588
+ @traceability-auditor validate requirements.md
589
+ ```
590
+
591
+ **Checks**:
592
+ - All requirements mapped to design
593
+ - All requirements mapped to code
594
+ - All requirements mapped to tests
595
+ - 100% coverage achieved
596
+
597
+ ---
598
+
599
+ ## Summary
600
+
601
+ **EARS Compliance Checklist**:
602
+ - [ ] All requirements use one of 5 EARS patterns
603
+ - [ ] All requirements have unique IDs (REQ-XXX-NNN)
604
+ - [ ] All requirements use SHALL/SHALL NOT (not SHOULD/MUST/MAY)
605
+ - [ ] All requirements have acceptance criteria
606
+ - [ ] All acceptance criteria are testable and measurable
607
+ - [ ] All requirements are traceable (design, code, tests)
608
+ - [ ] No compound requirements (one requirement = one concern)
609
+ - [ ] No implementation details in requirements
610
+
611
+ ---
612
+
613
+ **Powered by MUSUBI** - EARS format for unambiguous requirements.