sdd-mcp-server 3.5.0 → 4.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.
- package/README.md +97 -671
- package/agents/architect.md +15 -93
- package/agents/implementer.md +16 -141
- package/agents/planner.md +16 -84
- package/agents/reviewer.md +16 -239
- package/agents/security-auditor.md +16 -114
- package/agents/tdd-guide.md +17 -228
- package/dist/adapters/cli/SDDToolAdapter.d.ts +14 -5
- package/dist/adapters/cli/SDDToolAdapter.js +189 -362
- package/dist/adapters/cli/SDDToolAdapter.js.map +1 -1
- package/dist/application/services/ContextCompactionService.d.ts +81 -16
- package/dist/application/services/ContextCompactionService.js +370 -187
- package/dist/application/services/ContextCompactionService.js.map +1 -1
- package/dist/application/services/SpecPathResolver.d.ts +24 -0
- package/dist/application/services/SpecPathResolver.js +70 -0
- package/dist/application/services/SpecPathResolver.js.map +1 -0
- package/dist/application/services/WorkflowEngineService.d.ts +100 -46
- package/dist/application/services/WorkflowEngineService.js +468 -288
- package/dist/application/services/WorkflowEngineService.js.map +1 -1
- package/dist/cli/install-skills.d.ts +3 -9
- package/dist/cli/install-skills.js +130 -175
- package/dist/cli/install-skills.js.map +1 -1
- package/dist/cli/install-target.d.ts +45 -14
- package/dist/cli/install-target.js +26 -12
- package/dist/cli/install-target.js.map +1 -1
- package/dist/cli/sdd-mcp-cli.d.ts +1 -1
- package/dist/cli/sdd-mcp-cli.js +7 -6
- package/dist/cli/sdd-mcp-cli.js.map +1 -1
- package/dist/cli/tool-support/claude-code.js +13 -34
- package/dist/cli/tool-support/claude-code.js.map +1 -1
- package/dist/cli/tool-support/codex.d.ts +0 -53
- package/dist/cli/tool-support/codex.js +6 -94
- package/dist/cli/tool-support/codex.js.map +1 -1
- package/dist/cli/tool-support/index.d.ts +3 -2
- package/dist/cli/tool-support/index.js +3 -1
- package/dist/cli/tool-support/index.js.map +1 -1
- package/dist/cli/tool-support/omp.d.ts +5 -0
- package/dist/cli/tool-support/omp.js +43 -0
- package/dist/cli/tool-support/omp.js.map +1 -0
- package/dist/cli/tool-support/root-guidance.d.ts +2 -9
- package/dist/cli/tool-support/root-guidance.js +44 -37
- package/dist/cli/tool-support/root-guidance.js.map +1 -1
- package/dist/cli/tool-support/target-agent-renderer.d.ts +1 -0
- package/dist/cli/tool-support/target-agent-renderer.js +37 -4
- package/dist/cli/tool-support/target-agent-renderer.js.map +1 -1
- package/dist/cli/tool-support/target-installer.d.ts +8 -2
- package/dist/cli/tool-support/target-installer.js +94 -26
- package/dist/cli/tool-support/target-installer.js.map +1 -1
- package/dist/cli/utils/preserving-writer.d.ts +22 -0
- package/dist/cli/utils/preserving-writer.js +233 -11
- package/dist/cli/utils/preserving-writer.js.map +1 -1
- package/dist/domain/ports.d.ts +4 -0
- package/dist/index.d.ts +13 -10
- package/dist/index.js +16 -1199
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/adapters/NodeFileSystemAdapter.d.ts +3 -0
- package/dist/infrastructure/adapters/NodeFileSystemAdapter.js +10 -0
- package/dist/infrastructure/adapters/NodeFileSystemAdapter.js.map +1 -1
- package/dist/infrastructure/mcp/CapabilityNegotiator.js +3 -3
- package/dist/infrastructure/mcp/CapabilityNegotiator.js.map +1 -1
- package/dist/infrastructure/mcp/sddToolDefinitions.d.ts +6 -0
- package/dist/infrastructure/mcp/sddToolDefinitions.js +124 -0
- package/dist/infrastructure/mcp/sddToolDefinitions.js.map +1 -0
- package/dist/utils/atomicWrite.d.ts +8 -35
- package/dist/utils/atomicWrite.js +12 -60
- package/dist/utils/atomicWrite.js.map +1 -1
- package/mcp-server.js +5 -2883
- package/package.json +5 -2
- package/scripts/context-usage-report.mjs +602 -0
- package/sdd-entry.js +17 -6
- package/skills/sdd-commit/REFERENCE.md +31 -0
- package/skills/sdd-commit/SKILL.md +17 -273
- package/skills/sdd-design/REFERENCE.md +35 -0
- package/skills/sdd-design/SKILL.md +19 -265
- package/skills/sdd-implement/REFERENCE.md +26 -0
- package/skills/sdd-implement/SKILL.md +22 -283
- package/skills/sdd-requirements/REFERENCE.md +31 -0
- package/skills/sdd-requirements/SKILL.md +23 -135
- package/skills/sdd-review/REFERENCE.md +26 -0
- package/skills/sdd-review/SKILL.md +17 -181
- package/skills/sdd-security-check/REFERENCE.md +19 -0
- package/skills/sdd-security-check/SKILL.md +18 -184
- package/skills/sdd-steering/REFERENCE.md +25 -0
- package/skills/sdd-steering/SKILL.md +18 -216
- package/skills/sdd-steering-custom/REFERENCE.md +27 -0
- package/skills/sdd-steering-custom/SKILL.md +19 -203
- package/skills/sdd-tasks/REFERENCE.md +25 -0
- package/skills/sdd-tasks/SKILL.md +19 -248
- package/skills/sdd-test-gen/REFERENCE.md +15 -0
- package/skills/sdd-test-gen/SKILL.md +17 -287
- package/skills/simple-task/REFERENCE.md +22 -0
- package/skills/simple-task/SKILL.md +17 -138
- package/templates/CLAUDE.md +18 -30
- package/rules/git-workflow.md +0 -92
- 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:
|
|
3
|
+
description: Commit verified SDD changes and prepare a focused pull request.
|
|
4
|
+
disable-model-invocation: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
#
|
|
7
|
+
# Commit and Pull Request
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
Run this skill locally in the current turn. Do not delegate commit, branch, or pull-request work.
|
|
9
10
|
|
|
10
|
-
##
|
|
11
|
+
## Required Workflow
|
|
11
12
|
|
|
12
|
-
|
|
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
|
-
|
|
23
|
+
## Output
|
|
18
24
|
|
|
19
|
-
|
|
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
|
-
|
|
27
|
+
## Optional Reference
|
|
23
28
|
|
|
24
|
-
|
|
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,35 @@
|
|
|
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
|
+
## Component Template
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
### Component name
|
|
16
|
+
Purpose and owned data:
|
|
17
|
+
Responsibilities and non-responsibilities:
|
|
18
|
+
Public interface:
|
|
19
|
+
Dependencies and direction:
|
|
20
|
+
Invariants:
|
|
21
|
+
Failure/timeout/retry behavior:
|
|
22
|
+
Authorization and validation boundary:
|
|
23
|
+
Verification:
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Design Checklist
|
|
27
|
+
|
|
28
|
+
- every FR/NFR maps to a decision and test strategy;
|
|
29
|
+
- data lifecycle, ownership, cardinality, validation, and migration are explicit;
|
|
30
|
+
- interfaces specify inputs, outputs, errors, idempotency, and compatibility;
|
|
31
|
+
- trust boundaries and least privilege are visible;
|
|
32
|
+
- retry behavior cannot amplify a failure or duplicate side effects;
|
|
33
|
+
- alternatives explain why simpler options were rejected;
|
|
34
|
+
- diagrams clarify real flow rather than decorate the document;
|
|
35
|
+
- rollout and rollback preserve valid existing state.
|
|
@@ -1,281 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sdd-design
|
|
3
|
-
description:
|
|
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
|
|
7
|
-
|
|
8
|
-
Generate comprehensive technical design documents that translate approved requirements into actionable architecture specifications.
|
|
7
|
+
# SDD Design
|
|
9
8
|
|
|
10
9
|
## Prerequisites
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
3. Review existing architecture in `.spec/steering/tech.md` and `.spec/steering/structure.md`
|
|
11
|
+
- Resolve the feature with `sdd-status`.
|
|
12
|
+
- Requirements must be generated and approved. Stop rather than designing from an unapproved draft.
|
|
13
|
+
- Read approved requirements plus relevant product, technology, and structure steering.
|
|
16
14
|
|
|
17
15
|
## Workflow
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
31
|
-
|
|
32
|
-
### Step 3: Choose Architecture Pattern
|
|
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
|
|
17
|
+
1. Map every FR/NFR and constraint to a design decision.
|
|
18
|
+
2. Define data ownership and flow before components. Choose the simplest fitting architecture and explain trade-offs.
|
|
19
|
+
3. Specify component responsibilities, public interfaces, dependencies, invariants, and failure behavior.
|
|
20
|
+
4. Cover persistence/migration, concurrency, compatibility, authorization, input boundaries, sensitive data, observability, and rollback where relevant.
|
|
21
|
+
5. Define unit, integration, and end-to-end verification against acceptance criteria.
|
|
22
|
+
6. Write `.spec/specs/{feature}/design.md`, then run `sdd-validate-design`. Resolve a NO-GO result before requesting design approval.
|
|
23
|
+
7. Request approval only after the design is complete and requirements remain traceable.
|
|
136
24
|
|
|
137
|
-
|
|
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 |
|
|
25
|
+
## Specialist Delegation
|
|
259
26
|
|
|
260
|
-
|
|
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
|
|
27
|
+
Target renderers provide the `architect` route. When a native advisor is required, dispatch exactly one compact handoff with `specialistDepth: 1`; include only approved requirements, relevant architecture facts, constraints, and decisions needed. The specialist must not delegate again. Keep both the handoff and returned summary at or below 2,048 estimated tokens. Integrate its decisions and verification evidence. If the advisor or routed model is unavailable, record one fallback and continue in the parent without retrying or spawning a generic child. Where the target applies a native per-turn model override, execute in this turn instead of spawning.
|
|
265
28
|
|
|
266
|
-
##
|
|
29
|
+
## Output
|
|
267
30
|
|
|
268
|
-
|
|
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
|
|
31
|
+
The design must include overview, requirements traceability, architecture/data flow, components, interfaces, data models, errors, security, testing, dependencies, alternatives, and risks.
|
|
278
32
|
|
|
279
|
-
##
|
|
33
|
+
## Optional Reference
|
|
280
34
|
|
|
281
|
-
|
|
35
|
+
Read [REFERENCE.md](REFERENCE.md) only when a component template, design checklist, or architecture-pattern comparison is needed.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Implementation Reference
|
|
2
|
+
|
|
3
|
+
Read only when a detailed checklist is needed for the current task.
|
|
4
|
+
|
|
5
|
+
## Design Prompts
|
|
6
|
+
|
|
7
|
+
- SRP: does each unit own one reason to change?
|
|
8
|
+
- OCP: is a real extension point needed, or is direct code simpler?
|
|
9
|
+
- LSP: can every subtype preserve the advertised contract?
|
|
10
|
+
- ISP: can consumers depend on a smaller capability?
|
|
11
|
+
- DIP: do policy decisions avoid depending on infrastructure details?
|
|
12
|
+
- Prefer KISS and YAGNI over speculative abstraction; eliminate special cases through better data shape when possible.
|
|
13
|
+
|
|
14
|
+
## Security Prompts
|
|
15
|
+
|
|
16
|
+
Check only relevant risks, but never skip the analysis: authorization/ownership, validation and canonicalization, parameterized queries and command arguments, output encoding, safe URL handling, cryptographic primitives, secret storage, session state, dependency integrity, error disclosure, and sensitive logging. Default deny at trust boundaries and clean up resources on every failure path.
|
|
17
|
+
|
|
18
|
+
## Completion Checklist
|
|
19
|
+
|
|
20
|
+
- acceptance criteria have observable tests;
|
|
21
|
+
- RED failure was caused by missing behavior, not broken setup;
|
|
22
|
+
- GREEN and post-refactor focused results were observed;
|
|
23
|
+
- all affected callers and schemas were migrated;
|
|
24
|
+
- concurrency, errors, cancellation, and rollback were considered;
|
|
25
|
+
- no dead compatibility alias, debug output, placeholder, or secret remains;
|
|
26
|
+
- task record names exact evidence rather than estimated coverage.
|