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
|
@@ -1,302 +1,41 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sdd-implement
|
|
3
|
-
description:
|
|
3
|
+
description: Implement approved SDD tasks test-first with focused verification and security checks.
|
|
4
|
+
disable-model-invocation: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# SDD Implementation
|
|
7
|
+
# SDD Implementation
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
Work inline in the current turn. Do not create a serial implementation specialist. Delegate only when at least two genuinely independent slices can run concurrently.
|
|
9
10
|
|
|
10
11
|
## Prerequisites
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
3. Review tasks in `.spec/specs/{feature}/tasks.md`
|
|
16
|
-
4. Understand the design in `.spec/specs/{feature}/design.md`
|
|
13
|
+
- Use `sdd-status`: requirements, design, and tasks must be approved.
|
|
14
|
+
- If test-case review is configured, `sdd-review-test-cases` must already be complete.
|
|
15
|
+
- Read the approved task, its acceptance criteria, design interfaces, and relevant steering before editing.
|
|
17
16
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
### Step 1: Load Context
|
|
21
|
-
|
|
22
|
-
1. Use `sdd-status` MCP tool to verify all phases approved
|
|
23
|
-
2. Confirm `TDD Test Case Review` is reviewed when that checkpoint appears in status
|
|
24
|
-
3. Read the tasks document for current implementation
|
|
25
|
-
4. Identify the next task to implement
|
|
26
|
-
|
|
27
|
-
### Step 2: Execute TDD Cycle
|
|
17
|
+
## Required TDD Cycle
|
|
28
18
|
|
|
29
19
|
For each task:
|
|
30
20
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
│ - Define expected behavior │
|
|
35
|
-
│ - Run test, confirm it FAILS │
|
|
36
|
-
│ │
|
|
37
|
-
│ 2. GREEN: Write Minimal Code │
|
|
38
|
-
│ - Just enough to pass the test │
|
|
39
|
-
│ - No extra features │
|
|
40
|
-
│ - Run test, confirm it PASSES │
|
|
41
|
-
│ │
|
|
42
|
-
│ 3. REFACTOR: Improve Code │
|
|
43
|
-
│ - Clean up without changing behavior │
|
|
44
|
-
│ - Run tests, confirm still PASSING │
|
|
45
|
-
│ │
|
|
46
|
-
│ REPEAT for each test case │
|
|
47
|
-
└─────────────────────────────────────────────────────────────┘
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Step 3: Apply SOLID Principles
|
|
51
|
-
|
|
52
|
-
#### S - Single Responsibility Principle
|
|
53
|
-
```typescript
|
|
54
|
-
// GOOD: One class, one job
|
|
55
|
-
class UserValidator {
|
|
56
|
-
validate(user: User): ValidationResult { ... }
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
class UserRepository {
|
|
60
|
-
save(user: User): Promise<void> { ... }
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// BAD: Class doing too much
|
|
64
|
-
class UserManager {
|
|
65
|
-
validate(user: User) { ... }
|
|
66
|
-
save(user: User) { ... }
|
|
67
|
-
sendEmail(user: User) { ... }
|
|
68
|
-
generateReport() { ... }
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
#### O - Open/Closed Principle
|
|
73
|
-
```typescript
|
|
74
|
-
// GOOD: Open for extension, closed for modification
|
|
75
|
-
interface PaymentProcessor {
|
|
76
|
-
process(amount: number): Promise<Result>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
class StripeProcessor implements PaymentProcessor { ... }
|
|
80
|
-
class PayPalProcessor implements PaymentProcessor { ... }
|
|
81
|
-
|
|
82
|
-
// BAD: Modifying existing code for new payment types
|
|
83
|
-
class PaymentService {
|
|
84
|
-
process(type: string, amount: number) {
|
|
85
|
-
if (type === 'stripe') { ... }
|
|
86
|
-
else if (type === 'paypal') { ... }
|
|
87
|
-
// Adding new type requires modifying this class
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
#### L - Liskov Substitution Principle
|
|
93
|
-
```typescript
|
|
94
|
-
// GOOD: Subtypes are substitutable
|
|
95
|
-
class Bird {
|
|
96
|
-
move(): void { /* fly or walk */ }
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
class Sparrow extends Bird {
|
|
100
|
-
move(): void { this.fly(); }
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
class Penguin extends Bird {
|
|
104
|
-
move(): void { this.walk(); }
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// BAD: Subtype breaks expected behavior
|
|
108
|
-
class Bird {
|
|
109
|
-
fly(): void { ... }
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
class Penguin extends Bird {
|
|
113
|
-
fly(): void { throw new Error("Can't fly!"); }
|
|
114
|
-
}
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
#### I - Interface Segregation Principle
|
|
118
|
-
```typescript
|
|
119
|
-
// GOOD: Specific interfaces
|
|
120
|
-
interface Readable {
|
|
121
|
-
read(): Data;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface Writable {
|
|
125
|
-
write(data: Data): void;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
class FileHandler implements Readable, Writable { ... }
|
|
129
|
-
class ReadOnlyFile implements Readable { ... }
|
|
130
|
-
|
|
131
|
-
// BAD: Fat interface forcing unnecessary implementation
|
|
132
|
-
interface FileOperations {
|
|
133
|
-
read(): Data;
|
|
134
|
-
write(data: Data): void;
|
|
135
|
-
delete(): void;
|
|
136
|
-
execute(): void;
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
#### D - Dependency Inversion Principle
|
|
141
|
-
```typescript
|
|
142
|
-
// GOOD: Depend on abstractions
|
|
143
|
-
interface IUserRepository {
|
|
144
|
-
findById(id: string): Promise<User>;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
class UserService {
|
|
148
|
-
constructor(private repo: IUserRepository) {}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// BAD: Depend on concrete implementations
|
|
152
|
-
class UserService {
|
|
153
|
-
private repo = new PostgresUserRepository();
|
|
154
|
-
}
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### Step 4: Security Checklist (OWASP Top 10)
|
|
158
|
-
|
|
159
|
-
Before marking implementation complete, verify:
|
|
160
|
-
|
|
161
|
-
#### 1. Broken Access Control
|
|
162
|
-
- [ ] Enforce access control on every request
|
|
163
|
-
- [ ] Deny by default
|
|
164
|
-
- [ ] Validate user owns the resource
|
|
165
|
-
|
|
166
|
-
#### 2. Cryptographic Failures
|
|
167
|
-
- [ ] Use strong encryption (AES-256, RSA-2048+)
|
|
168
|
-
- [ ] Never store passwords in plain text (use bcrypt/argon2)
|
|
169
|
-
- [ ] Use HTTPS for all communications
|
|
170
|
-
|
|
171
|
-
#### 3. Injection
|
|
172
|
-
- [ ] Use parameterized queries for database
|
|
173
|
-
- [ ] Validate and sanitize all user inputs
|
|
174
|
-
- [ ] Escape output in templates
|
|
175
|
-
|
|
176
|
-
#### 4. Insecure Design
|
|
177
|
-
- [ ] Apply threat modeling
|
|
178
|
-
- [ ] Implement defense in depth
|
|
179
|
-
- [ ] Fail securely
|
|
180
|
-
|
|
181
|
-
#### 5. Security Misconfiguration
|
|
182
|
-
- [ ] Remove default credentials
|
|
183
|
-
- [ ] Disable unnecessary features
|
|
184
|
-
- [ ] Keep dependencies updated
|
|
185
|
-
|
|
186
|
-
#### 6. Vulnerable Components
|
|
187
|
-
- [ ] Use dependency audit tools (e.g., `npm audit`, `pip-audit`, `cargo audit`, `snyk`)
|
|
188
|
-
- [ ] Update vulnerable packages
|
|
189
|
-
- [ ] Remove unused dependencies
|
|
190
|
-
|
|
191
|
-
#### 7. Authentication Failures
|
|
192
|
-
- [ ] Implement proper session management
|
|
193
|
-
- [ ] Use MFA where appropriate
|
|
194
|
-
- [ ] Implement account lockout
|
|
195
|
-
|
|
196
|
-
#### 8. Software Integrity
|
|
197
|
-
- [ ] Verify package integrity
|
|
198
|
-
- [ ] Use lockfiles (e.g., `package-lock.json`, `Cargo.lock`, `poetry.lock`, `go.sum`)
|
|
199
|
-
- [ ] Sign commits if required
|
|
200
|
-
|
|
201
|
-
#### 9. Logging & Monitoring
|
|
202
|
-
- [ ] Log security events
|
|
203
|
-
- [ ] Don't log sensitive data
|
|
204
|
-
- [ ] Implement alerting
|
|
205
|
-
|
|
206
|
-
#### 10. SSRF (Server-Side Request Forgery)
|
|
207
|
-
- [ ] Validate and sanitize URLs
|
|
208
|
-
- [ ] Use allowlists for external calls
|
|
209
|
-
- [ ] Disable redirects or validate them
|
|
210
|
-
|
|
211
|
-
### Step 5: Code Quality Standards
|
|
212
|
-
|
|
213
|
-
#### Naming
|
|
214
|
-
```typescript
|
|
215
|
-
// GOOD
|
|
216
|
-
const userEmail = user.email;
|
|
217
|
-
function calculateTotalPrice(items: Item[]): number { ... }
|
|
218
|
-
|
|
219
|
-
// BAD
|
|
220
|
-
const e = user.email;
|
|
221
|
-
function calc(i: any): any { ... }
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
#### Comments
|
|
225
|
-
```typescript
|
|
226
|
-
// GOOD: Explain WHY, not WHAT
|
|
227
|
-
// Use retry because the external API has rate limits
|
|
228
|
-
const result = await retryWithBackoff(fetchData);
|
|
229
|
-
|
|
230
|
-
// BAD: Obvious comments
|
|
231
|
-
// Get the user
|
|
232
|
-
const user = getUser(id);
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
#### Error Handling
|
|
236
|
-
```typescript
|
|
237
|
-
// GOOD: Specific, informative errors
|
|
238
|
-
class UserNotFoundError extends Error {
|
|
239
|
-
constructor(userId: string) {
|
|
240
|
-
super(`User with ID ${userId} not found`);
|
|
241
|
-
this.name = 'UserNotFoundError';
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// BAD: Generic errors
|
|
246
|
-
throw new Error('Error');
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
### Step 6: Update Task Status
|
|
250
|
-
|
|
251
|
-
After implementing each task:
|
|
252
|
-
1. Mark task as complete in tasks.md
|
|
253
|
-
2. Verify test coverage >= 80%
|
|
254
|
-
3. Run `sdd-quality-check` MCP tool on new code
|
|
255
|
-
|
|
256
|
-
## MCP Tool Integration
|
|
257
|
-
|
|
258
|
-
| Tool | When to Use |
|
|
259
|
-
|------|-------------|
|
|
260
|
-
| `sdd-status` | Check all phases approved before implementing |
|
|
261
|
-
| `sdd-spec-impl` | Execute specific tasks with TDD |
|
|
262
|
-
| `sdd-quality-check` | Validate code quality after implementation |
|
|
263
|
-
|
|
264
|
-
## Definition of Done
|
|
265
|
-
|
|
266
|
-
- [ ] All acceptance criteria met
|
|
267
|
-
- [ ] All tests pass
|
|
268
|
-
- [ ] Code coverage >= 80%
|
|
269
|
-
- [ ] No lint/type errors
|
|
270
|
-
- [ ] Security checklist verified
|
|
271
|
-
- [ ] SOLID principles applied
|
|
272
|
-
- [ ] Code self-documenting or commented where needed
|
|
273
|
-
|
|
274
|
-
## Steering Document References
|
|
21
|
+
1. **RED:** write a focused test for observable behavior and run it to prove the expected failure.
|
|
22
|
+
2. **GREEN:** implement only enough production code to pass; run the focused test.
|
|
23
|
+
3. **REFACTOR:** simplify without changing behavior; rerun the focused test.
|
|
275
24
|
|
|
276
|
-
|
|
25
|
+
Do not mark a task complete without recorded failing and passing evidence. Test boundaries, errors, invariants, transitions, and precedence—not implementation plumbing.
|
|
277
26
|
|
|
278
|
-
|
|
279
|
-
|----------|---------|-----------------|
|
|
280
|
-
| `.spec/steering/tdd-guideline.md` | Test-Driven Development | Follow Red-Green-Refactor cycle for all code |
|
|
281
|
-
| `.spec/steering/principles.md` | SOLID, DRY, KISS, YAGNI | Apply SOLID principles, keep code simple and focused |
|
|
282
|
-
| `.spec/steering/owasp-top10-check.md` | Security checklist | Verify all OWASP Top 10 security requirements before completion |
|
|
27
|
+
## Mandatory Checks
|
|
283
28
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
29
|
+
- Preserve approved interfaces and existing conventions; update every affected caller.
|
|
30
|
+
- Validate untrusted input, enforce authorization, avoid injection, protect secrets and sensitive logs, and fail safely.
|
|
31
|
+
- Consider concurrency, resource cleanup, compatibility, and error propagation where applicable.
|
|
32
|
+
- Run only relevant verification while iterating, then the required affected checks.
|
|
33
|
+
- Update task status only after acceptance criteria and security checks pass. Never fabricate test, coverage, lint, or build results.
|
|
288
34
|
|
|
289
|
-
##
|
|
35
|
+
## Output
|
|
290
36
|
|
|
291
|
-
|
|
292
|
-
|--------------|---------|----------|
|
|
293
|
-
| **God Class** | Class does too much | Split by responsibility |
|
|
294
|
-
| **Feature Envy** | Method uses another class's data extensively | Move method to that class |
|
|
295
|
-
| **Primitive Obsession** | Using primitives for domain concepts | Create value objects |
|
|
296
|
-
| **Magic Numbers** | Unexplained numeric literals | Use named constants |
|
|
297
|
-
| **Deep Nesting** | Multiple levels of if/loops | Extract methods, early returns |
|
|
298
|
-
| **Long Methods** | Methods doing too much | Split into smaller methods |
|
|
37
|
+
Report completed task numbers, affected artifacts, RED/GREEN verification evidence, security-relevant decisions, and unresolved blockers. Write large artifacts to their canonical files instead of echoing them.
|
|
299
38
|
|
|
300
|
-
##
|
|
39
|
+
## Optional Reference
|
|
301
40
|
|
|
302
|
-
|
|
41
|
+
Read [REFERENCE.md](REFERENCE.md) only when detailed SOLID, OWASP, anti-pattern, or completion checklists are needed.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Requirements Reference
|
|
2
|
+
|
|
3
|
+
Read only for examples or document formatting.
|
|
4
|
+
|
|
5
|
+
## EARS Examples
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
The service SHALL reject an absolute feature name.
|
|
9
|
+
WHEN a valid approval request is committed THEN the service SHALL publish the derived handoff.
|
|
10
|
+
WHILE a phase is unapproved THE service SHALL exclude its draft from compact context.
|
|
11
|
+
WHERE test-case review is enabled THE service SHALL require review before tasks approval.
|
|
12
|
+
IF handoff publication fails after approval THEN the service SHALL retain the approved state and report pending regeneration.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Suggested Document Shape
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
# Requirements: Feature
|
|
19
|
+
## Scope
|
|
20
|
+
## Functional Requirements
|
|
21
|
+
### FR-1: Name
|
|
22
|
+
EARS statement
|
|
23
|
+
Acceptance criteria
|
|
24
|
+
## Non-functional Requirements
|
|
25
|
+
## Constraints and assumptions
|
|
26
|
+
## Traceability
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quality Checklist
|
|
30
|
+
|
|
31
|
+
Each requirement has one concern, a stable ID, normative SHALL wording, measurable bounds, positive and failure behavior, and acceptance criteria that do not prescribe incidental implementation. Requirements do not conflict, duplicate one another, hide an undefined actor, or depend on ambiguous timing. Security and compatibility requirements identify an asset or existing contract rather than repeating a generic checklist.
|
|
@@ -1,151 +1,39 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sdd-requirements
|
|
3
|
-
description: Generate EARS
|
|
3
|
+
description: Generate testable EARS requirements and measurable acceptance criteria for an SDD feature.
|
|
4
|
+
disable-model-invocation: true
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
# SDD Requirements
|
|
7
|
-
|
|
8
|
-
Generate comprehensive, EARS-formatted requirements documents that integrate with the SDD (Spec-Driven Development) workflow.
|
|
7
|
+
# SDD Requirements
|
|
9
8
|
|
|
10
9
|
## Prerequisites
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
3. Review project steering documents in `.spec/steering/`
|
|
11
|
+
- The feature must exist through `sdd-init`.
|
|
12
|
+
- Check its durable phase with `sdd-status`.
|
|
13
|
+
- Read the feature description and relevant steering. Ask only for material information that cannot be derived.
|
|
16
14
|
|
|
17
15
|
## Workflow
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- **Core functionality**: What must the system do?
|
|
31
|
-
- **Success criteria**: How do we know it works?
|
|
32
|
-
|
|
33
|
-
### Step 3: Generate EARS-Formatted Requirements
|
|
34
|
-
|
|
35
|
-
Use the **EARS (Easy Approach to Requirements Syntax)** format for all requirements.
|
|
36
|
-
|
|
37
|
-
#### EARS Patterns
|
|
38
|
-
|
|
39
|
-
| Pattern | Syntax | Use When |
|
|
40
|
-
|---------|--------|----------|
|
|
41
|
-
| **Ubiquitous** | `The <system> SHALL <action>` | Always true requirement |
|
|
42
|
-
| **Event-Driven** | `WHEN <trigger> THEN the <system> SHALL <action>` | Response to event |
|
|
43
|
-
| **State-Driven** | `WHILE <state> THE <system> SHALL <action>` | During specific state |
|
|
44
|
-
| **Optional** | `WHERE <feature enabled> THE <system> SHALL <action>` | Configurable feature |
|
|
45
|
-
| **Unwanted Behavior** | `IF <condition> THEN the <system> SHALL <action>` | Exception handling |
|
|
46
|
-
|
|
47
|
-
#### Examples
|
|
48
|
-
|
|
49
|
-
```markdown
|
|
50
|
-
## FR-1: User Authentication
|
|
51
|
-
WHEN a user submits valid credentials
|
|
52
|
-
THEN the system SHALL authenticate the user and return a session token
|
|
53
|
-
|
|
54
|
-
## FR-2: Session Management
|
|
55
|
-
WHILE a user session is active
|
|
56
|
-
THE system SHALL maintain the session for up to 24 hours of inactivity
|
|
57
|
-
|
|
58
|
-
## NFR-1: Performance
|
|
59
|
-
The system SHALL respond to authentication requests within 200ms
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
### Step 4: Structure the Document
|
|
63
|
-
|
|
64
|
-
Generate requirements.md with this structure:
|
|
65
|
-
|
|
66
|
-
```markdown
|
|
67
|
-
# Requirements: {Feature Name}
|
|
68
|
-
|
|
69
|
-
## Overview
|
|
70
|
-
Brief description of the feature and its purpose.
|
|
71
|
-
|
|
72
|
-
## Functional Requirements
|
|
73
|
-
|
|
74
|
-
### FR-1: {Requirement Name}
|
|
75
|
-
**Objective:** As a {user type}, I want {goal}, so that {benefit}
|
|
17
|
+
1. Identify users, goals, in-scope behavior, exclusions, constraints, assumptions, dependencies, and measurable success.
|
|
18
|
+
2. Write independently testable functional and non-functional requirements using EARS:
|
|
19
|
+
- ubiquitous: `The system SHALL ...`
|
|
20
|
+
- event: `WHEN ... THEN the system SHALL ...`
|
|
21
|
+
- state: `WHILE ... THE system SHALL ...`
|
|
22
|
+
- optional: `WHERE ... THE system SHALL ...`
|
|
23
|
+
- unwanted behavior: `IF ... THEN the system SHALL ...`
|
|
24
|
+
3. Give every requirement a stable ID and specific acceptance criteria. Replace ambiguous words such as “fast”, “appropriate”, “should”, or “may” with observable bounds.
|
|
25
|
+
4. Include security, privacy, accessibility, compatibility, error, and performance requirements only where relevant; do not invent scope.
|
|
26
|
+
5. Check completeness, consistency, feasibility, traceability, and testability; use `sdd-validate-gap` when existing code is in scope.
|
|
27
|
+
6. Write `.spec/specs/{feature}/requirements.md`. Request requirements approval only after the artifact is complete; never self-approve silently.
|
|
76
28
|
|
|
77
|
-
|
|
78
|
-
WHEN {trigger}
|
|
79
|
-
THEN the system SHALL {action}
|
|
80
|
-
|
|
81
|
-
**Acceptance Criteria:**
|
|
82
|
-
1. {Specific, testable criterion}
|
|
83
|
-
2. {Specific, testable criterion}
|
|
84
|
-
|
|
85
|
-
### FR-2: {Next Requirement}
|
|
86
|
-
...
|
|
87
|
-
|
|
88
|
-
## Non-Functional Requirements
|
|
89
|
-
|
|
90
|
-
### NFR-1: Performance
|
|
91
|
-
{Performance requirements with specific metrics}
|
|
92
|
-
|
|
93
|
-
### NFR-2: Security
|
|
94
|
-
{Security requirements aligned with OWASP guidelines}
|
|
95
|
-
|
|
96
|
-
### NFR-3: Scalability
|
|
97
|
-
{Scalability requirements if applicable}
|
|
98
|
-
|
|
99
|
-
## Constraints
|
|
100
|
-
{Technical or business constraints}
|
|
101
|
-
|
|
102
|
-
## Assumptions
|
|
103
|
-
{Assumptions made during requirements gathering}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Step 5: Validate and Save
|
|
107
|
-
|
|
108
|
-
After generating requirements:
|
|
109
|
-
1. Ensure all requirements are testable
|
|
110
|
-
2. Verify EARS format is correctly applied
|
|
111
|
-
3. Save to `.spec/specs/{feature}/requirements.md`
|
|
112
|
-
4. Use `sdd-approve` MCP tool to mark phase complete when ready
|
|
113
|
-
|
|
114
|
-
## MCP Tool Integration
|
|
115
|
-
|
|
116
|
-
This skill works with these MCP tools:
|
|
117
|
-
|
|
118
|
-
| Tool | When to Use |
|
|
119
|
-
|------|-------------|
|
|
120
|
-
| `sdd-status` | Check current workflow phase before starting |
|
|
121
|
-
| `sdd-validate-gap` | Validate requirements against existing codebase |
|
|
122
|
-
| `sdd-approve` | Mark requirements phase as approved |
|
|
123
|
-
|
|
124
|
-
## Quality Checklist
|
|
125
|
-
|
|
126
|
-
Before completing requirements:
|
|
127
|
-
- [ ] All requirements use EARS format
|
|
128
|
-
- [ ] Each requirement is independently testable
|
|
129
|
-
- [ ] Acceptance criteria are specific and measurable
|
|
130
|
-
- [ ] Security requirements align with OWASP Top 10
|
|
131
|
-
- [ ] Performance requirements have specific metrics
|
|
132
|
-
- [ ] Requirements are traceable to user stories
|
|
133
|
-
- [ ] No ambiguous terms (avoid "should", "may", "might")
|
|
134
|
-
- [ ] Each FR has clear acceptance criteria
|
|
135
|
-
|
|
136
|
-
## Steering Document References
|
|
29
|
+
## Specialist Delegation
|
|
137
30
|
|
|
138
|
-
|
|
31
|
+
Target renderers provide the `planner` route. When a native advisor is required, dispatch exactly one compact handoff with `specialistDepth: 1`; include only the goal, verified context, constraints, open decisions, and output contract. The specialist must not delegate again. Keep the handoff and returned summary at or below 2,048 estimated tokens. If the advisor or routed model is unavailable, record one fallback and continue in the parent without retrying or selecting a generic child. Where a native per-turn model override applies, execute in this turn.
|
|
139
32
|
|
|
140
|
-
|
|
141
|
-
|----------|---------|-----------------|
|
|
142
|
-
| `.spec/steering/principles.md` | SOLID, DRY, KISS, YAGNI | Ensure requirements follow KISS (simple, unambiguous) and YAGNI (only what's needed now) |
|
|
33
|
+
## Output
|
|
143
34
|
|
|
144
|
-
|
|
145
|
-
- **KISS**: Keep requirements simple and unambiguous
|
|
146
|
-
- **YAGNI**: Only specify what's actually needed now
|
|
147
|
-
- **Single Responsibility**: Each requirement addresses one concern
|
|
35
|
+
Return the saved path, key scope decisions, validation evidence, and approval as the next action.
|
|
148
36
|
|
|
149
|
-
##
|
|
37
|
+
## Optional Reference
|
|
150
38
|
|
|
151
|
-
|
|
39
|
+
Read [REFERENCE.md](REFERENCE.md) only for EARS examples, document structure, or the extended quality checklist.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Review Reference
|
|
2
|
+
|
|
3
|
+
Read only when the focused review needs extra prompts.
|
|
4
|
+
|
|
5
|
+
## Severity
|
|
6
|
+
|
|
7
|
+
- Critical: exploitable security flaw, corruption, irreversible data loss, or broad outage.
|
|
8
|
+
- Important: reproducible incorrect behavior, regression, race, leak, or contract break.
|
|
9
|
+
- Minor: concrete maintenance cost likely to cause future defects.
|
|
10
|
+
- Suggestion: optional preference; omit it unless specifically requested.
|
|
11
|
+
|
|
12
|
+
## Language-independent Prompts
|
|
13
|
+
|
|
14
|
+
Check ownership and mutation, null/empty/boundary behavior, ordering and precedence, async cancellation, retries and idempotency, resource cleanup, error identity, public API compatibility, serialization, time zones, numeric overflow, and deterministic tests.
|
|
15
|
+
|
|
16
|
+
## Finding Shape
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
[severity] path:line — concise defect
|
|
20
|
+
Trigger: exact input/state/interleaving
|
|
21
|
+
Impact: observable consequence
|
|
22
|
+
Evidence: code path or focused reproduction
|
|
23
|
+
Fix: smallest source-level remedy
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Review tests for missing contracts, not line coverage. Reject tests that only mirror implementation, inspect source text, rely on timing sleeps, share state, or swallow real errors. End with verification actually performed and explicit residual risk.
|