@torka/claude-workflows 0.7.1 → 0.9.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/agents/desk-check-gate.md +199 -134
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/checklists/desk-check-checklist.md +76 -0
- package/bmad-workflows/bmm/workflows/4-implementation/implement-epic-with-subagents/steps/step-01c-new.md +2 -2
- package/commands/dev-story-backend.md +467 -0
- package/commands/dev-story-fullstack.md +490 -0
- package/commands/dev-story-ui.md +495 -0
- package/install.js +52 -8
- package/package.json +1 -1
- package/skills/agent-creator/COMMUNITY-REPOS.md +72 -0
- package/skills/agent-creator/SKILL.md +94 -102
- package/skills/agent-creator/STORY-AGENT-TEMPLATE.md +261 -166
- package/skills/agent-creator/expertise/INDEX.md +99 -0
- package/skills/agent-creator/expertise/backend-api.md +161 -0
- package/skills/agent-creator/expertise/database-orm.md +181 -0
- package/skills/agent-creator/expertise/devops-ci.md +211 -0
- package/skills/agent-creator/expertise/nextjs-fullstack.md +159 -0
- package/skills/agent-creator/expertise/react-frontend.md +134 -0
- package/skills/agent-creator/expertise/testing.md +179 -0
- package/uninstall.js +18 -0
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'TDD backend story executor. Loads story, validates context, implements with red-green-refactor discipline.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Dev Story Backend Workflow
|
|
6
|
+
|
|
7
|
+
Execute backend stories using a **Test-Driven Development (TDD) approach** with red-green-refactor discipline.
|
|
8
|
+
|
|
9
|
+
**Usage**: `/dev-story-backend {story-identifier}`
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Step 1: Load Story & Validate
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
1. Parse story identifier (e.g., "3.2", "S3.2", "story-3.2", or story name)
|
|
17
|
+
2. Read sprint-status.yaml to locate story path (or accept direct file path)
|
|
18
|
+
3. Read and parse story file completely
|
|
19
|
+
4. Extract:
|
|
20
|
+
- Tasks and subtasks (checkbox items)
|
|
21
|
+
- Acceptance criteria
|
|
22
|
+
- Dev Notes section
|
|
23
|
+
- API specifications, database schema references
|
|
24
|
+
5. VALIDATE: Story file exists and has required sections (Tasks, Acceptance Criteria)
|
|
25
|
+
- If missing → OUTPUT: "ERROR: Story file missing or invalid. Path: {path}"
|
|
26
|
+
- HALT
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Step 2: MCP Availability Protocol
|
|
32
|
+
|
|
33
|
+
**All MCPs are optional for backend work - graceful degradation available:**
|
|
34
|
+
|
|
35
|
+
| MCP | Purpose | Fallback |
|
|
36
|
+
|-----|---------|----------|
|
|
37
|
+
| Context7 | Library documentation | Web search |
|
|
38
|
+
| Serena | Codebase analysis | Manual Glob/Grep exploration |
|
|
39
|
+
|
|
40
|
+
### Probe Execution
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
FOR EACH optional MCP:
|
|
44
|
+
1. Attempt probe:
|
|
45
|
+
- Context7: mcp__context7__resolve-library-id({ libraryName: "test", query: "test" })
|
|
46
|
+
- Serena: [check if available in tool list]
|
|
47
|
+
|
|
48
|
+
2. IF available:
|
|
49
|
+
- Log: "MCP {name}: available"
|
|
50
|
+
|
|
51
|
+
3. IF unavailable:
|
|
52
|
+
- Log: "MCP {name}: unavailable - using fallback"
|
|
53
|
+
- Note fallback approach
|
|
54
|
+
|
|
55
|
+
No critical MCPs for backend - all have fallbacks.
|
|
56
|
+
Document in Dev Agent Record.
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Step 3: Load Project Context
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
1. Check for docs/project-context.md or project-context.md
|
|
65
|
+
2. IF exists:
|
|
66
|
+
- Read and extract: coding standards, patterns, conventions
|
|
67
|
+
- Note API patterns, error handling conventions
|
|
68
|
+
- Note database/ORM patterns
|
|
69
|
+
3. Check Dev Notes for architecture/tech-spec references
|
|
70
|
+
4. Load referenced documents for context
|
|
71
|
+
5. This context applies to ALL implementation decisions
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Step 4: Detect Restart or Review Continuation
|
|
77
|
+
|
|
78
|
+
### 4.1 Check for Incomplete Story
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
1. Scan all Tasks and Subtasks for checkbox status
|
|
82
|
+
2. Count: completed [x] vs incomplete [ ]
|
|
83
|
+
3. IF mix of completed/incomplete:
|
|
84
|
+
- This is a RESTART
|
|
85
|
+
- Find FIRST incomplete task → resume from there
|
|
86
|
+
- Log: "RESTART: Resuming from task {X.Y}"
|
|
87
|
+
4. IF all incomplete:
|
|
88
|
+
- This is a FRESH START
|
|
89
|
+
- Log: "FRESH START: Beginning implementation"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 4.2 Check for Review Feedback
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
1. Search story file for these sections:
|
|
96
|
+
- "Desk Check Feedback" or "Desk Check Review"
|
|
97
|
+
- "Senior Developer Review (AI)" or "Code Review"
|
|
98
|
+
- "Review Follow-ups (AI)"
|
|
99
|
+
|
|
100
|
+
2. IF review section exists:
|
|
101
|
+
- Parse for unresolved items (unchecked boxes, open issues)
|
|
102
|
+
- IF unresolved items found:
|
|
103
|
+
- Log: "Acting on {review-type} feedback"
|
|
104
|
+
- Prioritize fixing review items BEFORE new implementation
|
|
105
|
+
- Create mental task list from review items
|
|
106
|
+
3. IF no review section or all resolved:
|
|
107
|
+
- Proceed with normal implementation
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 4.3 Document Status
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
Dev Agent Record update:
|
|
114
|
+
- Execution type: "Restart from task X.Y" | "Fresh start"
|
|
115
|
+
- Review action: "Acting on {type} feedback" | "No pending reviews"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Step 5: Mark Story In-Progress
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
1. Read current status from story file
|
|
124
|
+
2. IF status is "ready-for-dev" or "Draft":
|
|
125
|
+
- Update sprint-status.yaml → set story status to "in-progress"
|
|
126
|
+
- Update story file Status field → "in-progress"
|
|
127
|
+
- Log: "Status updated: in-progress"
|
|
128
|
+
3. IF status already "in-progress":
|
|
129
|
+
- This is a restart, no update needed
|
|
130
|
+
- Log: "Status unchanged (restart)"
|
|
131
|
+
4. IF no sprint-status.yaml:
|
|
132
|
+
- Note: "No sprint tracking file found"
|
|
133
|
+
- Continue without sprint updates
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Step 6: Implement with TDD (Per Task)
|
|
139
|
+
|
|
140
|
+
**FOR EACH task/subtask (starting from first incomplete):**
|
|
141
|
+
|
|
142
|
+
### 6.1 RED Phase - Write Failing Tests First
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
1. Analyze task requirements:
|
|
146
|
+
- What behavior should be implemented?
|
|
147
|
+
- What are the expected inputs/outputs?
|
|
148
|
+
- What error conditions should be handled?
|
|
149
|
+
|
|
150
|
+
2. Write test(s) BEFORE any implementation:
|
|
151
|
+
- Test file location: co-located (e.g., service.test.ts) or tests/ directory
|
|
152
|
+
- Use project's testing framework (Vitest/Jest)
|
|
153
|
+
- Cover happy path AND edge cases
|
|
154
|
+
|
|
155
|
+
3. Run tests and CONFIRM they fail:
|
|
156
|
+
npm test -- --filter "{test-file}"
|
|
157
|
+
|
|
158
|
+
- IF tests pass (shouldn't happen yet):
|
|
159
|
+
- Tests may be wrong - review test logic
|
|
160
|
+
- Ensure testing actual new behavior
|
|
161
|
+
|
|
162
|
+
4. Log: "RED: {count} failing tests for task {X.Y}"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 6.2 GREEN Phase - Minimal Implementation
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
1. Implement ONLY what's needed to pass the tests:
|
|
169
|
+
- Follow project patterns from project-context.md
|
|
170
|
+
- Use existing utilities/helpers where available
|
|
171
|
+
- Handle error conditions from task spec
|
|
172
|
+
|
|
173
|
+
2. Run tests after each change:
|
|
174
|
+
npm test -- --filter "{test-file}"
|
|
175
|
+
|
|
176
|
+
3. Continue until ALL tests pass:
|
|
177
|
+
- Focus on making tests green
|
|
178
|
+
- Don't optimize yet
|
|
179
|
+
|
|
180
|
+
4. Log: "GREEN: All tests passing for task {X.Y}"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 6.3 REFACTOR Phase - Improve Code Quality
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
1. With tests passing, improve the code:
|
|
187
|
+
- Remove duplication
|
|
188
|
+
- Improve naming
|
|
189
|
+
- Extract functions if needed
|
|
190
|
+
- Ensure consistent style
|
|
191
|
+
|
|
192
|
+
2. After EACH refactor, run tests:
|
|
193
|
+
npm test
|
|
194
|
+
|
|
195
|
+
- Tests MUST stay green
|
|
196
|
+
- IF tests fail: revert last change, try different approach
|
|
197
|
+
|
|
198
|
+
3. Log: "REFACTOR: Code improved, tests still green"
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### 6.4 Verify Full Suite
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
1. Run complete test suite:
|
|
205
|
+
npm test
|
|
206
|
+
|
|
207
|
+
2. Ensure no regressions:
|
|
208
|
+
- All existing tests pass
|
|
209
|
+
- New tests pass
|
|
210
|
+
|
|
211
|
+
3. IF any failures:
|
|
212
|
+
- Fix immediately
|
|
213
|
+
- Do not proceed with failing tests
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Step 7: Validate & Mark Task Complete
|
|
219
|
+
|
|
220
|
+
**FOR EACH task:**
|
|
221
|
+
|
|
222
|
+
### Validation Gates (ALL must pass)
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
- [ ] Tests exist for the functionality (written FIRST)
|
|
226
|
+
- [ ] TDD cycle completed (red → green → refactor)
|
|
227
|
+
- [ ] All tests pass 100%
|
|
228
|
+
- [ ] No regressions (full suite passes)
|
|
229
|
+
- [ ] Acceptance criteria for this task satisfied
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### IF ALL GATES PASS:
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
1. IMMEDIATELY edit story file:
|
|
236
|
+
- Change task checkbox from [ ] to [x]
|
|
237
|
+
- Save the file
|
|
238
|
+
|
|
239
|
+
2. Update File List section in story:
|
|
240
|
+
- Add any new/modified files
|
|
241
|
+
|
|
242
|
+
3. Add note to Dev Agent Record → Debug Log:
|
|
243
|
+
- "{timestamp}: Task X.Y completed (TDD) - {brief summary}"
|
|
244
|
+
|
|
245
|
+
4. IF this was a review follow-up task:
|
|
246
|
+
- Mark corresponding review item as resolved
|
|
247
|
+
|
|
248
|
+
5. Proceed to next incomplete task (or Step 8 if all done)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### IF GATES FAIL:
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
1. Document failure reason in Debug Log
|
|
255
|
+
2. Attempt to fix (max 3 tries per issue)
|
|
256
|
+
3. IF cannot resolve after 3 tries:
|
|
257
|
+
- Document blocker clearly
|
|
258
|
+
- HALT with status: blocked
|
|
259
|
+
- Output blocker details for user
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Step 8: Story Completion & Summary
|
|
265
|
+
|
|
266
|
+
### 8.1 Final Verification
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
1. Re-scan story file for any unmarked tasks
|
|
270
|
+
2. IF any [ ] tasks remain:
|
|
271
|
+
- Return to Step 6 for those tasks
|
|
272
|
+
- Do NOT proceed until all [x]
|
|
273
|
+
|
|
274
|
+
3. Run full regression suite:
|
|
275
|
+
npm test
|
|
276
|
+
|
|
277
|
+
4. Verify ALL tests pass
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### 8.2 Execute Definition of Done Checklist
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
## Backend Story DoD Checklist
|
|
284
|
+
|
|
285
|
+
### TDD Compliance
|
|
286
|
+
- [ ] Tests written BEFORE implementation (for each task)
|
|
287
|
+
- [ ] Red-green-refactor cycle followed
|
|
288
|
+
- [ ] All tests pass 100%
|
|
289
|
+
- [ ] No test skips or `.only` left in code
|
|
290
|
+
|
|
291
|
+
### Implementation
|
|
292
|
+
- [ ] All tasks/subtasks marked [x]
|
|
293
|
+
- [ ] Implementation matches acceptance criteria
|
|
294
|
+
- [ ] Error handling per spec
|
|
295
|
+
- [ ] No scope creep (only implemented what was specified)
|
|
296
|
+
- [ ] Follows project patterns from project-context.md
|
|
297
|
+
|
|
298
|
+
### Security
|
|
299
|
+
- [ ] No hardcoded secrets or credentials
|
|
300
|
+
- [ ] Input validation on external data (API inputs, user data)
|
|
301
|
+
- [ ] SQL injection prevention (parameterized queries)
|
|
302
|
+
- [ ] Proper authentication/authorization checks (if applicable)
|
|
303
|
+
|
|
304
|
+
### Documentation
|
|
305
|
+
- [ ] File List updated in story
|
|
306
|
+
- [ ] Completion Notes written (see below)
|
|
307
|
+
- [ ] Change Log updated (if exists)
|
|
308
|
+
- [ ] Status set to "review"
|
|
309
|
+
|
|
310
|
+
FOR EACH unchecked item:
|
|
311
|
+
- Fix the issue
|
|
312
|
+
- Re-run validation
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### 8.3 Write Completion Notes
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
Add to Dev Agent Record or story file:
|
|
319
|
+
|
|
320
|
+
## Completion Notes
|
|
321
|
+
|
|
322
|
+
**Summary**: [1-2 sentence description of what was built]
|
|
323
|
+
|
|
324
|
+
**Key Decisions**:
|
|
325
|
+
- [Decision 1 and rationale]
|
|
326
|
+
- [Decision 2 and rationale]
|
|
327
|
+
|
|
328
|
+
**Architecture Notes** (if applicable):
|
|
329
|
+
- [Patterns followed]
|
|
330
|
+
- [Dependencies added]
|
|
331
|
+
|
|
332
|
+
**Known Limitations** (if any):
|
|
333
|
+
- [Any compromises or TODOs for future]
|
|
334
|
+
|
|
335
|
+
**Testing**:
|
|
336
|
+
- [Test types added: unit, integration]
|
|
337
|
+
- [Test count and coverage summary]
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### 8.4 Update Status
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
1. Update story file Status → "review"
|
|
344
|
+
2. Update sprint-status.yaml → set story status to "review"
|
|
345
|
+
3. Log: "Story completed, status: review"
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Step 9: Completion Handoff
|
|
351
|
+
|
|
352
|
+
**Output this structured handoff:**
|
|
353
|
+
|
|
354
|
+
```
|
|
355
|
+
=== AGENT HANDOFF ===
|
|
356
|
+
agent: {agent-name}
|
|
357
|
+
story: [story number, e.g., "3.2"]
|
|
358
|
+
status: completed | failed | blocked
|
|
359
|
+
files_changed:
|
|
360
|
+
- [list all modified/created files]
|
|
361
|
+
tests_passed: true | false
|
|
362
|
+
tests_run: [count]
|
|
363
|
+
tdd_compliance: true | false
|
|
364
|
+
dod_checklist: passed | failed
|
|
365
|
+
completion_notes: written | skipped
|
|
366
|
+
blockers: none | [list blockers]
|
|
367
|
+
next_action: proceed | fix_required | escalate
|
|
368
|
+
=== END HANDOFF ===
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
**Status Definitions:**
|
|
372
|
+
- `completed`: All tasks done, DoD passed, ready for review
|
|
373
|
+
- `failed`: Errors encountered that could not be resolved
|
|
374
|
+
- `blocked`: External dependency prevents completion
|
|
375
|
+
|
|
376
|
+
**Next Action:**
|
|
377
|
+
- `proceed`: Story ready for code review / quality gate
|
|
378
|
+
- `fix_required`: Minor issues need attention
|
|
379
|
+
- `escalate`: Requires human intervention
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## TDD Best Practices Reference
|
|
384
|
+
|
|
385
|
+
### Test Structure
|
|
386
|
+
|
|
387
|
+
```typescript
|
|
388
|
+
describe('FeatureName', () => {
|
|
389
|
+
describe('methodName', () => {
|
|
390
|
+
it('should handle happy path', () => {
|
|
391
|
+
// Arrange
|
|
392
|
+
// Act
|
|
393
|
+
// Assert
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it('should handle edge case X', () => {
|
|
397
|
+
// ...
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
it('should throw on invalid input', () => {
|
|
401
|
+
// ...
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### What to Test
|
|
408
|
+
|
|
409
|
+
**Always Test:**
|
|
410
|
+
- Happy path (expected behavior)
|
|
411
|
+
- Edge cases (empty inputs, boundary values)
|
|
412
|
+
- Error conditions (invalid inputs, missing data)
|
|
413
|
+
- Integration points (API calls, database operations)
|
|
414
|
+
|
|
415
|
+
**Test Isolation:**
|
|
416
|
+
- Mock external dependencies (APIs, databases)
|
|
417
|
+
- Each test should be independent
|
|
418
|
+
- Clean up after tests
|
|
419
|
+
|
|
420
|
+
### Running Tests
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
# Run all tests
|
|
424
|
+
npm test
|
|
425
|
+
|
|
426
|
+
# Run specific test file
|
|
427
|
+
npm test -- --filter "service.test"
|
|
428
|
+
|
|
429
|
+
# Run with coverage
|
|
430
|
+
npm test -- --coverage
|
|
431
|
+
|
|
432
|
+
# Watch mode during development
|
|
433
|
+
npm test -- --watch
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## MCP Best Practices Reference
|
|
439
|
+
|
|
440
|
+
### Context7 MCP (Optional)
|
|
441
|
+
|
|
442
|
+
```
|
|
443
|
+
1. mcp__context7__resolve-library-id({ libraryName: "...", query: "..." })
|
|
444
|
+
- Get library ID first
|
|
445
|
+
2. mcp__context7__query-docs({ libraryId: "...", query: "..." })
|
|
446
|
+
- Query specific patterns
|
|
447
|
+
3. Limit to 3 calls per question
|
|
448
|
+
4. Fallback: WebSearch for documentation
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Serena MCP (Optional)
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
1. Use for codebase-wide analysis
|
|
455
|
+
2. Query for related code patterns before implementation
|
|
456
|
+
3. Find similar implementations
|
|
457
|
+
4. Fallback: Glob + Grep for manual exploration
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Database/ORM Patterns
|
|
461
|
+
|
|
462
|
+
```
|
|
463
|
+
1. Use project's ORM (Drizzle in this project)
|
|
464
|
+
2. Follow schema patterns from src/models/Schema.ts
|
|
465
|
+
3. Use migrations for schema changes: npm run db:generate
|
|
466
|
+
4. Test database operations with proper mocking or test database
|
|
467
|
+
```
|