musubi-sdd 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +531 -0
- package/README.md +531 -0
- package/bin/musubi-init.js +321 -0
- package/bin/musubi.js +359 -0
- package/package.json +55 -0
- package/src/agents/registry.js +242 -0
- package/src/templates/agents/claude-code/CLAUDE.md +232 -0
- package/src/templates/agents/claude-code/commands/sdd-design.md +673 -0
- package/src/templates/agents/claude-code/commands/sdd-implement.md +777 -0
- package/src/templates/agents/claude-code/commands/sdd-requirements.md +438 -0
- package/src/templates/agents/claude-code/commands/sdd-steering.md +334 -0
- package/src/templates/agents/claude-code/commands/sdd-tasks.md +582 -0
- package/src/templates/agents/claude-code/commands/sdd-validate.md +710 -0
- package/src/templates/agents/claude-code/skills/ai-ml-engineer/SKILL.md +3055 -0
- package/src/templates/agents/claude-code/skills/api-designer/SKILL.md +1364 -0
- package/src/templates/agents/claude-code/skills/bug-hunter/SKILL.md +482 -0
- package/src/templates/agents/claude-code/skills/change-impact-analyzer/SKILL.md +397 -0
- package/src/templates/agents/claude-code/skills/cloud-architect/SKILL.md +1468 -0
- package/src/templates/agents/claude-code/skills/code-reviewer/SKILL.md +906 -0
- package/src/templates/agents/claude-code/skills/constitution-enforcer/SKILL.md +466 -0
- package/src/templates/agents/claude-code/skills/database-administrator/SKILL.md +3522 -0
- package/src/templates/agents/claude-code/skills/database-schema-designer/SKILL.md +1158 -0
- package/src/templates/agents/claude-code/skills/devops-engineer/SKILL.md +647 -0
- package/src/templates/agents/claude-code/skills/orchestrator/SKILL.md +574 -0
- package/src/templates/agents/claude-code/skills/performance-optimizer/SKILL.md +464 -0
- package/src/templates/agents/claude-code/skills/project-manager/SKILL.md +769 -0
- package/src/templates/agents/claude-code/skills/quality-assurance/SKILL.md +1059 -0
- package/src/templates/agents/claude-code/skills/release-coordinator/SKILL.md +653 -0
- package/src/templates/agents/claude-code/skills/requirements-analyst/SKILL.md +1287 -0
- package/src/templates/agents/claude-code/skills/security-auditor/SKILL.md +1107 -0
- package/src/templates/agents/claude-code/skills/site-reliability-engineer/SKILL.md +404 -0
- package/src/templates/agents/claude-code/skills/software-developer/SKILL.md +1254 -0
- package/src/templates/agents/claude-code/skills/steering/SKILL.md +383 -0
- package/src/templates/agents/claude-code/skills/system-architect/SKILL.md +1288 -0
- package/src/templates/agents/claude-code/skills/technical-writer/SKILL.md +712 -0
- package/src/templates/agents/claude-code/skills/test-engineer/SKILL.md +1262 -0
- package/src/templates/agents/claude-code/skills/traceability-auditor/SKILL.md +298 -0
- package/src/templates/agents/claude-code/skills/ui-ux-designer/SKILL.md +1009 -0
- package/src/templates/agents/codex/AGENTS.md +138 -0
- package/src/templates/agents/codex/commands/sdd-design.md +673 -0
- package/src/templates/agents/codex/commands/sdd-implement.md +777 -0
- package/src/templates/agents/codex/commands/sdd-requirements.md +438 -0
- package/src/templates/agents/codex/commands/sdd-steering.md +334 -0
- package/src/templates/agents/codex/commands/sdd-tasks.md +582 -0
- package/src/templates/agents/codex/commands/sdd-validate.md +710 -0
- package/src/templates/agents/cursor/AGENTS.md +138 -0
- package/src/templates/agents/cursor/commands/sdd-design.md +673 -0
- package/src/templates/agents/cursor/commands/sdd-implement.md +777 -0
- package/src/templates/agents/cursor/commands/sdd-requirements.md +438 -0
- package/src/templates/agents/cursor/commands/sdd-steering.md +334 -0
- package/src/templates/agents/cursor/commands/sdd-tasks.md +582 -0
- package/src/templates/agents/cursor/commands/sdd-validate.md +710 -0
- package/src/templates/agents/gemini-cli/GEMINI.md +128 -0
- package/src/templates/agents/gemini-cli/commands/sdd-design.toml +359 -0
- package/src/templates/agents/gemini-cli/commands/sdd-implement.toml +484 -0
- package/src/templates/agents/gemini-cli/commands/sdd-requirements.toml +291 -0
- package/src/templates/agents/gemini-cli/commands/sdd-steering.toml +209 -0
- package/src/templates/agents/gemini-cli/commands/sdd-tasks.toml +441 -0
- package/src/templates/agents/gemini-cli/commands/sdd-validate.toml +553 -0
- package/src/templates/agents/github-copilot/AGENTS.md +138 -0
- package/src/templates/agents/github-copilot/commands/sdd-design.md +673 -0
- package/src/templates/agents/github-copilot/commands/sdd-implement.md +777 -0
- package/src/templates/agents/github-copilot/commands/sdd-requirements.md +438 -0
- package/src/templates/agents/github-copilot/commands/sdd-steering.md +334 -0
- package/src/templates/agents/github-copilot/commands/sdd-tasks.md +582 -0
- package/src/templates/agents/github-copilot/commands/sdd-validate.md +710 -0
- package/src/templates/agents/qwen-code/QWEN.md +128 -0
- package/src/templates/agents/qwen-code/commands/sdd-design.md +673 -0
- package/src/templates/agents/qwen-code/commands/sdd-implement.md +777 -0
- package/src/templates/agents/qwen-code/commands/sdd-requirements.md +438 -0
- package/src/templates/agents/qwen-code/commands/sdd-steering.md +334 -0
- package/src/templates/agents/qwen-code/commands/sdd-tasks.md +582 -0
- package/src/templates/agents/qwen-code/commands/sdd-validate.md +710 -0
- package/src/templates/agents/windsurf/AGENTS.md +138 -0
- package/src/templates/agents/windsurf/commands/sdd-design.md +673 -0
- package/src/templates/agents/windsurf/commands/sdd-implement.md +777 -0
- package/src/templates/agents/windsurf/commands/sdd-requirements.md +438 -0
- package/src/templates/agents/windsurf/commands/sdd-steering.md +334 -0
- package/src/templates/agents/windsurf/commands/sdd-tasks.md +582 -0
- package/src/templates/agents/windsurf/commands/sdd-validate.md +710 -0
- package/src/templates/shared/constitution/constitution.md +408 -0
- package/src/templates/shared/constitution/ears-format.md +613 -0
- package/src/templates/shared/constitution/workflow.md +653 -0
- package/src/templates/shared/documents/design.md +737 -0
- package/src/templates/shared/documents/requirements.md +329 -0
- package/src/templates/shared/documents/research.md +494 -0
- package/src/templates/shared/documents/tasks.md +781 -0
- package/src/templates/shared/steering/product.md +544 -0
- package/src/templates/shared/steering/structure.md +405 -0
- package/src/templates/shared/steering/tech.md +537 -0
|
@@ -0,0 +1,781 @@
|
|
|
1
|
+
# Task Breakdown: {{FEATURE_NAME}}
|
|
2
|
+
|
|
3
|
+
**Project**: {{PROJECT_NAME}}
|
|
4
|
+
**Version**: 1.0
|
|
5
|
+
**Status**: Draft
|
|
6
|
+
**Date**: {{DATE}}
|
|
7
|
+
**Sprint**: [Sprint Number/Milestone]
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Document Control
|
|
12
|
+
|
|
13
|
+
| Version | Date | Author | Changes |
|
|
14
|
+
|---------|------|--------|---------|
|
|
15
|
+
| 1.0 | {{DATE}} | {{AUTHOR}} | Initial task breakdown |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
### Purpose
|
|
22
|
+
|
|
23
|
+
This document breaks down the design into actionable implementation tasks with requirements traceability.
|
|
24
|
+
|
|
25
|
+
### References
|
|
26
|
+
|
|
27
|
+
- **Requirements**: [requirements.md](requirements.md)
|
|
28
|
+
- **Design**: [design.md](design.md)
|
|
29
|
+
- **Steering Context**: [steering/](../../steering/)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Task Breakdown Summary
|
|
34
|
+
|
|
35
|
+
| Priority | Total Tasks | Story Points | Estimated Hours |
|
|
36
|
+
|----------|-------------|--------------|-----------------|
|
|
37
|
+
| P0 (Critical) | [N] | [N] | [N] |
|
|
38
|
+
| P1 (High) | [N] | [N] | [N] |
|
|
39
|
+
| P2 (Medium) | [N] | [N] | [N] |
|
|
40
|
+
| P3 (Low) | [N] | [N] | [N] |
|
|
41
|
+
| **Total** | **[N]** | **[N]** | **[N]** |
|
|
42
|
+
|
|
43
|
+
**Sprint Allocation**:
|
|
44
|
+
- Sprint 1: P0 tasks ([N] points)
|
|
45
|
+
- Sprint 2: P1 tasks ([N] points)
|
|
46
|
+
- Sprint 3: P2 tasks ([N] points)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Task Template
|
|
51
|
+
|
|
52
|
+
Each task follows this structure:
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
### TASK-XXX: [Task Title]
|
|
56
|
+
|
|
57
|
+
**Priority**: P0/P1/P2/P3
|
|
58
|
+
**Story Points**: [1/2/3/5/8/13]
|
|
59
|
+
**Estimated Hours**: [N]
|
|
60
|
+
**Assignee**: [Name]
|
|
61
|
+
**Status**: [Not Started/In Progress/Blocked/Testing/Complete]
|
|
62
|
+
|
|
63
|
+
**Description**:
|
|
64
|
+
[What needs to be done]
|
|
65
|
+
|
|
66
|
+
**Requirements Coverage**:
|
|
67
|
+
- REQ-XXX-NNN: [Requirement title]
|
|
68
|
+
- REQ-XXX-NNN: [Requirement title]
|
|
69
|
+
|
|
70
|
+
**Acceptance Criteria**:
|
|
71
|
+
- [ ] [Testable criterion 1]
|
|
72
|
+
- [ ] [Testable criterion 2]
|
|
73
|
+
- [ ] [Testable criterion 3]
|
|
74
|
+
|
|
75
|
+
**Dependencies**:
|
|
76
|
+
- TASK-XXX: [Dependency description]
|
|
77
|
+
|
|
78
|
+
**Test-First Checklist** (Article III):
|
|
79
|
+
- [ ] Tests written BEFORE implementation
|
|
80
|
+
- [ ] Red: Failing test committed
|
|
81
|
+
- [ ] Green: Minimal implementation passes test
|
|
82
|
+
- [ ] Blue: Refactored with confidence
|
|
83
|
+
|
|
84
|
+
**Implementation Notes**:
|
|
85
|
+
[Technical details, file paths, code snippets]
|
|
86
|
+
|
|
87
|
+
**Validation**:
|
|
88
|
+
```bash
|
|
89
|
+
# Commands to verify completion
|
|
90
|
+
npm test src/{{component}}.test.ts
|
|
91
|
+
npm run lint src/{{component}}.ts
|
|
92
|
+
```
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## P0 Tasks (Critical - Launch Blockers)
|
|
98
|
+
|
|
99
|
+
### TASK-001: Set Up Project Structure (Library-First)
|
|
100
|
+
|
|
101
|
+
**Priority**: P0
|
|
102
|
+
**Story Points**: 3
|
|
103
|
+
**Estimated Hours**: 4
|
|
104
|
+
**Assignee**: [Name]
|
|
105
|
+
**Status**: Not Started
|
|
106
|
+
|
|
107
|
+
**Description**:
|
|
108
|
+
Create library-first project structure following Article I (Constitutional Governance).
|
|
109
|
+
|
|
110
|
+
**Requirements Coverage**:
|
|
111
|
+
- REQ-{{COMPONENT}}-001 (indirectly - foundation for implementation)
|
|
112
|
+
|
|
113
|
+
**Acceptance Criteria**:
|
|
114
|
+
- [ ] Library created in `lib/{{component}}/`
|
|
115
|
+
- [ ] Independent test suite in `lib/{{component}}/tests/`
|
|
116
|
+
- [ ] CLI interface in `lib/{{component}}/cli.ts`
|
|
117
|
+
- [ ] Library exports in `lib/{{component}}/index.ts`
|
|
118
|
+
- [ ] No dependencies on application code
|
|
119
|
+
|
|
120
|
+
**Constitutional Compliance**:
|
|
121
|
+
- ✅ **Article I**: Library-First structure
|
|
122
|
+
- ✅ **Article II**: CLI interface prepared
|
|
123
|
+
|
|
124
|
+
**Implementation Notes**:
|
|
125
|
+
```bash
|
|
126
|
+
# Directory structure
|
|
127
|
+
lib/{{component}}/
|
|
128
|
+
├── src/
|
|
129
|
+
│ ├── index.ts # Public API
|
|
130
|
+
│ ├── service.ts # Business logic
|
|
131
|
+
│ ├── repository.ts # Data access
|
|
132
|
+
│ └── types.ts # TypeScript types
|
|
133
|
+
├── tests/
|
|
134
|
+
│ ├── service.test.ts
|
|
135
|
+
│ └── repository.test.ts
|
|
136
|
+
├── cli.ts # CLI interface
|
|
137
|
+
└── package.json # Library metadata
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Validation**:
|
|
141
|
+
```bash
|
|
142
|
+
@constitution-enforcer validate lib/{{component}}/
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### TASK-002: Write Tests for REQ-{{COMPONENT}}-001
|
|
148
|
+
|
|
149
|
+
**Priority**: P0
|
|
150
|
+
**Story Points**: 2
|
|
151
|
+
**Estimated Hours**: 3
|
|
152
|
+
**Assignee**: [Name]
|
|
153
|
+
**Status**: Not Started
|
|
154
|
+
|
|
155
|
+
**Description**:
|
|
156
|
+
Write failing tests for REQ-{{COMPONENT}}-001 (Test-First / Red phase).
|
|
157
|
+
|
|
158
|
+
**Requirements Coverage**:
|
|
159
|
+
- REQ-{{COMPONENT}}-001: [Requirement title]
|
|
160
|
+
|
|
161
|
+
**Acceptance Criteria**:
|
|
162
|
+
- [ ] Test file created: `lib/{{component}}/tests/service.test.ts`
|
|
163
|
+
- [ ] All acceptance criteria from REQ-{{COMPONENT}}-001 have tests
|
|
164
|
+
- [ ] Tests fail (Red phase)
|
|
165
|
+
- [ ] Tests reference requirement ID in description
|
|
166
|
+
- [ ] Git commit message: `test: add failing tests for REQ-{{COMPONENT}}-001`
|
|
167
|
+
|
|
168
|
+
**Constitutional Compliance**:
|
|
169
|
+
- ✅ **Article III**: Test-First (Red phase)
|
|
170
|
+
- ✅ **Article V**: Tests reference requirement ID
|
|
171
|
+
|
|
172
|
+
**Implementation Notes**:
|
|
173
|
+
```typescript
|
|
174
|
+
// lib/{{component}}/tests/service.test.ts
|
|
175
|
+
|
|
176
|
+
describe('REQ-{{COMPONENT}}-001: [Requirement title]', () => {
|
|
177
|
+
it('should [acceptance criterion 1]', async () => {
|
|
178
|
+
// Arrange
|
|
179
|
+
const service = new {{COMPONENT}}Service(mockRepository);
|
|
180
|
+
const input = { field1: 'value1', field2: 42 };
|
|
181
|
+
|
|
182
|
+
// Act
|
|
183
|
+
const result = await service.create(input);
|
|
184
|
+
|
|
185
|
+
// Assert
|
|
186
|
+
expect(result).toMatchObject({
|
|
187
|
+
id: expect.any(String),
|
|
188
|
+
field1: 'value1',
|
|
189
|
+
field2: 42
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('should [acceptance criterion 2]', async () => {
|
|
194
|
+
// Test for error handling...
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Dependencies**:
|
|
200
|
+
- TASK-001: Project structure must exist
|
|
201
|
+
|
|
202
|
+
**Validation**:
|
|
203
|
+
```bash
|
|
204
|
+
npm test lib/{{component}}/tests/service.test.ts
|
|
205
|
+
# Should FAIL (Red phase)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### TASK-003: Implement {{COMPONENT}} Service (REQ-{{COMPONENT}}-001)
|
|
211
|
+
|
|
212
|
+
**Priority**: P0
|
|
213
|
+
**Story Points**: 5
|
|
214
|
+
**Estimated Hours**: 8
|
|
215
|
+
**Assignee**: [Name]
|
|
216
|
+
**Status**: Not Started
|
|
217
|
+
|
|
218
|
+
**Description**:
|
|
219
|
+
Implement minimal {{COMPONENT}} service to pass tests (Green phase).
|
|
220
|
+
|
|
221
|
+
**Requirements Coverage**:
|
|
222
|
+
- REQ-{{COMPONENT}}-001: [Requirement title]
|
|
223
|
+
|
|
224
|
+
**Acceptance Criteria**:
|
|
225
|
+
- [ ] Service class implemented
|
|
226
|
+
- [ ] Business logic for create operation
|
|
227
|
+
- [ ] Input validation
|
|
228
|
+
- [ ] Error handling for edge cases
|
|
229
|
+
- [ ] All tests from TASK-002 pass
|
|
230
|
+
- [ ] Git commit message: `feat: implement REQ-{{COMPONENT}}-001`
|
|
231
|
+
|
|
232
|
+
**Constitutional Compliance**:
|
|
233
|
+
- ✅ **Article III**: Test-First (Green phase)
|
|
234
|
+
- ✅ **Article V**: Code comments reference REQ-{{COMPONENT}}-001
|
|
235
|
+
|
|
236
|
+
**Implementation Notes**:
|
|
237
|
+
```typescript
|
|
238
|
+
// lib/{{component}}/src/service.ts
|
|
239
|
+
|
|
240
|
+
export class {{COMPONENT}}Service {
|
|
241
|
+
constructor(private repository: {{COMPONENT}}Repository) {}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* REQ-{{COMPONENT}}-001: Create new {{resource}}
|
|
245
|
+
*/
|
|
246
|
+
async create(data: CreateResourceDTO): Promise<Resource> {
|
|
247
|
+
// Acceptance Criterion 1: Validate input
|
|
248
|
+
this.validateInput(data);
|
|
249
|
+
|
|
250
|
+
// Acceptance Criterion 2: Check for duplicates
|
|
251
|
+
const existing = await this.repository.findByUserAndField1(
|
|
252
|
+
data.userId,
|
|
253
|
+
data.field1
|
|
254
|
+
);
|
|
255
|
+
if (existing) {
|
|
256
|
+
throw new ConflictError('Resource already exists');
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Acceptance Criterion 3: Create and return
|
|
260
|
+
return this.repository.create(data);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
private validateInput(data: CreateResourceDTO): void {
|
|
264
|
+
if (!data.field1 || data.field1.length > 255) {
|
|
265
|
+
throw new ValidationError('field1 is required and max 255 chars');
|
|
266
|
+
}
|
|
267
|
+
if (!data.field2 || data.field2 <= 0) {
|
|
268
|
+
throw new ValidationError('field2 must be positive');
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Dependencies**:
|
|
275
|
+
- TASK-002: Tests must be written first
|
|
276
|
+
|
|
277
|
+
**Validation**:
|
|
278
|
+
```bash
|
|
279
|
+
npm test lib/{{component}}/tests/service.test.ts
|
|
280
|
+
# Should PASS (Green phase)
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
### TASK-004: Refactor {{COMPONENT}} Service
|
|
286
|
+
|
|
287
|
+
**Priority**: P0
|
|
288
|
+
**Story Points**: 2
|
|
289
|
+
**Estimated Hours**: 3
|
|
290
|
+
**Assignee**: [Name]
|
|
291
|
+
**Status**: Not Started
|
|
292
|
+
|
|
293
|
+
**Description**:
|
|
294
|
+
Refactor service code for better design (Blue phase).
|
|
295
|
+
|
|
296
|
+
**Requirements Coverage**:
|
|
297
|
+
- REQ-{{COMPONENT}}-001 (maintained)
|
|
298
|
+
|
|
299
|
+
**Acceptance Criteria**:
|
|
300
|
+
- [ ] Code follows SOLID principles
|
|
301
|
+
- [ ] No duplication
|
|
302
|
+
- [ ] Clear separation of concerns
|
|
303
|
+
- [ ] All tests still pass
|
|
304
|
+
- [ ] Code review passed
|
|
305
|
+
- [ ] Git commit message: `refactor: improve {{component}} service`
|
|
306
|
+
|
|
307
|
+
**Constitutional Compliance**:
|
|
308
|
+
- ✅ **Article III**: Test-First (Blue phase)
|
|
309
|
+
|
|
310
|
+
**Implementation Notes**:
|
|
311
|
+
- Extract validation logic to separate validator class
|
|
312
|
+
- Use dependency injection for repository
|
|
313
|
+
- Add proper TypeScript types
|
|
314
|
+
- Improve error messages
|
|
315
|
+
|
|
316
|
+
**Dependencies**:
|
|
317
|
+
- TASK-003: Implementation must be complete
|
|
318
|
+
|
|
319
|
+
**Validation**:
|
|
320
|
+
```bash
|
|
321
|
+
npm test lib/{{component}}/tests/service.test.ts
|
|
322
|
+
# Should STILL PASS after refactoring
|
|
323
|
+
npm run lint lib/{{component}}/src/service.ts
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
### TASK-005: Implement Database Repository
|
|
329
|
+
|
|
330
|
+
**Priority**: P0
|
|
331
|
+
**Story Points**: 5
|
|
332
|
+
**Estimated Hours**: 8
|
|
333
|
+
**Assignee**: [Name]
|
|
334
|
+
**Status**: Not Started
|
|
335
|
+
|
|
336
|
+
**Description**:
|
|
337
|
+
Implement database repository with Prisma/TypeORM.
|
|
338
|
+
|
|
339
|
+
**Requirements Coverage**:
|
|
340
|
+
- REQ-{{COMPONENT}}-004: Database schema
|
|
341
|
+
|
|
342
|
+
**Acceptance Criteria**:
|
|
343
|
+
- [ ] Repository interface defined
|
|
344
|
+
- [ ] Prisma schema created
|
|
345
|
+
- [ ] CRUD operations implemented
|
|
346
|
+
- [ ] Database indexes created
|
|
347
|
+
- [ ] Migration files created
|
|
348
|
+
- [ ] Integration tests pass (real database)
|
|
349
|
+
|
|
350
|
+
**Constitutional Compliance**:
|
|
351
|
+
- ✅ **Article IX**: Integration tests use real database (Docker container)
|
|
352
|
+
|
|
353
|
+
**Implementation Notes**:
|
|
354
|
+
```typescript
|
|
355
|
+
// lib/{{component}}/src/repository.ts
|
|
356
|
+
|
|
357
|
+
export class {{COMPONENT}}Repository {
|
|
358
|
+
constructor(private prisma: PrismaClient) {}
|
|
359
|
+
|
|
360
|
+
async create(data: CreateResourceDTO): Promise<Resource> {
|
|
361
|
+
return this.prisma.{{resource}}.create({
|
|
362
|
+
data: {
|
|
363
|
+
userId: data.userId,
|
|
364
|
+
field1: data.field1,
|
|
365
|
+
field2: data.field2
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
async findById(id: string): Promise<Resource | null> {
|
|
371
|
+
return this.prisma.{{resource}}.findUnique({
|
|
372
|
+
where: { id }
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Test Setup** (Docker Compose):
|
|
379
|
+
```yaml
|
|
380
|
+
services:
|
|
381
|
+
test-db:
|
|
382
|
+
image: postgres:15-alpine
|
|
383
|
+
environment:
|
|
384
|
+
POSTGRES_PASSWORD: test
|
|
385
|
+
POSTGRES_DB: test
|
|
386
|
+
ports:
|
|
387
|
+
- "5432:5432"
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
**Dependencies**:
|
|
391
|
+
- TASK-001: Project structure
|
|
392
|
+
|
|
393
|
+
**Validation**:
|
|
394
|
+
```bash
|
|
395
|
+
docker-compose up -d test-db
|
|
396
|
+
npm test lib/{{component}}/tests/repository.test.ts
|
|
397
|
+
# Should use REAL database (Article IX)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
### TASK-006: Implement CLI Interface
|
|
403
|
+
|
|
404
|
+
**Priority**: P0
|
|
405
|
+
**Story Points**: 3
|
|
406
|
+
**Estimated Hours**: 4
|
|
407
|
+
**Assignee**: [Name]
|
|
408
|
+
**Status**: Not Started
|
|
409
|
+
|
|
410
|
+
**Description**:
|
|
411
|
+
Implement CLI interface for {{component}} library (Article II).
|
|
412
|
+
|
|
413
|
+
**Requirements Coverage**:
|
|
414
|
+
- REQ-{{COMPONENT}}-001 (CLI exposure)
|
|
415
|
+
|
|
416
|
+
**Acceptance Criteria**:
|
|
417
|
+
- [ ] CLI entry point: `lib/{{component}}/cli.ts`
|
|
418
|
+
- [ ] Commands: create, get, list, update, delete
|
|
419
|
+
- [ ] Help text with --help flag
|
|
420
|
+
- [ ] Error handling with proper exit codes
|
|
421
|
+
- [ ] CLI tests pass
|
|
422
|
+
|
|
423
|
+
**Constitutional Compliance**:
|
|
424
|
+
- ✅ **Article II**: CLI Interface Mandate
|
|
425
|
+
|
|
426
|
+
**Implementation Notes**:
|
|
427
|
+
```typescript
|
|
428
|
+
// lib/{{component}}/cli.ts
|
|
429
|
+
#!/usr/bin/env node
|
|
430
|
+
|
|
431
|
+
import { Command } from 'commander';
|
|
432
|
+
import { {{COMPONENT}}Service } from './src/service';
|
|
433
|
+
|
|
434
|
+
const program = new Command();
|
|
435
|
+
|
|
436
|
+
program
|
|
437
|
+
.name('{{component}}')
|
|
438
|
+
.description('CLI for {{component}} operations')
|
|
439
|
+
.version('1.0.0');
|
|
440
|
+
|
|
441
|
+
program
|
|
442
|
+
.command('create')
|
|
443
|
+
.description('Create a new {{resource}}')
|
|
444
|
+
.requiredOption('--field1 <value>', 'Field 1 value')
|
|
445
|
+
.requiredOption('--field2 <value>', 'Field 2 value', parseInt)
|
|
446
|
+
.action(async (options) => {
|
|
447
|
+
const service = new {{COMPONENT}}Service(repository);
|
|
448
|
+
const result = await service.create({
|
|
449
|
+
field1: options.field1,
|
|
450
|
+
field2: options.field2
|
|
451
|
+
});
|
|
452
|
+
console.log(JSON.stringify(result, null, 2));
|
|
453
|
+
process.exit(0);
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
program.parse();
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**Dependencies**:
|
|
460
|
+
- TASK-003: Service implementation
|
|
461
|
+
|
|
462
|
+
**Validation**:
|
|
463
|
+
```bash
|
|
464
|
+
./lib/{{component}}/cli.ts --help
|
|
465
|
+
./lib/{{component}}/cli.ts create --field1=test --field2=42
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
### TASK-007: Implement REST API Endpoints
|
|
471
|
+
|
|
472
|
+
**Priority**: P0
|
|
473
|
+
**Story Points**: 5
|
|
474
|
+
**Estimated Hours**: 8
|
|
475
|
+
**Assignee**: [Name]
|
|
476
|
+
**Status**: Not Started
|
|
477
|
+
|
|
478
|
+
**Description**:
|
|
479
|
+
Implement REST API endpoints for {{component}}.
|
|
480
|
+
|
|
481
|
+
**Requirements Coverage**:
|
|
482
|
+
- REQ-{{COMPONENT}}-001: Create endpoint
|
|
483
|
+
- REQ-{{COMPONENT}}-002: Get endpoint
|
|
484
|
+
- REQ-{{COMPONENT}}-003: List endpoint
|
|
485
|
+
|
|
486
|
+
**Acceptance Criteria**:
|
|
487
|
+
- [ ] POST /api/{{resource}} implemented
|
|
488
|
+
- [ ] GET /api/{{resource}}/:id implemented
|
|
489
|
+
- [ ] GET /api/{{resource}} implemented
|
|
490
|
+
- [ ] Input validation middleware
|
|
491
|
+
- [ ] Error handling middleware
|
|
492
|
+
- [ ] API tests pass
|
|
493
|
+
|
|
494
|
+
**Implementation Notes**:
|
|
495
|
+
```typescript
|
|
496
|
+
// app/api/{{resource}}/route.ts
|
|
497
|
+
|
|
498
|
+
import { {{COMPONENT}}Service } from '@/lib/{{component}}';
|
|
499
|
+
|
|
500
|
+
export async function POST(request: Request) {
|
|
501
|
+
const body = await request.json();
|
|
502
|
+
|
|
503
|
+
const service = new {{COMPONENT}}Service(repository);
|
|
504
|
+
const result = await service.create(body);
|
|
505
|
+
|
|
506
|
+
return Response.json(result, { status: 201 });
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export async function GET(request: Request) {
|
|
510
|
+
const { searchParams } = new URL(request.url);
|
|
511
|
+
const id = searchParams.get('id');
|
|
512
|
+
|
|
513
|
+
const service = new {{COMPONENT}}Service(repository);
|
|
514
|
+
const result = await service.findById(id);
|
|
515
|
+
|
|
516
|
+
if (!result) {
|
|
517
|
+
return Response.json(
|
|
518
|
+
{ error: 'Not found' },
|
|
519
|
+
{ status: 404 }
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return Response.json(result);
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
**Dependencies**:
|
|
528
|
+
- TASK-003: Service implementation
|
|
529
|
+
- TASK-005: Repository implementation
|
|
530
|
+
|
|
531
|
+
**Validation**:
|
|
532
|
+
```bash
|
|
533
|
+
npm run dev
|
|
534
|
+
curl -X POST http://localhost:3000/api/{{resource}} \
|
|
535
|
+
-H "Content-Type: application/json" \
|
|
536
|
+
-d '{"field1":"test","field2":42}'
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
## P1 Tasks (High - Required for Launch)
|
|
542
|
+
|
|
543
|
+
### TASK-008: Write Integration Tests
|
|
544
|
+
|
|
545
|
+
**Priority**: P1
|
|
546
|
+
**Story Points**: 5
|
|
547
|
+
**Estimated Hours**: 8
|
|
548
|
+
**Assignee**: [Name]
|
|
549
|
+
**Status**: Not Started
|
|
550
|
+
|
|
551
|
+
**Description**:
|
|
552
|
+
Write integration tests using real database and services.
|
|
553
|
+
|
|
554
|
+
**Requirements Coverage**:
|
|
555
|
+
- REQ-{{COMPONENT}}-001 to REQ-{{COMPONENT}}-005 (all requirements)
|
|
556
|
+
|
|
557
|
+
**Acceptance Criteria**:
|
|
558
|
+
- [ ] Integration tests for all API endpoints
|
|
559
|
+
- [ ] Tests use real PostgreSQL (Docker container)
|
|
560
|
+
- [ ] Tests use real Redis cache
|
|
561
|
+
- [ ] No mocks for database/cache (Article IX)
|
|
562
|
+
- [ ] Coverage ≥ 80%
|
|
563
|
+
|
|
564
|
+
**Constitutional Compliance**:
|
|
565
|
+
- ✅ **Article IX**: Integration-First Testing (real services)
|
|
566
|
+
|
|
567
|
+
**Dependencies**:
|
|
568
|
+
- TASK-007: API implementation
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
### TASK-009: Implement Caching Layer
|
|
573
|
+
|
|
574
|
+
**Priority**: P1
|
|
575
|
+
**Story Points**: 3
|
|
576
|
+
**Estimated Hours**: 5
|
|
577
|
+
**Assignee**: [Name]
|
|
578
|
+
**Status**: Not Started
|
|
579
|
+
|
|
580
|
+
**Description**:
|
|
581
|
+
Add Redis caching for read operations.
|
|
582
|
+
|
|
583
|
+
**Requirements Coverage**:
|
|
584
|
+
- REQ-PERF-001: Performance optimization
|
|
585
|
+
|
|
586
|
+
**Acceptance Criteria**:
|
|
587
|
+
- [ ] Redis client configured
|
|
588
|
+
- [ ] Cache-aside pattern implemented
|
|
589
|
+
- [ ] TTL = 5 minutes
|
|
590
|
+
- [ ] Cache invalidation on writes
|
|
591
|
+
- [ ] Cache hit/miss metrics
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
### TASK-010: Security Audit
|
|
596
|
+
|
|
597
|
+
**Priority**: P1
|
|
598
|
+
**Story Points**: 3
|
|
599
|
+
**Estimated Hours**: 4
|
|
600
|
+
**Assignee**: [Name]
|
|
601
|
+
**Status**: Not Started
|
|
602
|
+
|
|
603
|
+
**Description**:
|
|
604
|
+
Perform security audit and fix vulnerabilities.
|
|
605
|
+
|
|
606
|
+
**Requirements Coverage**:
|
|
607
|
+
- REQ-SEC-001: Security requirements
|
|
608
|
+
|
|
609
|
+
**Acceptance Criteria**:
|
|
610
|
+
- [ ] OWASP Top 10 validated
|
|
611
|
+
- [ ] Input validation on all endpoints
|
|
612
|
+
- [ ] Output encoding for XSS prevention
|
|
613
|
+
- [ ] SQL injection prevention (parameterized queries)
|
|
614
|
+
- [ ] Authentication required for protected endpoints
|
|
615
|
+
- [ ] Security audit report generated
|
|
616
|
+
|
|
617
|
+
**Validation**:
|
|
618
|
+
```bash
|
|
619
|
+
@security-auditor audit src/
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
---
|
|
623
|
+
|
|
624
|
+
## P2 Tasks (Medium - Nice to Have)
|
|
625
|
+
|
|
626
|
+
### TASK-011: Add Pagination
|
|
627
|
+
|
|
628
|
+
**Priority**: P2
|
|
629
|
+
**Story Points**: 2
|
|
630
|
+
**Estimated Hours**: 3
|
|
631
|
+
**Assignee**: [Name]
|
|
632
|
+
**Status**: Not Started
|
|
633
|
+
|
|
634
|
+
**Description**:
|
|
635
|
+
Add pagination to list endpoint.
|
|
636
|
+
|
|
637
|
+
**Requirements Coverage**:
|
|
638
|
+
- REQ-PERF-001 (performance enhancement)
|
|
639
|
+
|
|
640
|
+
**Acceptance Criteria**:
|
|
641
|
+
- [ ] Cursor-based pagination
|
|
642
|
+
- [ ] Limit = 100 items per page
|
|
643
|
+
- [ ] Next/previous page links
|
|
644
|
+
- [ ] Total count header
|
|
645
|
+
|
|
646
|
+
---
|
|
647
|
+
|
|
648
|
+
### TASK-012: Add Monitoring Dashboards
|
|
649
|
+
|
|
650
|
+
**Priority**: P2
|
|
651
|
+
**Story Points**: 3
|
|
652
|
+
**Estimated Hours**: 5
|
|
653
|
+
**Assignee**: [Name]
|
|
654
|
+
**Status**: Not Started
|
|
655
|
+
|
|
656
|
+
**Description**:
|
|
657
|
+
Create Grafana dashboards for monitoring.
|
|
658
|
+
|
|
659
|
+
**Requirements Coverage**:
|
|
660
|
+
- REQ-AVAIL-001: Monitoring setup
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## Requirements Coverage Matrix
|
|
665
|
+
|
|
666
|
+
| Requirement ID | Priority | Tasks | Test Coverage | Status |
|
|
667
|
+
|----------------|----------|-------|---------------|--------|
|
|
668
|
+
| REQ-{{COMPONENT}}-001 | P0 | TASK-002, TASK-003, TASK-004, TASK-007 | 95% | Not Started |
|
|
669
|
+
| REQ-{{COMPONENT}}-002 | P0 | TASK-007 | 90% | Not Started |
|
|
670
|
+
| REQ-{{COMPONENT}}-003 | P0 | TASK-007 | 90% | Not Started |
|
|
671
|
+
| REQ-{{COMPONENT}}-004 | P0 | TASK-005 | 85% | Not Started |
|
|
672
|
+
| REQ-PERF-001 | P1 | TASK-009, TASK-011 | 80% | Not Started |
|
|
673
|
+
| REQ-SEC-001 | P1 | TASK-010 | 100% | Not Started |
|
|
674
|
+
| REQ-AVAIL-001 | P2 | TASK-012 | N/A | Not Started |
|
|
675
|
+
|
|
676
|
+
**Coverage Summary**:
|
|
677
|
+
- Total Requirements: [N]
|
|
678
|
+
- Requirements with Tasks: [N] ([%]%)
|
|
679
|
+
- **Coverage Goal**: 100%
|
|
680
|
+
|
|
681
|
+
---
|
|
682
|
+
|
|
683
|
+
## Task Dependencies Graph
|
|
684
|
+
|
|
685
|
+
```
|
|
686
|
+
TASK-001 (Project Structure)
|
|
687
|
+
├── TASK-002 (Tests)
|
|
688
|
+
│ └── TASK-003 (Implementation)
|
|
689
|
+
│ ├── TASK-004 (Refactor)
|
|
690
|
+
│ ├── TASK-006 (CLI)
|
|
691
|
+
│ └── TASK-007 (API)
|
|
692
|
+
│ └── TASK-008 (Integration Tests)
|
|
693
|
+
│ ├── TASK-009 (Caching)
|
|
694
|
+
│ └── TASK-010 (Security)
|
|
695
|
+
└── TASK-005 (Repository)
|
|
696
|
+
└── TASK-007 (API)
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
---
|
|
700
|
+
|
|
701
|
+
## Sprint Planning
|
|
702
|
+
|
|
703
|
+
### Sprint 1 (P0 Tasks)
|
|
704
|
+
|
|
705
|
+
**Goal**: Complete core functionality
|
|
706
|
+
|
|
707
|
+
**Tasks**: TASK-001 through TASK-007
|
|
708
|
+
**Story Points**: 25
|
|
709
|
+
**Team Capacity**: 30 points/sprint
|
|
710
|
+
**Risk**: Medium (database complexity)
|
|
711
|
+
|
|
712
|
+
---
|
|
713
|
+
|
|
714
|
+
### Sprint 2 (P1 Tasks)
|
|
715
|
+
|
|
716
|
+
**Goal**: Production readiness
|
|
717
|
+
|
|
718
|
+
**Tasks**: TASK-008 through TASK-010
|
|
719
|
+
**Story Points**: 11
|
|
720
|
+
**Team Capacity**: 30 points/sprint
|
|
721
|
+
**Risk**: Low
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
### Sprint 3 (P2 Tasks)
|
|
726
|
+
|
|
727
|
+
**Goal**: Enhancements
|
|
728
|
+
|
|
729
|
+
**Tasks**: TASK-011, TASK-012
|
|
730
|
+
**Story Points**: 5
|
|
731
|
+
**Team Capacity**: 30 points/sprint
|
|
732
|
+
**Risk**: Low
|
|
733
|
+
|
|
734
|
+
---
|
|
735
|
+
|
|
736
|
+
## Validation Checklist
|
|
737
|
+
|
|
738
|
+
Before marking feature as complete:
|
|
739
|
+
|
|
740
|
+
### Constitutional Compliance
|
|
741
|
+
- [ ] **Article I**: All features implemented as libraries
|
|
742
|
+
- [ ] **Article II**: CLI interfaces provided
|
|
743
|
+
- [ ] **Article III**: Test-First followed (check git history)
|
|
744
|
+
- [ ] **Article V**: 100% requirements → task → code → test traceability
|
|
745
|
+
- [ ] **Article IX**: Integration tests use real services
|
|
746
|
+
|
|
747
|
+
### Quality Gates
|
|
748
|
+
- [ ] All P0 tasks complete
|
|
749
|
+
- [ ] All tests passing
|
|
750
|
+
- [ ] Test coverage ≥ 80%
|
|
751
|
+
- [ ] Code review passed
|
|
752
|
+
- [ ] Security audit passed
|
|
753
|
+
- [ ] Performance benchmarks met
|
|
754
|
+
|
|
755
|
+
### Validation Commands
|
|
756
|
+
```bash
|
|
757
|
+
# Traceability validation
|
|
758
|
+
@traceability-auditor validate requirements.md tasks.md src/
|
|
759
|
+
|
|
760
|
+
# Constitutional validation
|
|
761
|
+
@constitution-enforcer validate src/
|
|
762
|
+
|
|
763
|
+
# Code review
|
|
764
|
+
@code-reviewer review src/
|
|
765
|
+
|
|
766
|
+
# Security audit
|
|
767
|
+
@security-auditor audit src/
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
---
|
|
771
|
+
|
|
772
|
+
## References
|
|
773
|
+
|
|
774
|
+
- [Requirements Specification](requirements.md)
|
|
775
|
+
- [Design Document](design.md)
|
|
776
|
+
- [Constitutional Governance](../../steering/rules/constitution.md)
|
|
777
|
+
- [Workflow Guide](../../steering/rules/workflow.md)
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
781
|
+
**Powered by MUSUBI** - Specification Driven Development
|