@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.
@@ -0,0 +1,490 @@
1
+ ---
2
+ description: 'Hybrid fullstack story executor. Detects task type and applies UI (design-first) or backend (TDD) methodology per task.'
3
+ ---
4
+
5
+ # Dev Story Fullstack Workflow
6
+
7
+ Execute fullstack stories using a **hybrid approach** - applying design-first methodology for UI tasks and TDD for backend tasks.
8
+
9
+ **Usage**: `/dev-story-fullstack {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
+ - Design references AND API specifications
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
+ **Check MCPs for both UI and backend work:**
34
+
35
+ ### 2.1 Required MCPs (for UI tasks)
36
+
37
+ | MCP | Purpose | Probe Command |
38
+ |-----|---------|---------------|
39
+ | shadcn | Component library | `mcp__shadcn__get_project_registries({})` |
40
+ | Playwright | Visual validation | `mcp__playwright__playwright_navigate({ url: "about:blank" })` |
41
+
42
+ ### 2.2 Optional MCPs (graceful degradation)
43
+
44
+ | MCP | Purpose | Fallback |
45
+ |-----|---------|----------|
46
+ | Context7 | Library docs | Web search |
47
+ | MagicPatterns | Design code fetch | Manual implementation |
48
+ | Serena | Codebase analysis | Manual Glob/Grep |
49
+
50
+ ### 2.3 Probe Execution
51
+
52
+ ```
53
+ 1. Scan story for task types:
54
+ - IF any UI tasks → probe shadcn and Playwright as REQUIRED
55
+ - IF only backend tasks → skip UI MCP checks
56
+
57
+ 2. FOR EACH required MCP:
58
+ - Call probe command
59
+ - IF unavailable:
60
+ - OUTPUT: "ESCALATE: Required MCP '{name}' not available"
61
+ - HALT immediately
62
+
63
+ 3. FOR EACH optional MCP:
64
+ - Attempt probe
65
+ - Log availability with fallback notes
66
+
67
+ Document in Dev Agent Record:
68
+ - Available MCPs: [list]
69
+ - Unavailable (optional): [list with fallback notes]
70
+ - Task type breakdown: {ui_count} UI, {backend_count} backend
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Step 3: Load Project Context
76
+
77
+ ```
78
+ 1. Check for docs/project-context.md or project-context.md
79
+ 2. IF exists:
80
+ - Read and extract: coding standards, patterns, conventions
81
+ - Note BOTH UI patterns AND backend patterns
82
+ 3. Check Dev Notes for architecture/tech-spec references
83
+ 4. Load referenced documents for context
84
+ 5. This context applies to ALL implementation decisions
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Step 4: Detect Restart or Review Continuation
90
+
91
+ ### 4.1 Check for Incomplete Story
92
+
93
+ ```
94
+ 1. Scan all Tasks and Subtasks for checkbox status
95
+ 2. Count: completed [x] vs incomplete [ ]
96
+ 3. IF mix of completed/incomplete:
97
+ - This is a RESTART
98
+ - Find FIRST incomplete task → resume from there
99
+ - Log: "RESTART: Resuming from task {X.Y}"
100
+ 4. IF all incomplete:
101
+ - This is a FRESH START
102
+ - Log: "FRESH START: Beginning implementation"
103
+ ```
104
+
105
+ ### 4.2 Check for Review Feedback
106
+
107
+ ```
108
+ 1. Search story file for review sections:
109
+ - "Desk Check Feedback" or "Desk Check Review"
110
+ - "Senior Developer Review (AI)" or "Code Review"
111
+ - "Design Review"
112
+ - "Review Follow-ups (AI)"
113
+
114
+ 2. IF review section exists:
115
+ - Parse for unresolved items
116
+ - IF unresolved items found:
117
+ - Log: "Acting on {review-type} feedback"
118
+ - Prioritize fixing review items BEFORE new implementation
119
+ 3. IF no review section or all resolved:
120
+ - Proceed with normal implementation
121
+ ```
122
+
123
+ ### 4.3 Document Status
124
+
125
+ ```
126
+ Dev Agent Record update:
127
+ - Execution type: "Restart from task X.Y" | "Fresh start"
128
+ - Review action: "Acting on {type} feedback" | "No pending reviews"
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Step 5: Mark Story In-Progress
134
+
135
+ ```
136
+ 1. Read current status from story file
137
+ 2. IF status is "ready-for-dev" or "Draft":
138
+ - Update sprint-status.yaml → set story status to "in-progress"
139
+ - Update story file Status field → "in-progress"
140
+ - Log: "Status updated: in-progress"
141
+ 3. IF status already "in-progress":
142
+ - This is a restart, no update needed
143
+ - Log: "Status unchanged (restart)"
144
+ 4. IF no sprint-status.yaml:
145
+ - Note: "No sprint tracking file found"
146
+ - Continue without sprint updates
147
+ ```
148
+
149
+ ---
150
+
151
+ ## Step 6: Task Type Detection & Execution
152
+
153
+ **FOR EACH task/subtask (starting from first incomplete):**
154
+
155
+ ### 6.1 Detect Task Type
156
+
157
+ ```
158
+ Analyze task text for type indicators:
159
+
160
+ UI TASK indicators:
161
+ - Keywords: "component", "page", "UI", "visual", "layout", "form", "button", "modal"
162
+ - File paths: src/components/, src/app/[locale]/, *.tsx with UI
163
+ - References: MagicPatterns link, design reference, screenshot
164
+
165
+ BACKEND TASK indicators:
166
+ - Keywords: "API", "endpoint", "service", "database", "schema", "migration"
167
+ - Keywords: "validation", "authentication", "authorization", "middleware"
168
+ - File paths: src/libs/, src/models/, src/api/, route.ts, *.service.ts
169
+
170
+ MIXED/UNCLEAR:
171
+ - If task mentions both UI and backend → treat as BACKEND (TDD first, then UI)
172
+ - If still unclear → ask user or check file paths in implementation notes
173
+
174
+ Log: "Task {X.Y} detected as: {UI|BACKEND}"
175
+ ```
176
+
177
+ ### 6.2 UI Task Execution (Design-First)
178
+
179
+ ```
180
+ IF task type is UI:
181
+
182
+ 1. Design Analysis:
183
+ - Check for MagicPatterns link
184
+ - Check for shadcn component mentions
185
+ - Identify visual requirements
186
+
187
+ 2. Component Implementation:
188
+ IF MagicPatterns link:
189
+ - Fetch code via MCP
190
+ - Adapt for project structure
191
+ IF shadcn components:
192
+ - ALWAYS call get_item_examples_from_registries FIRST
193
+ - Review demo output
194
+ - Implement with correct patterns
195
+
196
+ 3. Visual Validation:
197
+ - Navigate to affected page via Playwright
198
+ - Take screenshot
199
+ - Check console for errors
200
+ - Fix and retry if issues (max 3 iterations)
201
+
202
+ 4. Add Tests (after visual validation):
203
+ - E2E tests for user flows
204
+ - Unit tests for component logic
205
+
206
+ 5. Run test suite and verify all pass
207
+ ```
208
+
209
+ ### 6.3 Backend Task Execution (TDD)
210
+
211
+ ```
212
+ IF task type is BACKEND:
213
+
214
+ 1. RED Phase - Write Failing Tests:
215
+ - Analyze task requirements
216
+ - Write tests BEFORE implementation
217
+ - Run tests, confirm they fail
218
+
219
+ 2. GREEN Phase - Minimal Implementation:
220
+ - Implement only what's needed to pass tests
221
+ - Follow project patterns
222
+ - Handle error conditions
223
+
224
+ 3. REFACTOR Phase - Improve Code:
225
+ - Clean up while keeping tests green
226
+ - Remove duplication
227
+ - Improve naming
228
+
229
+ 4. Run full test suite and verify all pass
230
+ ```
231
+
232
+ ### 6.4 Track Task Type Counts
233
+
234
+ ```
235
+ Maintain counters:
236
+ - ui_tasks_completed: [count]
237
+ - backend_tasks_completed: [count]
238
+
239
+ Update after each task completion.
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Step 7: Validate & Mark Task Complete
245
+
246
+ **FOR EACH task:**
247
+
248
+ ### Validation Gates
249
+
250
+ **For UI Tasks:**
251
+ ```
252
+ - [ ] Visual output matches design intent
253
+ - [ ] Console shows no errors from changed code
254
+ - [ ] Tests exist and pass
255
+ ```
256
+
257
+ **For Backend Tasks:**
258
+ ```
259
+ - [ ] TDD cycle completed (red → green → refactor)
260
+ - [ ] All tests pass 100%
261
+ - [ ] No regressions
262
+ ```
263
+
264
+ **For Both:**
265
+ ```
266
+ - [ ] Acceptance criteria for this task satisfied
267
+ ```
268
+
269
+ ### IF ALL GATES PASS:
270
+
271
+ ```
272
+ 1. IMMEDIATELY edit story file:
273
+ - Change task checkbox from [ ] to [x]
274
+ - Save the file
275
+
276
+ 2. Update File List section in story
277
+
278
+ 3. Add note to Dev Agent Record → Debug Log:
279
+ - "{timestamp}: Task X.Y ({UI|BACKEND}) completed"
280
+
281
+ 4. Update task type counters:
282
+ - ui_tasks_completed += 1 OR backend_tasks_completed += 1
283
+
284
+ 5. Proceed to next incomplete task (or Step 8 if all done)
285
+ ```
286
+
287
+ ### IF GATES FAIL:
288
+
289
+ ```
290
+ 1. Document failure reason in Debug Log
291
+ 2. Attempt to fix (max 3 tries)
292
+ 3. IF cannot resolve:
293
+ - HALT with status: blocked
294
+ - Output blocker details
295
+ ```
296
+
297
+ ---
298
+
299
+ ## Step 8: Story Completion & Summary
300
+
301
+ ### 8.1 Final Verification
302
+
303
+ ```
304
+ 1. Re-scan story file for any unmarked tasks
305
+ 2. IF any [ ] tasks remain:
306
+ - Return to Step 6 for those tasks
307
+
308
+ 3. Run full test suite:
309
+ npm test
310
+ npm run test:e2e (if available)
311
+
312
+ 4. Verify ALL tests pass
313
+ ```
314
+
315
+ ### 8.2 Execute Definition of Done Checklist
316
+
317
+ ```
318
+ ## Fullstack Story DoD Checklist
319
+
320
+ ### UI Tasks
321
+ - [ ] Visual validation passed (screenshots captured)
322
+ - [ ] Component library used (not built from scratch)
323
+ - [ ] Console shows no JS errors
324
+
325
+ ### Backend Tasks
326
+ - [ ] TDD compliance verified (tests first)
327
+ - [ ] All tests pass
328
+ - [ ] Security checks passed (no hardcoded secrets, input validation)
329
+
330
+ ### Integration
331
+ - [ ] End-to-end flow works (UI → API → response)
332
+ - [ ] API contracts validated (request/response shapes)
333
+ - [ ] Error handling verified across the stack
334
+
335
+ ### Common
336
+ - [ ] All tasks/subtasks marked [x]
337
+ - [ ] Implementation matches acceptance criteria
338
+ - [ ] No scope creep
339
+ - [ ] Completion Notes written
340
+ - [ ] Status set to "review"
341
+
342
+ FOR EACH unchecked item:
343
+ - Fix the issue
344
+ - Re-run validation
345
+ ```
346
+
347
+ ### 8.3 Write Completion Notes
348
+
349
+ ```
350
+ Add to Dev Agent Record or story file:
351
+
352
+ ## Completion Notes
353
+
354
+ **Summary**: [1-2 sentence description of what was built]
355
+
356
+ **Key Decisions**:
357
+ - [Decision 1 and rationale]
358
+ - [Decision 2 and rationale]
359
+
360
+ **UI Components Added**:
361
+ - [shadcn/MagicPatterns components]
362
+
363
+ **Backend Services Added**:
364
+ - [APIs, services, database changes]
365
+
366
+ **Integration Notes**:
367
+ - [How UI and backend connect]
368
+ - [Data flow description]
369
+
370
+ **Known Limitations** (if any):
371
+ - [Any compromises or TODOs for future]
372
+
373
+ **Testing**:
374
+ - [Test types: unit, integration, E2E]
375
+ - [Test count and coverage]
376
+ ```
377
+
378
+ ### 8.4 Update Status
379
+
380
+ ```
381
+ 1. Update story file Status → "review"
382
+ 2. Update sprint-status.yaml → set story status to "review"
383
+ 3. Log: "Story completed, status: review"
384
+ ```
385
+
386
+ ---
387
+
388
+ ## Step 9: Completion Handoff
389
+
390
+ **Output this structured handoff:**
391
+
392
+ ```
393
+ === AGENT HANDOFF ===
394
+ agent: {agent-name}
395
+ story: [story number, e.g., "3.2"]
396
+ status: completed | failed | blocked
397
+ files_changed:
398
+ - [list all modified/created files]
399
+ ui_tasks_completed: [count]
400
+ backend_tasks_completed: [count]
401
+ visual_validation:
402
+ screenshots: [list paths] | "N/A"
403
+ console_errors: none | [list]
404
+ tests_passed: true | false
405
+ tests_run: [count]
406
+ tdd_compliance: true | false | "partial" (if mixed)
407
+ dod_checklist: passed | failed
408
+ completion_notes: written | skipped
409
+ blockers: none | [list blockers]
410
+ next_action: proceed | fix_required | escalate
411
+ === END HANDOFF ===
412
+ ```
413
+
414
+ **Status Definitions:**
415
+ - `completed`: All tasks done, DoD passed, ready for review
416
+ - `failed`: Errors encountered that could not be resolved
417
+ - `blocked`: External dependency prevents completion
418
+
419
+ **Next Action:**
420
+ - `proceed`: Story ready for code review / quality gate
421
+ - `fix_required`: Minor issues need attention
422
+ - `escalate`: Requires human intervention
423
+
424
+ ---
425
+
426
+ ## Task Type Detection Reference
427
+
428
+ ### UI Task Patterns
429
+
430
+ | Pattern | Example |
431
+ |---------|---------|
432
+ | Component keywords | "Add Button component", "Create Card layout" |
433
+ | Page keywords | "Build dashboard page", "Create settings view" |
434
+ | Visual keywords | "Style the header", "Add responsive grid" |
435
+ | File paths | `src/components/`, `src/app/[locale]/` |
436
+ | Design refs | MagicPatterns link, Figma, screenshot |
437
+
438
+ ### Backend Task Patterns
439
+
440
+ | Pattern | Example |
441
+ |---------|---------|
442
+ | API keywords | "Create /api/users endpoint", "Add POST handler" |
443
+ | Database keywords | "Add user table", "Create migration" |
444
+ | Service keywords | "Implement auth service", "Add validation" |
445
+ | File paths | `src/libs/`, `src/models/`, `route.ts` |
446
+ | Security keywords | "Add authentication", "Validate input" |
447
+
448
+ ### Mixed Task Handling
449
+
450
+ ```
451
+ When task is clearly mixed (e.g., "Add form with API submission"):
452
+
453
+ 1. Identify backend component first
454
+ 2. Implement backend with TDD
455
+ 3. Then implement UI with design-first
456
+ 4. Integrate and test end-to-end
457
+
458
+ This ensures API contract is defined before UI consumes it.
459
+ ```
460
+
461
+ ---
462
+
463
+ ## MCP Best Practices Reference
464
+
465
+ ### shadcn MCP (UI Tasks)
466
+
467
+ ```
468
+ 1. get_project_registries - Verify setup
469
+ 2. search_items_in_registries - Find components
470
+ 3. get_item_examples_from_registries - ALWAYS call before implementing
471
+ 4. get_add_command_for_items - Get install command
472
+ 5. get_audit_checklist - Run after adding
473
+ ```
474
+
475
+ ### Playwright MCP (UI Tasks)
476
+
477
+ ```
478
+ 1. playwright_navigate - Go to page
479
+ 2. playwright_screenshot - Capture for validation
480
+ 3. playwright_console_logs - Check for errors
481
+ 4. playwright_close - Clean up
482
+ ```
483
+
484
+ ### Context7 MCP (Both)
485
+
486
+ ```
487
+ 1. resolve-library-id - Get library ID first
488
+ 2. query-docs - Query patterns
489
+ 3. Fallback: WebSearch
490
+ ```