sdd-mcp-server 3.5.1 → 5.0.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 (124) hide show
  1. package/README.md +92 -683
  2. package/agents/architect.md +15 -93
  3. package/agents/implementer.md +16 -141
  4. package/agents/planner.md +16 -84
  5. package/agents/reviewer.md +16 -239
  6. package/agents/security-auditor.md +16 -114
  7. package/agents/tdd-guide.md +17 -228
  8. package/dist/adapters/cli/SDDToolAdapter.d.ts +14 -8
  9. package/dist/adapters/cli/SDDToolAdapter.js +188 -405
  10. package/dist/adapters/cli/SDDToolAdapter.js.map +1 -1
  11. package/dist/application/services/ContextCompactionService.d.ts +88 -16
  12. package/dist/application/services/ContextCompactionService.js +474 -187
  13. package/dist/application/services/ContextCompactionService.js.map +1 -1
  14. package/dist/application/services/ProjectService.js +3 -3
  15. package/dist/application/services/ProjectService.js.map +1 -1
  16. package/dist/application/services/SpecPathResolver.d.ts +24 -0
  17. package/dist/application/services/SpecPathResolver.js +70 -0
  18. package/dist/application/services/SpecPathResolver.js.map +1 -0
  19. package/dist/application/services/WorkflowEngineService.d.ts +214 -50
  20. package/dist/application/services/WorkflowEngineService.js +1447 -292
  21. package/dist/application/services/WorkflowEngineService.js.map +1 -1
  22. package/dist/application/services/WorkflowErrors.d.ts +16 -0
  23. package/dist/application/services/WorkflowErrors.js +53 -0
  24. package/dist/application/services/WorkflowErrors.js.map +1 -0
  25. package/dist/application/services/WorkflowValidationService.d.ts +25 -46
  26. package/dist/application/services/WorkflowValidationService.js +284 -627
  27. package/dist/application/services/WorkflowValidationService.js.map +1 -1
  28. package/dist/cli/install-skills.d.ts +3 -9
  29. package/dist/cli/install-skills.js +129 -174
  30. package/dist/cli/install-skills.js.map +1 -1
  31. package/dist/cli/install-target.d.ts +42 -8
  32. package/dist/cli/install-target.js +27 -9
  33. package/dist/cli/install-target.js.map +1 -1
  34. package/dist/cli/sdd-mcp-cli.d.ts +1 -1
  35. package/dist/cli/sdd-mcp-cli.js +7 -6
  36. package/dist/cli/sdd-mcp-cli.js.map +1 -1
  37. package/dist/cli/tool-support/claude-code.js +17 -34
  38. package/dist/cli/tool-support/claude-code.js.map +1 -1
  39. package/dist/cli/tool-support/codex.d.ts +0 -53
  40. package/dist/cli/tool-support/codex.js +10 -94
  41. package/dist/cli/tool-support/codex.js.map +1 -1
  42. package/dist/cli/tool-support/index.d.ts +3 -2
  43. package/dist/cli/tool-support/index.js +3 -1
  44. package/dist/cli/tool-support/index.js.map +1 -1
  45. package/dist/cli/tool-support/mcp-registration.d.ts +22 -0
  46. package/dist/cli/tool-support/mcp-registration.js +275 -0
  47. package/dist/cli/tool-support/mcp-registration.js.map +1 -0
  48. package/dist/cli/tool-support/omp.d.ts +5 -0
  49. package/dist/cli/tool-support/omp.js +47 -0
  50. package/dist/cli/tool-support/omp.js.map +1 -0
  51. package/dist/cli/tool-support/root-guidance.d.ts +2 -9
  52. package/dist/cli/tool-support/root-guidance.js +44 -37
  53. package/dist/cli/tool-support/root-guidance.js.map +1 -1
  54. package/dist/cli/tool-support/target-agent-renderer.d.ts +1 -0
  55. package/dist/cli/tool-support/target-agent-renderer.js +37 -4
  56. package/dist/cli/tool-support/target-agent-renderer.js.map +1 -1
  57. package/dist/cli/tool-support/target-installer.d.ts +9 -3
  58. package/dist/cli/tool-support/target-installer.js +100 -26
  59. package/dist/cli/tool-support/target-installer.js.map +1 -1
  60. package/dist/cli/utils/preserving-writer.d.ts +56 -0
  61. package/dist/cli/utils/preserving-writer.js +603 -10
  62. package/dist/cli/utils/preserving-writer.js.map +1 -1
  63. package/dist/domain/ports.d.ts +4 -0
  64. package/dist/domain/types.d.ts +52 -7
  65. package/dist/domain/types.js +5 -4
  66. package/dist/domain/types.js.map +1 -1
  67. package/dist/index.d.ts +13 -10
  68. package/dist/index.js +16 -1199
  69. package/dist/index.js.map +1 -1
  70. package/dist/infrastructure/adapters/NodeFileSystemAdapter.d.ts +3 -0
  71. package/dist/infrastructure/adapters/NodeFileSystemAdapter.js +10 -0
  72. package/dist/infrastructure/adapters/NodeFileSystemAdapter.js.map +1 -1
  73. package/dist/infrastructure/mcp/CapabilityNegotiator.js +3 -3
  74. package/dist/infrastructure/mcp/CapabilityNegotiator.js.map +1 -1
  75. package/dist/infrastructure/mcp/MCPServer.js +13 -13
  76. package/dist/infrastructure/mcp/MCPServer.js.map +1 -1
  77. package/dist/infrastructure/mcp/ToolRegistry.d.ts +5 -1
  78. package/dist/infrastructure/mcp/ToolRegistry.js +11 -4
  79. package/dist/infrastructure/mcp/ToolRegistry.js.map +1 -1
  80. package/dist/infrastructure/mcp/sddToolDefinitions.d.ts +6 -0
  81. package/dist/infrastructure/mcp/sddToolDefinitions.js +110 -0
  82. package/dist/infrastructure/mcp/sddToolDefinitions.js.map +1 -0
  83. package/dist/infrastructure/schemas/project.schema.d.ts +2 -2
  84. package/dist/infrastructure/schemas/project.schema.js +2 -2
  85. package/dist/infrastructure/schemas/project.schema.js.map +1 -1
  86. package/dist/shared/version.d.ts +3 -0
  87. package/dist/shared/version.js +4 -0
  88. package/dist/shared/version.js.map +1 -0
  89. package/dist/utils/atomicWrite.d.ts +8 -35
  90. package/dist/utils/atomicWrite.js +24 -57
  91. package/dist/utils/atomicWrite.js.map +1 -1
  92. package/dist/utils/withFilesystemLock.d.ts +22 -0
  93. package/dist/utils/withFilesystemLock.js +219 -0
  94. package/dist/utils/withFilesystemLock.js.map +1 -0
  95. package/mcp-server.js +5 -2883
  96. package/package.json +8 -3
  97. package/scripts/context-usage-report.mjs +602 -0
  98. package/sdd-entry.js +17 -6
  99. package/skills/sdd-commit/REFERENCE.md +31 -0
  100. package/skills/sdd-commit/SKILL.md +17 -273
  101. package/skills/sdd-design/REFERENCE.md +51 -0
  102. package/skills/sdd-design/SKILL.md +25 -262
  103. package/skills/sdd-implement/REFERENCE.md +30 -0
  104. package/skills/sdd-implement/SKILL.md +27 -284
  105. package/skills/sdd-requirements/REFERENCE.md +39 -0
  106. package/skills/sdd-requirements/SKILL.md +28 -132
  107. package/skills/sdd-review/REFERENCE.md +26 -0
  108. package/skills/sdd-review/SKILL.md +17 -181
  109. package/skills/sdd-security-check/REFERENCE.md +19 -0
  110. package/skills/sdd-security-check/SKILL.md +18 -184
  111. package/skills/sdd-steering/REFERENCE.md +25 -0
  112. package/skills/sdd-steering/SKILL.md +18 -216
  113. package/skills/sdd-steering-custom/REFERENCE.md +27 -0
  114. package/skills/sdd-steering-custom/SKILL.md +19 -203
  115. package/skills/sdd-tasks/REFERENCE.md +25 -0
  116. package/skills/sdd-tasks/SKILL.md +27 -244
  117. package/skills/sdd-test-gen/REFERENCE.md +15 -0
  118. package/skills/sdd-test-gen/SKILL.md +17 -287
  119. package/skills/simple-task/REFERENCE.md +22 -0
  120. package/skills/simple-task/SKILL.md +17 -138
  121. package/templates/CLAUDE.md +13 -31
  122. package/templates/codex-AGENTS.md +7 -9
  123. package/rules/git-workflow.md +0 -92
  124. package/rules/sdd-workflow.md +0 -116
@@ -0,0 +1,31 @@
1
+ # Commit and Pull Request Reference
2
+
3
+ Read only when the core workflow needs examples or repository conventions do not answer the question.
4
+
5
+ ## Commit Messages
6
+
7
+ Use `<type>(<scope>): <imperative subject>` when Conventional Commits applies. Common types: `feat`, `fix`, `docs`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Keep scope specific, explain why in the body, and use `BREAKING CHANGE:` for migration-impacting behavior.
8
+
9
+ Examples:
10
+
11
+ ```text
12
+ feat(auth): add password reset flow
13
+ fix(api): preserve error cause
14
+ refactor(storage): centralize key validation
15
+ ```
16
+
17
+ Prefer one logical change per commit. Do not combine unrelated cleanup. Never claim co-authorship without consent.
18
+
19
+ ## Branches and Staging
20
+
21
+ Follow repository policy. Otherwise use a short `<type>/<ticket>-<description>` branch. Before committing, inspect status, inspect the intended diff, stage explicit paths, re-inspect the staged diff, and verify no secrets or unrelated changes entered it. Do not rewrite published history or force-push unless explicitly directed.
22
+
23
+ ## Pull Request Checklist
24
+
25
+ - concise summary and motivation;
26
+ - behavioral changes and affected artifacts;
27
+ - linked requirement/issue and breaking-change migration;
28
+ - exact tests/checks observed, with failures disclosed;
29
+ - security, privacy, compatibility, and rollout impact;
30
+ - screenshots only for visual behavior;
31
+ - unresolved blockers or follow-up work.
@@ -1,285 +1,29 @@
1
1
  ---
2
2
  name: sdd-commit
3
- description: Guide commit message and PR creation for SDD workflow. Use when committing changes, creating pull requests, or documenting changes. Invoked via /sdd-commit.
3
+ description: Commit verified SDD changes and prepare a focused pull request.
4
+ disable-model-invocation: true
4
5
  ---
5
6
 
6
- # SDD Commit & PR Guidelines
7
+ # Commit and Pull Request
7
8
 
8
- Create clear, consistent commit messages and pull requests that document changes effectively.
9
+ Run this skill locally in the current turn. Do not delegate commit, branch, or pull-request work.
9
10
 
10
- ## Commit Message Format
11
+ ## Required Workflow
11
12
 
12
- Follow the Conventional Commits specification:
13
+ 1. Inspect repository status and the exact changes to include; preserve unrelated work.
14
+ 2. Confirm the focused tests or checks relevant to those changes passed. Never claim unobserved verification.
15
+ 3. Review the staged diff before committing. Never stage secrets, credentials, generated backups, or unrelated files.
16
+ 4. Use the repository's established commit style. Otherwise use an imperative Conventional Commit subject:
17
+ `<type>(<scope>): <subject>`.
18
+ 5. Explain why in the body when the subject cannot; record breaking behavior explicitly.
19
+ 6. For a pull request, summarize intent, affected behavior, focused test evidence, migration or security impact, and unresolved blockers.
13
20
 
14
- ```
15
- <type>(<scope>): <subject>
21
+ Do not rewrite history, force-push, discard changes, bypass hooks, or create a commit unless the user requested it.
16
22
 
17
- [optional body]
23
+ ## Output
18
24
 
19
- [optional footer(s)]
20
- ```
25
+ Return the commit or PR identifier when created, the included paths, verification evidence, and any blocker. Do not echo a large diff.
21
26
 
22
- ### Type Prefixes
27
+ ## Optional Reference
23
28
 
24
- | Type | When to Use | Example |
25
- |------|-------------|---------|
26
- | `feat` | New feature | `feat(auth): add JWT refresh token` |
27
- | `fix` | Bug fix | `fix(api): handle null user response` |
28
- | `docs` | Documentation only | `docs(readme): update installation steps` |
29
- | `style` | Formatting, no code change | `style(lint): fix linter warnings` |
30
- | `refactor` | Code change, no new feature or fix | `refactor(user): extract validation logic` |
31
- | `perf` | Performance improvement | `perf(query): add index for user lookup` |
32
- | `test` | Adding/updating tests | `test(auth): add login failure tests` |
33
- | `build` | Build system changes | `build(deps): update dependencies` |
34
- | `ci` | CI/CD changes | `ci(github): add test workflow` |
35
- | `chore` | Other changes | `chore(deps): bump lodash version` |
36
- | `revert` | Revert previous commit | `revert: feat(auth): add JWT refresh` |
37
-
38
- ### Scope
39
-
40
- The scope should indicate the area affected:
41
-
42
- ```
43
- feat(auth): # Authentication module
44
- fix(api/users): # Users API endpoint
45
- docs(readme): # README file
46
- test(e2e): # End-to-end tests
47
- refactor(db): # Database layer
48
- ```
49
-
50
- ### Subject Line
51
-
52
- - Use imperative mood: "add" not "added" or "adds"
53
- - Don't capitalize first letter
54
- - No period at the end
55
- - Max 50 characters
56
-
57
- ```
58
- # GOOD
59
- feat(auth): add password reset flow
60
- fix(cart): prevent duplicate items
61
-
62
- # BAD
63
- feat(auth): Added password reset flow.
64
- fix(cart): Fixes the duplicate items bug
65
- ```
66
-
67
- ### Body (Optional)
68
-
69
- Use for explaining:
70
- - **What** changed and **why**
71
- - Breaking changes
72
- - Related issues
73
-
74
- ```
75
- feat(auth): add multi-factor authentication
76
-
77
- Implement TOTP-based 2FA for enhanced security.
78
- Users can now enable 2FA from their profile settings.
79
-
80
- - Add TOTP secret generation
81
- - Add QR code for authenticator apps
82
- - Add backup codes for recovery
83
-
84
- Closes #123
85
- ```
86
-
87
- ### Footer (Optional)
88
-
89
- ```
90
- BREAKING CHANGE: API endpoint changed from /users to /api/v1/users
91
-
92
- Refs: #123, #456
93
- Co-authored-by: Name <email@example.com>
94
- ```
95
-
96
- ## Pull Request Template
97
-
98
- ```markdown
99
- ## Summary
100
- <!-- 1-3 bullet points describing the changes -->
101
- - Add user authentication with JWT
102
- - Implement password reset flow
103
- - Add comprehensive test coverage
104
-
105
- ## Motivation
106
- <!-- Why is this change needed? -->
107
- Users need secure authentication to access protected resources.
108
-
109
- ## Changes
110
- <!-- Detailed list of changes -->
111
- ### Added
112
- - `AuthService` for handling authentication logic
113
- - `JWTProvider` for token generation/validation
114
- - Unit and integration tests for auth flow
115
-
116
- ### Changed
117
- - Updated `UserController` to use AuthService
118
- - Modified API routes to require authentication
119
-
120
- ### Removed
121
- - Deprecated session-based authentication
122
-
123
- ## Testing
124
- <!-- How was this tested? -->
125
- - [x] Unit tests pass
126
- - [x] Integration tests pass
127
- - [x] Manual testing completed
128
- - [ ] E2E tests (pending)
129
-
130
- ## Screenshots
131
- <!-- If applicable -->
132
-
133
- ## Checklist
134
- - [x] Code follows project style guidelines
135
- - [x] Tests added/updated
136
- - [x] Documentation updated
137
- - [x] No breaking changes (or documented)
138
- - [x] Security considerations reviewed
139
-
140
- ## Related Issues
141
- Closes #123
142
- Refs #456
143
- ```
144
-
145
- ## Commit Best Practices
146
-
147
- ### Atomic Commits
148
- Each commit should be one logical change:
149
-
150
- ```bash
151
- # GOOD: Separate commits for separate changes
152
- git commit -m "feat(user): add email validation"
153
- git commit -m "test(user): add email validation tests"
154
-
155
- # BAD: Multiple unrelated changes
156
- git commit -m "add email validation, fix bug, update docs"
157
- ```
158
-
159
- ### Commit Frequency
160
- - Commit when a logical unit is complete
161
- - Don't commit broken code
162
- - Small, frequent commits are better than large, infrequent ones
163
-
164
- ### Commit Message Examples
165
-
166
- #### Feature
167
- ```
168
- feat(cart): add quantity update functionality
169
-
170
- Allow users to update item quantities directly from the cart.
171
- Includes optimistic UI updates and error handling.
172
-
173
- - Add updateQuantity method to CartService
174
- - Add quantity input component
175
- - Add debounced API calls
176
-
177
- Closes #234
178
- ```
179
-
180
- #### Bug Fix
181
- ```
182
- fix(auth): prevent session fixation attack
183
-
184
- Regenerate session ID after successful login to prevent
185
- session fixation attacks.
186
-
187
- Security: OWASP A7 - Identification and Authentication Failures
188
- ```
189
-
190
- #### Refactor
191
- ```
192
- refactor(api): extract common error handling
193
-
194
- Move error handling logic to middleware for consistency
195
- across all API endpoints.
196
-
197
- - Create ErrorHandlerMiddleware
198
- - Add custom error classes
199
- - Update all controllers to throw custom errors
200
-
201
- No functional changes.
202
- ```
203
-
204
- #### Breaking Change
205
- ```
206
- feat(api)!: change user endpoint response format
207
-
208
- BREAKING CHANGE: The /api/users endpoint now returns
209
- a paginated response instead of an array.
210
-
211
- Before:
212
- [{ id: 1, name: "John" }, ...]
213
-
214
- After:
215
- {
216
- data: [{ id: 1, name: "John" }, ...],
217
- pagination: { page: 1, total: 100 }
218
- }
219
-
220
- Migration: Update all clients to handle the new response format.
221
- ```
222
-
223
- ## Branch Naming
224
-
225
- ```
226
- <type>/<ticket>-<description>
227
-
228
- Examples:
229
- feature/AUTH-123-jwt-authentication
230
- bugfix/CART-456-duplicate-items
231
- hotfix/PROD-789-security-patch
232
- chore/update-dependencies
233
- ```
234
-
235
- ## Git Workflow
236
-
237
- ### Before Committing
238
- ```bash
239
- # Check status
240
- git status
241
-
242
- # Review changes
243
- git diff
244
-
245
- # Stage specific files
246
- git add src/auth/
247
-
248
- # Or stage all
249
- git add -A
250
- ```
251
-
252
- ### Creating Commit
253
- ```bash
254
- # With message
255
- git commit -m "feat(auth): add login endpoint"
256
-
257
- # Open editor for longer message
258
- git commit
259
- ```
260
-
261
- ### Before PR
262
- ```bash
263
- # Update from main
264
- git fetch origin main
265
- git rebase origin/main
266
-
267
- # Run tests
268
- {your test command} # e.g., npm test, pytest, cargo test, go test
269
-
270
- # Push
271
- git push origin feature/AUTH-123-jwt-auth
272
- ```
273
-
274
- ## Quality Checklist
275
-
276
- - [ ] Commit message follows format
277
- - [ ] Type prefix is appropriate
278
- - [ ] Scope is specific
279
- - [ ] Subject is imperative and concise
280
- - [ ] Body explains why (if needed)
281
- - [ ] Breaking changes documented
282
- - [ ] Related issues linked
283
- - [ ] Branch name follows convention
284
- - [ ] Tests pass before commit
285
- - [ ] PR description complete
29
+ Read [REFERENCE.md](REFERENCE.md) only when message examples, branch naming, staging guidance, or the pull-request checklist is needed.
@@ -0,0 +1,51 @@
1
+ # Design Reference
2
+
3
+ Read only for format help after the mandatory core design workflow is understood.
4
+
5
+ ## Pattern Selection
6
+
7
+ - Layered or clean architecture: business rules need stable inward dependencies.
8
+ - Hexagonal: domain logic needs replaceable external adapters.
9
+ - Event-driven: asynchronous producers and consumers are inherent to the requirement.
10
+ - Service split: independent ownership/deployment is proven; do not choose it merely for fashion.
11
+
12
+ ## Exact Document Shape
13
+
14
+ ```markdown
15
+ # Design: Feature
16
+ ## Requirements Traceability
17
+ ## Architecture and Data Flow
18
+ ## Components and Interfaces
19
+ ### D-1: Decision title
20
+ **Covers:** FR-1, NFR-1
21
+ **Decision:** The chosen mechanism and trade-off.
22
+ **Failure behavior:** The observable safe failure.
23
+ **Verification:** How the decision is tested.
24
+ ## Failure Handling
25
+ ## Verification
26
+ ```
27
+
28
+ ## Component Template
29
+
30
+ ```markdown
31
+ ### Component name
32
+ Purpose and owned data:
33
+ Responsibilities and non-responsibilities:
34
+ Public interface:
35
+ Dependencies and direction:
36
+ Invariants:
37
+ Failure/timeout/retry behavior:
38
+ Authorization and validation boundary:
39
+ Verification:
40
+ ```
41
+
42
+ ## Design Checklist
43
+
44
+ - every FR/NFR maps to a decision and test strategy;
45
+ - data lifecycle, ownership, cardinality, validation, and migration are explicit;
46
+ - interfaces specify inputs, outputs, errors, idempotency, and compatibility;
47
+ - trust boundaries and least privilege are visible;
48
+ - retry behavior cannot amplify a failure or duplicate side effects;
49
+ - alternatives explain why simpler options were rejected;
50
+ - diagrams clarify real flow rather than decorate the document;
51
+ - rollout and rollback preserve valid existing state.
@@ -1,281 +1,44 @@
1
1
  ---
2
2
  name: sdd-design
3
- description: Create technical design specifications for SDD workflow. Use when designing architecture, defining components, or creating system design documents after requirements are approved. Invoked via /sdd-design <feature-name>.
3
+ description: Design an approved SDD feature with traceable components, interfaces, risks, and tests.
4
+ disable-model-invocation: true
4
5
  ---
5
6
 
6
- # SDD Technical Design Generation
7
+ # SDD Design
7
8
 
8
- Generate comprehensive technical design documents that translate approved requirements into actionable architecture specifications.
9
+ The user invokes this Skill; backend lifecycle calls are internal. Never tell the user to call a raw MCP tool or expose revision, hash, fingerprint, or backend JSON except in explicit debug output.
9
10
 
10
- ## Prerequisites
11
+ ## Resolve and Restore
11
12
 
12
- Before generating design:
13
- 1. Requirements must be generated using `/sdd-requirements`
14
- 2. Requirements phase should be approved (use `sdd-approve requirements` MCP tool)
15
- 3. Review existing architecture in `.spec/steering/tech.md` and `.spec/steering/structure.md`
13
+ 1. Internally resolve status. If no feature name is supplied, resume the sole incomplete feature or ask the user to select when several exist.
14
+ 2. Requirements must be approved. If durable status says otherwise, present the persisted blocker and make no file change.
15
+ 3. Load the latest approved compact context before method work. Load an unapproved design draft only with full mode and explicit unapproved inclusion.
16
+ 4. If status reports an observed artifact identity for an orphan or manual edit, read that exact design file before revising. Never acknowledge its hash without inspecting and deliberately incorporating or replacing its content.
16
17
 
17
- ## Workflow
18
+ If the runtime is unavailable because of host permission, report an actionable reload/trust or policy blocker; never substitute manual backend instructions.
18
19
 
19
- ### Step 1: Verify Prerequisites
20
+ ## Method and Artifact Contract
20
21
 
21
- Use `sdd-status` MCP tool to verify:
22
- - `requirements.generated: true`
23
- - `requirements.approved: true` (recommended before design)
22
+ 1. Map every FR/NFR and constraint to a design decision.
23
+ 2. Define data ownership and flow before components. Choose the simplest fitting architecture and explain trade-offs.
24
+ 3. Include exact headings `## Requirements Traceability`, `## Architecture and Data Flow`, `## Components and Interfaces`, `## Failure Handling`, and `## Verification`.
25
+ 4. Give each decision a unique `### D-N: ...` section with same-line labels `**Covers:**`, `**Decision:**`, `**Failure behavior:**`, and `**Verification:**`. `Covers` is a comma-separated list of known requirement IDs.
26
+ 5. Specify responsibilities, interfaces, dependencies, invariants, persistence/migration, compatibility, authorization, input boundaries, concurrency, failure behavior, rollback, and verification where relevant.
24
27
 
25
- ### Step 2: Review Requirements
28
+ Internally submit the complete Markdown with the exact revision and artifact identity last observed. Submission, not direct file editing, is the canonical write. Present the saved path and concise validation outcome. On failed validation, keep the durable draft, load it explicitly, and revise; do not request approval.
26
29
 
27
- 1. Read `.spec/specs/{feature}/requirements.md`
28
- 2. Identify all functional requirements (FR-*)
29
- 3. Identify all non-functional requirements (NFR-*)
30
- 4. Note constraints and assumptions
30
+ ## Human Gate
31
31
 
32
- ### Step 3: Choose Architecture Pattern
32
+ When validation passes, ask one explicit question: **“Approve this design?”** Only an unambiguous affirmative answer in this Skill flow permits internal approval of the exact reviewed revision and artifact. Never self-approve. Reread status after approval and report the persisted outcome.
33
33
 
34
- Select appropriate patterns based on requirements:
35
-
36
- | Pattern | Use When | Key Characteristics |
37
- |---------|----------|---------------------|
38
- | **Clean Architecture** | Domain-heavy apps | Layers: Domain → Use Cases → Interface → Infrastructure |
39
- | **MVC/MVP** | Web applications | Model-View-Controller separation |
40
- | **Microservices** | Distributed systems | Independent deployable services |
41
- | **Event-Driven** | Async processing | Event producers and consumers |
42
- | **Hexagonal** | Testable business logic | Ports and Adapters pattern |
43
-
44
- ### Step 4: Design Components
45
-
46
- For each component, specify:
47
-
48
- ```markdown
49
- ## Component: {ComponentName}
50
-
51
- **Type:** Service | Controller | Repository | Adapter | Provider
52
-
53
- **Purpose:** {Single responsibility description}
54
-
55
- **Responsibilities:**
56
- - {Responsibility 1}
57
- - {Responsibility 2}
58
-
59
- **Interface:**
60
- ```typescript
61
- interface I{ComponentName} {
62
- methodName(input: InputType): Promise<OutputType>;
63
- }
64
- ```
65
-
66
- **Dependencies:**
67
- - {Dependency 1 via interface}
68
- - {Dependency 2 via interface}
69
-
70
- **Error Handling:**
71
- - {Error scenario 1}: {How to handle}
72
- ```
73
-
74
- ### Step 5: Define Data Models
75
-
76
- ```markdown
77
- ## Data Models
78
-
79
- ### Model: {EntityName}
80
-
81
- **Purpose:** {What this entity represents}
82
-
83
- | Property | Type | Required | Description | Validation |
84
- |----------|------|----------|-------------|------------|
85
- | id | string | Yes | Unique identifier | UUID format |
86
- | name | string | Yes | Display name | 1-100 chars |
87
- | createdAt | Date | Yes | Creation timestamp | ISO 8601 |
88
-
89
- **Relationships:**
90
- - Has many: {RelatedEntity} (one-to-many)
91
- - Belongs to: {ParentEntity} (many-to-one)
92
-
93
- **Invariants:**
94
- - {Business rule 1}
95
- - {Business rule 2}
96
- ```
97
-
98
- ### Step 6: Specify Interfaces
99
-
100
- ```markdown
101
- ## API Interfaces
102
-
103
- ### REST Endpoints
104
-
105
- | Method | Path | Description | Request | Response | Auth |
106
- |--------|------|-------------|---------|----------|------|
107
- | POST | /api/v1/resource | Create resource | CreateDTO | Resource | Bearer |
108
- | GET | /api/v1/resource/:id | Get by ID | - | Resource | Bearer |
109
-
110
- ### Internal Service Interfaces
111
-
112
- Following Interface Segregation Principle:
113
-
114
- ```typescript
115
- // Read operations
116
- interface IResourceReader {
117
- getById(id: string): Promise<Resource>;
118
- list(filter: Filter): Promise<Resource[]>;
119
- }
120
-
121
- // Write operations
122
- interface IResourceWriter {
123
- create(data: CreateDTO): Promise<Resource>;
124
- update(id: string, data: UpdateDTO): Promise<Resource>;
125
- delete(id: string): Promise<void>;
126
- }
127
- ```
128
- ```
129
-
130
- ### Step 7: Document Error Handling
131
-
132
- ```markdown
133
- ## Error Handling Strategy
134
-
135
- ### Error Categories
136
-
137
- | Category | HTTP Status | Retry | Log Level |
138
- |----------|-------------|-------|-----------|
139
- | Validation | 400 | No | WARN |
140
- | Not Found | 404 | No | INFO |
141
- | Conflict | 409 | No | WARN |
142
- | Rate Limit | 429 | Yes (backoff) | WARN |
143
- | Internal | 500 | Yes (limited) | ERROR |
144
-
145
- ### Error Response Format
146
-
147
- ```json
148
- {
149
- "error": {
150
- "code": "VALIDATION_ERROR",
151
- "message": "Human-readable message",
152
- "details": [{ "field": "email", "issue": "Invalid format" }],
153
- "requestId": "uuid-for-tracing"
154
- }
155
- }
156
- ```
157
- ```
158
-
159
- ### Step 8: Apply Linus-Style Quality Review
160
-
161
- Before finalizing, validate against these principles:
162
-
163
- #### 1. Taste - Is it elegant?
164
- - Does the design feel natural and intuitive?
165
- - Are there unnecessary complications?
166
-
167
- #### 2. Complexity - Is it simple?
168
- - Can any component be simplified?
169
- - Are there too many abstractions?
170
-
171
- #### 3. Special Cases - Are edge cases handled?
172
- - What happens at boundaries?
173
- - How does it fail gracefully?
174
-
175
- #### 4. Data Structures - Are they optimal?
176
- - Is the right data structure chosen?
177
- - Does data flow make sense?
178
-
179
- #### 5. Code Organization - Is it maintainable?
180
- - Can new developers understand it?
181
- - Is it easy to modify?
182
-
183
- ### Step 9: Save and Validate
184
-
185
- 1. Save design to `.spec/specs/{feature}/design.md`
186
- 2. Use `sdd-validate-design` MCP tool for GO/NO-GO review
187
- 3. If GO, use `sdd-approve design` MCP tool
188
-
189
- ## Design Document Template
190
-
191
- ```markdown
192
- # Design: {Feature Name}
193
-
194
- ## Overview
195
- {Brief summary of the design approach}
196
-
197
- ## Architecture Pattern
198
- {Selected pattern and rationale}
199
-
200
- ## Component Diagram
201
- ```
202
- [Component A] ──> [Component B]
203
- │
204
- └──> [Component C]
205
- ```
206
-
207
- ## Components
208
-
209
- ### {Component 1}
210
- {Component details as described above}
211
-
212
- ## Data Models
213
-
214
- ### {Entity 1}
215
- {Model details as described above}
216
-
217
- ## Interfaces
218
-
219
- ### External APIs
220
- {API specifications}
221
-
222
- ### Internal Interfaces
223
- {Service interfaces}
224
-
225
- ## Error Handling
226
- {Error strategy}
227
-
228
- ## Security Considerations
229
- - Authentication: {approach}
230
- - Authorization: {approach}
231
- - Data protection: {approach}
232
-
233
- ## Testing Strategy
234
- - Unit tests: {coverage target}
235
- - Integration tests: {scope}
236
- - E2E tests: {critical paths}
237
-
238
- ## Dependencies
239
- - External: {list}
240
- - Internal: {list}
241
- ```
242
-
243
- ## MCP Tool Integration
244
-
245
- | Tool | When to Use |
246
- |------|-------------|
247
- | `sdd-status` | Verify requirements phase complete |
248
- | `sdd-validate-design` | Perform GO/NO-GO review |
249
- | `sdd-approve` | Mark design phase as approved |
250
-
251
- ## Steering Document References
252
-
253
- Apply these steering documents during design:
254
-
255
- | Document | Purpose | Key Application |
256
- |----------|---------|-----------------|
257
- | `.spec/steering/principles.md` | SOLID, DRY, KISS, YAGNI | Apply SOLID principles to component design, ensure interfaces follow ISP and DIP |
258
- | `.spec/steering/linus-review.md` | Code quality, data structures | Focus on data structures first, eliminate special cases, ensure backward compatibility |
34
+ ## Specialist Delegation
259
35
 
260
- **Key Linus Principles for Design:**
261
- 1. **Data Structures First**: "Bad programmers worry about the code. Good programmers worry about data structures."
262
- 2. **Eliminate Special Cases**: "Good code has no special cases"
263
- 3. **Simplicity**: "If implementation needs more than 3 levels of indentation, redesign it"
264
- 4. **Never Break Userspace**: Ensure backward compatibility
36
+ Target renderers provide the `architect` route. When a native advisor is required, dispatch exactly one compact handoff with `specialistDepth: 1`; include only approved requirements, architecture facts, constraints, and needed decisions. The specialist must not delegate again. Keep the handoff and returned summary at or below 2,048 estimated tokens. If unavailable, record one fallback and continue in the parent without retrying or spawning a generic child.
265
37
 
266
- ## Quality Checklist
38
+ ## Output
267
39
 
268
- - [ ] All FR-* requirements have corresponding components
269
- - [ ] All NFR-* requirements have technical solutions
270
- - [ ] SOLID principles are followed
271
- - [ ] Interfaces are well-defined (ISP)
272
- - [ ] Dependencies flow inward (DIP)
273
- - [ ] Data models are complete with invariants
274
- - [ ] Error handling strategy is comprehensive
275
- - [ ] Security considerations are addressed
276
- - [ ] Testing approach is specified
277
- - [ ] Linus-style review passed
40
+ Return the canonical saved path, traceable decisions, concise validation evidence, the approval question or persisted approval, and durable blockers. Do not present raw MCP operations as next steps.
278
41
 
279
- ## Specialist Delegation
42
+ ## Optional Reference
280
43
 
281
- When the host supports subagents, delegate this phase to the `architect` role with a compact handoff containing only the approved requirements, relevant project context, constraints, and required design decisions. Wait for the specialist and then integrate its result into the current workflow. If specialist delegation is unavailable, state the fallback and continue in the current agent.
44
+ Read [REFERENCE.md](REFERENCE.md) only for the exact design shape, component template, checklist, or pattern comparison.