@atlashub/smartstack-cli 2.0.0 → 2.2.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.
Files changed (59) hide show
  1. package/.documentation/agents.html +147 -40
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +3 -3
  4. package/.documentation/cli-commands.html +2 -2
  5. package/.documentation/commands.html +14 -14
  6. package/.documentation/efcore.html +14 -14
  7. package/.documentation/gitflow.html +12 -12
  8. package/.documentation/hooks.html +41 -3
  9. package/.documentation/index.html +1 -1
  10. package/.documentation/init.html +2 -2
  11. package/.documentation/installation.html +11 -11
  12. package/.documentation/js/app.js +1 -1
  13. package/.documentation/ralph-loop.html +1 -1
  14. package/.documentation/test-web.html +4 -4
  15. package/dist/index.js +19 -11
  16. package/dist/index.js.map +1 -1
  17. package/dist/mcp-entry.mjs +57595 -4569
  18. package/dist/mcp-entry.mjs.map +1 -1
  19. package/package.json +1 -1
  20. package/templates/agents/ba-reader.md +250 -0
  21. package/templates/agents/ba-writer.md +210 -0
  22. package/templates/agents/docs-context-reader.md +51 -33
  23. package/templates/skills/_shared.md +2 -0
  24. package/templates/skills/business-analyse/SKILL.md +120 -108
  25. package/templates/skills/business-analyse/_shared.md +191 -160
  26. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +478 -0
  27. package/templates/skills/business-analyse/questionnaire/01-context.md +3 -15
  28. package/templates/skills/business-analyse/questionnaire/08-performance.md +7 -21
  29. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -13
  30. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -13
  31. package/templates/skills/business-analyse/questionnaire.md +72 -76
  32. package/templates/skills/business-analyse/react/components.md +317 -154
  33. package/templates/skills/business-analyse/react/i18n-template.md +167 -106
  34. package/templates/skills/business-analyse/react/schema.md +325 -106
  35. package/templates/skills/business-analyse/schemas/feature-schema.json +690 -0
  36. package/templates/skills/business-analyse/steps/step-00-init.md +395 -285
  37. package/templates/skills/business-analyse/steps/step-01-analyse.md +505 -0
  38. package/templates/skills/business-analyse/steps/step-02-specify.md +833 -0
  39. package/templates/skills/business-analyse/steps/step-03-validate.md +862 -0
  40. package/templates/skills/business-analyse/steps/step-04-handoff.md +1593 -0
  41. package/templates/skills/business-analyse/templates/tpl-handoff.md +95 -43
  42. package/templates/skills/controller/templates.md +82 -0
  43. package/templates/skills/efcore/references/zero-downtime-patterns.md +227 -0
  44. package/templates/skills/efcore/steps/migration/step-03-validate.md +19 -0
  45. package/templates/skills/review-code/SKILL.md +4 -2
  46. package/templates/skills/review-code/references/owasp-api-top10.md +243 -0
  47. package/templates/skills/review-code/references/security-checklist.md +86 -1
  48. package/templates/skills/review-code/references/smartstack-conventions.md +166 -0
  49. package/templates/skills/workflow/SKILL.md +27 -0
  50. package/templates/skills/business-analyse/steps/step-01-discover.md +0 -737
  51. package/templates/skills/business-analyse/steps/step-02-analyse.md +0 -299
  52. package/templates/skills/business-analyse/steps/step-03-specify.md +0 -409
  53. package/templates/skills/business-analyse/steps/step-04-validate.md +0 -313
  54. package/templates/skills/business-analyse/steps/step-05-handoff.md +0 -658
  55. package/templates/skills/business-analyse/steps/step-06-doc-html.md +0 -320
  56. package/templates/skills/business-analyse/templates/00-context.md +0 -105
  57. package/templates/skills/business-analyse/templates/tpl-brd.md +0 -97
  58. package/templates/skills/business-analyse/templates/tpl-discovery.md +0 -78
  59. package/templates/skills/business-analyse/tracking/change-template.md +0 -30
@@ -0,0 +1,1593 @@
1
+ # Step 04: Handoff
2
+
3
+ > **Version:** 3.0.0
4
+ > **Name:** step-04-handoff
5
+ > **Next step:** null (final step in business-analyse)
6
+ > **Purpose:** Generate development handoff package (feature.json.handoff + .ralph/prd.json) ready for coding
7
+ > **Input:** feature.json (specification + validation sections, status: "approved")
8
+ > **Output:** feature.json.handoff enriched + .ralph/prd.json + .ralph/progress.txt + status: "handed-off"
9
+
10
+ ---
11
+
12
+ ## 1. Introduction
13
+
14
+ This step **finalizes the transition** from business analysis to development. You will:
15
+
16
+ 1. **Verify validation passed** - Ensure status is "approved"
17
+ 2. **Explore existing patterns** - Search for similar modules, code generators, or scaffolding agents
18
+ 3. **Map specification to files** - Document which backend/frontend/seeddata tables implement each requirement
19
+ 4. **Generate implementation instructions** - Task breakdown for developers
20
+ 5. **Map business rules to code** - Where each BR will be validated
21
+ 6. **Define API endpoints** - RESTful routes for all operations
22
+ 7. **Test requirements** - Unit, integration, and E2E test mapping
23
+ 8. **Plan i18n keys** - Translation keys for UI and messages
24
+ 9. **Generate Ralph Loop prd.json** - Comprehensive product requirements document
25
+ 10. **Initialize progress tracker** - Progress.txt for monitoring completion
26
+
27
+ ---
28
+
29
+ ## 2. Mode Support
30
+
31
+ ### Standard Mode
32
+ Execute full handoff with all implementation details.
33
+
34
+ ### Micro Mode
35
+ IF use_case = micro:
36
+ - Simplified handoff with minimal tasks
37
+ - Only essential CRUD endpoints
38
+ - Basic prd.json (fewer layers, simplified task decomposition)
39
+ - Auto-suggest Feature Full agent for fast scaffolding
40
+
41
+ ### Delta Mode
42
+ IF use_case = refactoring:
43
+ - Generate handoff only for affected features
44
+ - Reuse existing implementation patterns
45
+ - Update prd.json only for changed sections
46
+
47
+ ---
48
+
49
+ ## 2. Verify Validation Passed
50
+
51
+ ### 2.1 Check Status
52
+
53
+ Before proceeding, verify:
54
+
55
+ ```json
56
+ {
57
+ "validation": {
58
+ "status": "approved" ✓,
59
+ "approvalMode": "standard|force",
60
+ "approvedAt": "2025-02-01T10:35:00Z",
61
+ "decision": {
62
+ "approved": true
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ **Issue:** If status ≠ "approved" → **Stop. Return to step-03-validate.md.**
69
+
70
+ ### 2.2 Validation Summary
71
+
72
+ Display summary before proceeding:
73
+
74
+ ```
75
+ Validating approval status...
76
+ ✓ Validation: APPROVED
77
+ ✓ Specification: Complete & consistent
78
+ ✓ Decision: Ready for handoff
79
+
80
+ Proceeding to implementation planning...
81
+ ```
82
+
83
+ ---
84
+
85
+ ## 3. Explore Existing Patterns
86
+
87
+ ### 3.1 Parallel Agents & Code Generators
88
+
89
+ Before generating prd.json, check for existing tools:
90
+
91
+ ```
92
+ Searching for similar modules and scaffolding agents...
93
+
94
+ Available options:
95
+ 1. Feature Full (claude-code skill) → Fast scaffolding (recommended)
96
+ 2. Ralph Loop (local prd.json runner) → Task-driven development
97
+ 3. Economy Mode (async generation) → Large-scale projects
98
+ 4. Custom MCP Tools (SmartStack.mcp) → Validation & generation
99
+
100
+ Selected: Feature Full + Ralph Loop
101
+ ```
102
+
103
+ ### 3.2 Code Generation Options
104
+
105
+ Offer user choices:
106
+
107
+ ```json
108
+ {
109
+ "generationOptions": [
110
+ {
111
+ "id": 1,
112
+ "tool": "Feature Full",
113
+ "description": "Parallel code generation (C#, React, tests)",
114
+ "duration": "15-30 min",
115
+ "coverage": "70-80%"
116
+ },
117
+ {
118
+ "id": 2,
119
+ "tool": "Ralph Loop",
120
+ "description": "Task-driven coding (sequential, detailed)",
121
+ "duration": "1-2 hours",
122
+ "coverage": "95-100%"
123
+ },
124
+ {
125
+ "id": 3,
126
+ "tool": "Economy Mode",
127
+ "description": "Asynchronous generation in background",
128
+ "duration": "varies",
129
+ "coverage": "Depends on parallelization"
130
+ }
131
+ ],
132
+ "recommended": "Feature Full + Ralph Loop (combined approach)"
133
+ }
134
+ ```
135
+
136
+ User selects which agent to use in next step.
137
+
138
+ ---
139
+
140
+ ## 4. Map Specification to Files
141
+
142
+ ### 4.1 Backend File Mapping
143
+
144
+ For each entity in specification.entities[], document implementation files:
145
+
146
+ ```json
147
+ {
148
+ "fileMapping": {
149
+ "backend": [
150
+ {
151
+ "entity": "Order",
152
+ "files": [
153
+ {
154
+ "path": "src/Domain/Entities/Order.cs",
155
+ "type": "Entity",
156
+ "linkedFRs": ["FR-001", "FR-002", "FR-003"]
157
+ },
158
+ {
159
+ "path": "src/Application/Services/OrderService.cs",
160
+ "type": "Service",
161
+ "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"]
162
+ },
163
+ {
164
+ "path": "src/API/Controllers/OrdersController.cs",
165
+ "type": "ApiController",
166
+ "endpoints": 6,
167
+ "linkedUCs": ["UC-001", "UC-002", "UC-003", "UC-004", "UC-005", "UC-006"]
168
+ },
169
+ {
170
+ "path": "src/Infrastructure/Repositories/OrderRepository.cs",
171
+ "type": "Repository",
172
+ "operations": ["GetAll", "GetById", "Create", "Update", "Delete"]
173
+ },
174
+ {
175
+ "path": "src/Infrastructure/Data/Migrations/AddOrderTable.cs",
176
+ "type": "Migration",
177
+ "tables": ["Order", "OrderLine"]
178
+ },
179
+ {
180
+ "path": "src/Tests/Application/OrderServiceTests.cs",
181
+ "type": "UnitTests",
182
+ "testCount": 12
183
+ },
184
+ {
185
+ "path": "src/Tests/Integration/OrderApiTests.cs",
186
+ "type": "IntegrationTests",
187
+ "testCount": 8
188
+ }
189
+ ]
190
+ }
191
+ ]
192
+ }
193
+ }
194
+ ```
195
+
196
+ ### 4.2 Frontend File Mapping
197
+
198
+ For each use case in specification.useCases[], document UI files:
199
+
200
+ ```json
201
+ {
202
+ "fileMapping": {
203
+ "frontend": [
204
+ {
205
+ "useCase": "UC-001: List Orders",
206
+ "files": [
207
+ {
208
+ "path": "src/pages/Orders/OrderListPage.tsx",
209
+ "type": "Page",
210
+ "linkedWireframe": "WF-001"
211
+ },
212
+ {
213
+ "path": "src/components/Orders/OrderListTable.tsx",
214
+ "type": "Component",
215
+ "linkedFRs": ["FR-001"]
216
+ },
217
+ {
218
+ "path": "src/components/Orders/OrderFilterBar.tsx",
219
+ "type": "Component",
220
+ "linkedFRs": ["FR-001"]
221
+ },
222
+ {
223
+ "path": "src/services/api/OrdersApiClient.ts",
224
+ "type": "ApiClient",
225
+ "methods": ["getOrders", "searchOrders", "filterOrders"]
226
+ },
227
+ {
228
+ "path": "src/stores/ordersSlice.ts",
229
+ "type": "Redux Slice",
230
+ "state": ["orders", "loading", "error", "pagination"]
231
+ },
232
+ {
233
+ "path": "src/tests/pages/OrderListPage.test.tsx",
234
+ "type": "ComponentTests",
235
+ "testCount": 8
236
+ }
237
+ ]
238
+ },
239
+ {
240
+ "useCase": "UC-002: Create Order",
241
+ "files": [
242
+ {
243
+ "path": "src/pages/Orders/CreateOrderPage.tsx",
244
+ "type": "Page",
245
+ "linkedWireframe": "WF-002"
246
+ },
247
+ {
248
+ "path": "src/components/Orders/CreateOrderForm.tsx",
249
+ "type": "Component",
250
+ "linkedFRs": ["FR-002", "FR-003"]
251
+ },
252
+ {
253
+ "path": "src/hooks/useOrderForm.ts",
254
+ "type": "CustomHook",
255
+ "linkedValidations": ["Validations for Order fields"]
256
+ }
257
+ ]
258
+ }
259
+ ]
260
+ }
261
+ }
262
+ ```
263
+
264
+ ### 4.3 SeedData File Mapping
265
+
266
+ Map 5 mandatory SeedData tables to migration files:
267
+
268
+ ```json
269
+ {
270
+ "fileMapping": {
271
+ "seedData": [
272
+ {
273
+ "table": "Module_Status",
274
+ "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Status.cs",
275
+ "rows": [
276
+ {
277
+ "id": 1,
278
+ "code": "DRAFT",
279
+ "displayName": "Draft",
280
+ "description": "Order created but not submitted"
281
+ },
282
+ {
283
+ "id": 2,
284
+ "code": "SUBMITTED",
285
+ "displayName": "Submitted for Review",
286
+ "description": "Order awaiting manager approval"
287
+ },
288
+ {
289
+ "id": 3,
290
+ "code": "APPROVED",
291
+ "displayName": "Approved",
292
+ "description": "Order approved and ready for fulfillment"
293
+ }
294
+ ]
295
+ },
296
+ {
297
+ "table": "Module_Priority",
298
+ "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Priority.cs",
299
+ "rows": 3
300
+ },
301
+ {
302
+ "table": "Module_Category",
303
+ "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Category.cs",
304
+ "rows": 8
305
+ },
306
+ {
307
+ "table": "Module_Type",
308
+ "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Type.cs",
309
+ "rows": 4
310
+ },
311
+ {
312
+ "table": "Module_Department",
313
+ "migrationFile": "src/Infrastructure/Data/Migrations/Seed_Order_Department.cs",
314
+ "rows": 6
315
+ }
316
+ ]
317
+ }
318
+ }
319
+ ```
320
+
321
+ ---
322
+
323
+ ## 5. Generate Implementation Instructions
324
+
325
+ ### 5.1 Backend Implementation Sequence
326
+
327
+ Create ordered task list:
328
+
329
+ ```json
330
+ {
331
+ "implementationSequence": {
332
+ "backend": [
333
+ {
334
+ "phase": 1,
335
+ "name": "Domain Layer",
336
+ "tasks": [
337
+ {
338
+ "taskId": "TASK-001",
339
+ "title": "Define Order entity",
340
+ "linkedFRs": ["FR-001"],
341
+ "file": "src/Domain/Entities/Order.cs",
342
+ "priority": 1,
343
+ "effort": "2h"
344
+ },
345
+ {
346
+ "taskId": "TASK-002",
347
+ "title": "Define order status enum",
348
+ "linkedFRs": ["FR-001"],
349
+ "file": "src/Domain/Entities/OrderStatus.cs",
350
+ "priority": 2,
351
+ "effort": "1h"
352
+ }
353
+ ]
354
+ },
355
+ {
356
+ "phase": 2,
357
+ "name": "SeedData Layer",
358
+ "tasks": [
359
+ {
360
+ "taskId": "TASK-003",
361
+ "title": "Create SeedData migration for Order_Status",
362
+ "linkedFRs": [],
363
+ "file": "src/Infrastructure/Data/Migrations/Seed_Order_Status.cs",
364
+ "priority": 1,
365
+ "effort": "1h"
366
+ }
367
+ ]
368
+ },
369
+ {
370
+ "phase": 3,
371
+ "name": "Application Layer",
372
+ "tasks": [
373
+ {
374
+ "taskId": "TASK-004",
375
+ "title": "Create OrderService with CRUD operations",
376
+ "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"],
377
+ "file": "src/Application/Services/OrderService.cs",
378
+ "priority": 1,
379
+ "effort": "4h"
380
+ }
381
+ ]
382
+ },
383
+ {
384
+ "phase": 4,
385
+ "name": "Infrastructure Layer",
386
+ "tasks": [
387
+ {
388
+ "taskId": "TASK-005",
389
+ "title": "Create OrderRepository",
390
+ "linkedFRs": ["FR-001"],
391
+ "file": "src/Infrastructure/Repositories/OrderRepository.cs",
392
+ "priority": 1,
393
+ "effort": "2h"
394
+ }
395
+ ]
396
+ },
397
+ {
398
+ "phase": 5,
399
+ "name": "API Layer",
400
+ "tasks": [
401
+ {
402
+ "taskId": "TASK-006",
403
+ "title": "Create OrdersController with endpoints",
404
+ "linkedUCs": ["UC-001", "UC-002", "UC-003"],
405
+ "file": "src/API/Controllers/OrdersController.cs",
406
+ "priority": 1,
407
+ "effort": "3h"
408
+ }
409
+ ]
410
+ },
411
+ {
412
+ "phase": 6,
413
+ "name": "Frontend Layer",
414
+ "tasks": [
415
+ {
416
+ "taskId": "TASK-007",
417
+ "title": "Create OrderListPage component",
418
+ "linkedUCs": ["UC-001"],
419
+ "file": "src/pages/Orders/OrderListPage.tsx",
420
+ "priority": 1,
421
+ "effort": "3h"
422
+ }
423
+ ]
424
+ },
425
+ {
426
+ "phase": 7,
427
+ "name": "i18n Layer",
428
+ "tasks": [
429
+ {
430
+ "taskId": "TASK-008",
431
+ "title": "Add i18n keys for Order module",
432
+ "file": "src/locales/en/orders.json",
433
+ "priority": 2,
434
+ "effort": "1h"
435
+ }
436
+ ]
437
+ },
438
+ {
439
+ "phase": 8,
440
+ "name": "Tests & Validation",
441
+ "tasks": [
442
+ {
443
+ "taskId": "TASK-009",
444
+ "title": "Unit tests for OrderService",
445
+ "linkedFRs": ["FR-001", "FR-002"],
446
+ "file": "src/Tests/Application/OrderServiceTests.cs",
447
+ "priority": 1,
448
+ "effort": "2h"
449
+ },
450
+ {
451
+ "taskId": "TASK-010",
452
+ "title": "Integration tests for OrdersController",
453
+ "linkedUCs": ["UC-001", "UC-002"],
454
+ "file": "src/Tests/Integration/OrderApiTests.cs",
455
+ "priority": 1,
456
+ "effort": "2h"
457
+ }
458
+ ]
459
+ }
460
+ ]
461
+ }
462
+ }
463
+ ```
464
+
465
+ ### 5.2 Decomposition Rules
466
+
467
+ For task breakdown:
468
+
469
+ | Layer | Unit | Tasks |
470
+ |-------|------|-------|
471
+ | **Domain** | Entity + Enum | 1-3 per entity |
472
+ | **SeedData** | Table | 1 per table |
473
+ | **Application** | Service | 1 per major feature (CRUD + business logic) |
474
+ | **Infrastructure** | Repository | 1 per entity |
475
+ | **API** | Controller | 1 per resource |
476
+ | **Frontend** | Page/Component | 1 per major UC |
477
+ | **i18n** | Locales | 1 for all keys |
478
+ | **Tests** | Suite | 1 unit + 1 integration per layer |
479
+
480
+ ---
481
+
482
+ ## 6. Map Business Rules to Code
483
+
484
+ ### 6.1 BR Implementation Mapping
485
+
486
+ For each business rule, specify where it will be validated:
487
+
488
+ ```json
489
+ {
490
+ "businessRuleMappings": [
491
+ {
492
+ "ruleId": "BR-001",
493
+ "title": "Order number must be unique",
494
+ "implementationPoints": [
495
+ {
496
+ "layer": "Domain",
497
+ "component": "Order.cs",
498
+ "method": "Validate()",
499
+ "implementation": "Throw DomainException if duplicate"
500
+ },
501
+ {
502
+ "layer": "Infrastructure",
503
+ "component": "OrderRepository.cs",
504
+ "method": "Create()",
505
+ "implementation": "Check uniqueness before INSERT"
506
+ },
507
+ {
508
+ "layer": "API",
509
+ "component": "OrdersController.cs",
510
+ "method": "CreateOrder()",
511
+ "implementation": "Validate via service, return 409 Conflict if duplicate"
512
+ },
513
+ {
514
+ "layer": "Frontend",
515
+ "component": "CreateOrderForm.tsx",
516
+ "method": "validateOrderNumber()",
517
+ "implementation": "Real-time validation via API endpoint"
518
+ }
519
+ ]
520
+ },
521
+ {
522
+ "ruleId": "BR-002",
523
+ "title": "Only Manager can approve orders",
524
+ "implementationPoints": [
525
+ {
526
+ "layer": "API",
527
+ "component": "OrdersController.cs",
528
+ "method": "[Authorize(Roles = \"Manager\")]",
529
+ "implementation": "Attribute-based authorization"
530
+ },
531
+ {
532
+ "layer": "Application",
533
+ "component": "OrderService.cs",
534
+ "method": "ApproveOrder()",
535
+ "implementation": "Check user role, throw UnauthorizedAccessException if not Manager"
536
+ },
537
+ {
538
+ "layer": "Frontend",
539
+ "component": "OrderDetailPage.tsx",
540
+ "method": "canApprove()",
541
+ "implementation": "Hide/disable Approve button for non-managers"
542
+ }
543
+ ]
544
+ }
545
+ ]
546
+ }
547
+ ```
548
+
549
+ ### 6.2 Validation Rules Implementation
550
+
551
+ Map validations to code layers:
552
+
553
+ ```json
554
+ {
555
+ "validationMappings": [
556
+ {
557
+ "validation": "OrderNumber: required, unique, max 20 chars",
558
+ "domain": "Order.cs: Field attribute + Validate() method",
559
+ "database": "CREATE UNIQUE INDEX idx_Order_OrderNumber; CHECK length(OrderNumber) <= 20",
560
+ "service": "OrderService.cs: Pre-save validation",
561
+ "api": "OrdersController.cs: ModelState validation",
562
+ "frontend": "CreateOrderForm.tsx: Inline validation + API check"
563
+ }
564
+ ]
565
+ }
566
+ ```
567
+
568
+ ---
569
+
570
+ ## 7. Define API Endpoints
571
+
572
+ ### 7.1 RESTful Route Mapping
573
+
574
+ For each use case, define API endpoints:
575
+
576
+ ```json
577
+ {
578
+ "apiEndpoints": [
579
+ {
580
+ "useCase": "UC-001: List Orders",
581
+ "method": "GET",
582
+ "route": "/api/v1/orders",
583
+ "description": "Retrieve paginated list of orders with filtering and sorting",
584
+ "parameters": [
585
+ {
586
+ "name": "page",
587
+ "type": "int",
588
+ "default": 1,
589
+ "description": "Page number (1-indexed)"
590
+ },
591
+ {
592
+ "name": "pageSize",
593
+ "type": "int",
594
+ "default": 25,
595
+ "values": [10, 25, 50, 100]
596
+ },
597
+ {
598
+ "name": "status",
599
+ "type": "string",
600
+ "values": ["Draft", "Submitted", "Approved", "Shipped", "Delivered"],
601
+ "optional": true
602
+ },
603
+ {
604
+ "name": "sortBy",
605
+ "type": "string",
606
+ "values": ["orderNumber", "orderDate", "status"],
607
+ "default": "orderDate"
608
+ },
609
+ {
610
+ "name": "sortDir",
611
+ "type": "string",
612
+ "values": ["asc", "desc"],
613
+ "default": "desc"
614
+ }
615
+ ],
616
+ "response": {
617
+ "statusCode": 200,
618
+ "body": {
619
+ "data": [
620
+ {
621
+ "id": "int",
622
+ "orderNumber": "string",
623
+ "orderDate": "datetime",
624
+ "status": "string"
625
+ }
626
+ ],
627
+ "pagination": {
628
+ "page": "int",
629
+ "pageSize": "int",
630
+ "totalPages": "int",
631
+ "totalRecords": "int"
632
+ }
633
+ }
634
+ },
635
+ "linkedFRs": ["FR-001"],
636
+ "permissions": ["Read"]
637
+ },
638
+ {
639
+ "useCase": "UC-002: Create Order",
640
+ "method": "POST",
641
+ "route": "/api/v1/orders",
642
+ "description": "Create new order with validation",
643
+ "requestBody": {
644
+ "orderNumber": "string (required, unique)",
645
+ "orderDate": "datetime (required, not future)",
646
+ "customerId": "int (required, FK)",
647
+ "status": "string (default: Draft)"
648
+ },
649
+ "response": {
650
+ "statusCode": 201,
651
+ "body": {
652
+ "id": "int",
653
+ "orderNumber": "string",
654
+ "orderDate": "datetime",
655
+ "createdBy": "string",
656
+ "createdDate": "datetime"
657
+ }
658
+ },
659
+ "errors": [
660
+ {
661
+ "statusCode": 400,
662
+ "code": "VALIDATION_FAILED",
663
+ "message": "Validation failed: [field details]"
664
+ },
665
+ {
666
+ "statusCode": 409,
667
+ "code": "DUPLICATE_ORDER_NUMBER",
668
+ "message": "Order number already exists"
669
+ }
670
+ ],
671
+ "linkedFRs": ["FR-002", "FR-003"],
672
+ "permissions": ["Create"]
673
+ },
674
+ {
675
+ "useCase": "UC-003: View Order Detail",
676
+ "method": "GET",
677
+ "route": "/api/v1/orders/{id}",
678
+ "description": "Retrieve full order details including lines and history",
679
+ "parameters": [
680
+ {
681
+ "name": "id",
682
+ "type": "int",
683
+ "required": true,
684
+ "location": "path"
685
+ }
686
+ ],
687
+ "response": {
688
+ "statusCode": 200,
689
+ "body": {
690
+ "id": "int",
691
+ "orderNumber": "string",
692
+ "orderDate": "datetime",
693
+ "customerId": "int",
694
+ "status": "string",
695
+ "lines": [
696
+ {
697
+ "id": "int",
698
+ "productId": "int",
699
+ "quantity": "int",
700
+ "unitPrice": "decimal"
701
+ }
702
+ ]
703
+ }
704
+ },
705
+ "linkedFRs": ["FR-001"],
706
+ "permissions": ["Read"]
707
+ }
708
+ ]
709
+ }
710
+ ```
711
+
712
+ ### 7.2 Endpoint Summary Table
713
+
714
+ ```json
715
+ {
716
+ "endpointSummary": [
717
+ {
718
+ "operation": "List",
719
+ "method": "GET",
720
+ "route": "/api/v1/orders",
721
+ "linkedUC": "UC-001",
722
+ "permissions": "Read"
723
+ },
724
+ {
725
+ "operation": "Create",
726
+ "method": "POST",
727
+ "route": "/api/v1/orders",
728
+ "linkedUC": "UC-002",
729
+ "permissions": "Create"
730
+ },
731
+ {
732
+ "operation": "Read",
733
+ "method": "GET",
734
+ "route": "/api/v1/orders/{id}",
735
+ "linkedUC": "UC-003",
736
+ "permissions": "Read"
737
+ },
738
+ {
739
+ "operation": "Update",
740
+ "method": "PUT",
741
+ "route": "/api/v1/orders/{id}",
742
+ "linkedUC": "UC-004",
743
+ "permissions": "Update"
744
+ },
745
+ {
746
+ "operation": "Delete",
747
+ "method": "DELETE",
748
+ "route": "/api/v1/orders/{id}",
749
+ "linkedUC": "UC-005",
750
+ "permissions": "Delete"
751
+ },
752
+ {
753
+ "operation": "Approve",
754
+ "method": "POST",
755
+ "route": "/api/v1/orders/{id}/approve",
756
+ "linkedUC": "UC-006",
757
+ "permissions": "Approve"
758
+ }
759
+ ],
760
+ "totalEndpoints": 6
761
+ }
762
+ ```
763
+
764
+ ---
765
+
766
+ ## 8. Test Requirements
767
+
768
+ ### 8.1 Unit Test Coverage
769
+
770
+ For each service/component, define test cases:
771
+
772
+ ```json
773
+ {
774
+ "unitTests": [
775
+ {
776
+ "testClass": "OrderServiceTests",
777
+ "testCases": [
778
+ {
779
+ "testName": "CreateOrder_WithValidData_ReturnsSuccess",
780
+ "linkedFR": "FR-002",
781
+ "givenState": "Valid order data",
782
+ "when": "CreateOrder() called",
783
+ "then": "Returns new order with ID"
784
+ },
785
+ {
786
+ "testName": "CreateOrder_WithDuplicateOrderNumber_ThrowsException",
787
+ "linkedBR": "BR-001",
788
+ "givenState": "Order with number ORD-001 exists",
789
+ "when": "CreateOrder(ORD-001) called",
790
+ "then": "Throws DuplicateOrderNumberException"
791
+ },
792
+ {
793
+ "testName": "ApproveOrder_ByNonManager_ThrowsUnauthorized",
794
+ "linkedBR": "BR-002",
795
+ "givenState": "Order exists, user is User role",
796
+ "when": "ApproveOrder() called",
797
+ "then": "Throws UnauthorizedAccessException"
798
+ }
799
+ ],
800
+ "coverage": "95%"
801
+ }
802
+ ]
803
+ }
804
+ ```
805
+
806
+ ### 8.2 Integration Test Coverage
807
+
808
+ For APIs, define integration tests:
809
+
810
+ ```json
811
+ {
812
+ "integrationTests": [
813
+ {
814
+ "testClass": "OrdersControllerTests",
815
+ "testCases": [
816
+ {
817
+ "testName": "GetOrders_WithoutAuth_Returns401",
818
+ "when": "GET /api/v1/orders without token",
819
+ "then": "Returns 401 Unauthorized"
820
+ },
821
+ {
822
+ "testName": "CreateOrder_WithInvalidData_Returns400",
823
+ "when": "POST /api/v1/orders with missing orderNumber",
824
+ "then": "Returns 400 BadRequest with validation errors"
825
+ },
826
+ {
827
+ "testName": "CreateOrder_ByAuthorizedUser_Returns201",
828
+ "linkedUC": "UC-002",
829
+ "when": "POST /api/v1/orders with valid data by authorized user",
830
+ "then": "Returns 201 Created with order details"
831
+ }
832
+ ]
833
+ }
834
+ ]
835
+ }
836
+ ```
837
+
838
+ ### 8.3 E2E Test Coverage
839
+
840
+ For critical user journeys:
841
+
842
+ ```json
843
+ {
844
+ "e2eTests": [
845
+ {
846
+ "journey": "Create and Approve Order",
847
+ "scenario": "User creates order, manager approves it",
848
+ "steps": [
849
+ "1. Navigate to /orders",
850
+ "2. Click 'Create New Order'",
851
+ "3. Fill form and submit",
852
+ "4. Verify order created with Draft status",
853
+ "5. Login as manager",
854
+ "6. Navigate to order detail",
855
+ "7. Click 'Approve'",
856
+ "8. Verify status changed to Approved"
857
+ ],
858
+ "linkedUCs": ["UC-002", "UC-006"]
859
+ }
860
+ ]
861
+ }
862
+ ```
863
+
864
+ ---
865
+
866
+ ## 9. Plan i18n Keys
867
+
868
+ ### 9.1 i18n Key Mapping
869
+
870
+ For all user-facing strings, define translation keys:
871
+
872
+ ```json
873
+ {
874
+ "i18nKeys": [
875
+ {
876
+ "key": "orders.menu.label",
877
+ "defaultText": "Orders",
878
+ "context": "Menu item"
879
+ },
880
+ {
881
+ "key": "orders.list.title",
882
+ "defaultText": "Order Management",
883
+ "context": "Page title"
884
+ },
885
+ {
886
+ "key": "orders.list.createButton",
887
+ "defaultText": "Create New Order",
888
+ "context": "Button label"
889
+ },
890
+ {
891
+ "key": "orders.list.columns.orderNumber",
892
+ "defaultText": "Order Number",
893
+ "context": "Table column header"
894
+ },
895
+ {
896
+ "key": "orders.list.columns.orderDate",
897
+ "defaultText": "Order Date",
898
+ "context": "Table column header"
899
+ },
900
+ {
901
+ "key": "orders.list.columns.status",
902
+ "defaultText": "Status",
903
+ "context": "Table column header"
904
+ },
905
+ {
906
+ "key": "orders.form.labels.orderNumber",
907
+ "defaultText": "Order Number",
908
+ "context": "Form field label"
909
+ },
910
+ {
911
+ "key": "orders.form.labels.orderDate",
912
+ "defaultText": "Order Date",
913
+ "context": "Form field label"
914
+ },
915
+ {
916
+ "key": "orders.form.validations.orderNumberRequired",
917
+ "defaultText": "Order number is required",
918
+ "context": "Validation message"
919
+ },
920
+ {
921
+ "key": "orders.form.validations.orderNumberFormat",
922
+ "defaultText": "Format must be ORD-XXXXXX",
923
+ "context": "Validation message"
924
+ },
925
+ {
926
+ "key": "orders.messages.createdSuccess",
927
+ "defaultText": "Order {orderNumber} created successfully",
928
+ "context": "Success message",
929
+ "variables": ["orderNumber"]
930
+ },
931
+ {
932
+ "key": "orders.messages.approvedSuccess",
933
+ "defaultText": "Order approved",
934
+ "context": "Success message"
935
+ },
936
+ {
937
+ "key": "orders.messages.notFound",
938
+ "defaultText": "Order not found",
939
+ "context": "Error message"
940
+ },
941
+ {
942
+ "key": "orders.enums.status.draft",
943
+ "defaultText": "Draft",
944
+ "context": "Enum value"
945
+ },
946
+ {
947
+ "key": "orders.enums.status.submitted",
948
+ "defaultText": "Submitted for Review",
949
+ "context": "Enum value"
950
+ },
951
+ {
952
+ "key": "orders.enums.status.approved",
953
+ "defaultText": "Approved",
954
+ "context": "Enum value"
955
+ }
956
+ ],
957
+ "totalKeys": 16,
958
+ "locales": ["en", "fr", "es", "de"]
959
+ }
960
+ ```
961
+
962
+ ### 9.2 i18n File Structure
963
+
964
+ ```
965
+ src/locales/
966
+ ├── en/
967
+ │ ├── common.json
968
+ │ ├── orders.json ← Order module strings
969
+ │ └── ...
970
+ ├── fr/
971
+ │ ├── common.json
972
+ │ ├── orders.json
973
+ │ └── ...
974
+ └── es/
975
+ ├── common.json
976
+ └── orders.json
977
+ ```
978
+
979
+ ---
980
+
981
+ ## 10. Ralph Loop prd.json Generation
982
+
983
+ ### 10.1 PRD Document Structure
984
+
985
+ Generate comprehensive product requirements document:
986
+
987
+ ```json
988
+ {
989
+ "prd": {
990
+ "version": "2.0.0",
991
+ "source": {
992
+ "type": "ba-handoff",
993
+ "feature_json": "docs/feature.json"
994
+ },
995
+ "metadata": {
996
+ "title": "[Module Name] - Product Requirements Document",
997
+ "description": "[Module scope description]",
998
+ "createdAt": "2025-02-01T11:00:00Z",
999
+ "createdBy": "business-analyse skill v3.0",
1000
+ "status": "handed-off",
1001
+ "lastModified": "2025-02-01T11:00:00Z"
1002
+ },
1003
+ "project": {
1004
+ "name": "[Project Name]",
1005
+ "module": "[Module Name]",
1006
+ "version": "1.0.0"
1007
+ },
1008
+ "overview": {
1009
+ "summary": "[Executive summary from scope]",
1010
+ "businessGoals": "[From scope.businessObjectives]",
1011
+ "stakeholders": "[From discovery.stakeholders]",
1012
+ "successCriteria": "[From scope.successCriteria]"
1013
+ },
1014
+ "requirements": {
1015
+ "functional": {
1016
+ "useCases": "[From specification.useCases]",
1017
+ "requirements": "[From specification.functionalRequirements]",
1018
+ "scenarios": "[From specification.gherkinScenarios]"
1019
+ },
1020
+ "nonfunctional": {
1021
+ "performance": "[From specification.validations if applicable]",
1022
+ "security": "[From specification.auditingPolicy]",
1023
+ "scalability": "[Derived from business rules]"
1024
+ }
1025
+ },
1026
+ "architecture": {
1027
+ "entities": "[From specification.entities]",
1028
+ "dataModel": "[From specification.entities relationships]",
1029
+ "apiEndpoints": "[From handoff.apiEndpoints]",
1030
+ "permissions": "[From specification.permissionMatrix]"
1031
+ },
1032
+ "implementation": {
1033
+ "taskBreakdown": "[From handoff.implementationSequence]",
1034
+ "fileMapping": "[From handoff.fileMapping]",
1035
+ "dependencies": "[From specification.crossModuleDependencies]",
1036
+ "seedData": "[From specification.navigationHierarchy.seedDataRequired]"
1037
+ },
1038
+ "testing": {
1039
+ "unitTests": "[From handoff.unitTests]",
1040
+ "integrationTests": "[From handoff.integrationTests]",
1041
+ "e2eTests": "[From handoff.e2eTests]",
1042
+ "testCoverage": 80
1043
+ },
1044
+ "i18n": {
1045
+ "keys": "[From handoff.i18nKeys]",
1046
+ "locales": ["en", "fr", "es", "de"]
1047
+ }
1048
+ }
1049
+ }
1050
+ ```
1051
+
1052
+ ### 10.2 Ralph Loop Task Decomposition
1053
+
1054
+ Critical section: Layer-by-layer task breakdown:
1055
+
1056
+ ```json
1057
+ {
1058
+ "tasks": {
1059
+ "decompositionRules": {
1060
+ "granularity": "2-3 hour tasks (developer focus)",
1061
+ "layerOrder": ["Domain", "SeedData", "Application", "Infrastructure", "API", "Frontend", "i18n", "Tests", "Validation"],
1062
+ "dependencies": "Domain → SeedData → Application → Infrastructure → API & Frontend → i18n → Tests",
1063
+ "parallelization": "Infrastructure & Frontend can run in parallel after API definition"
1064
+ },
1065
+ "layers": [
1066
+ {
1067
+ "layerId": "DOMAIN",
1068
+ "name": "Domain Layer",
1069
+ "description": "Entity definitions, enums, validation rules",
1070
+ "tasks": [
1071
+ {
1072
+ "id": "TASK-DOMAIN-001",
1073
+ "title": "Define Order entity with validation",
1074
+ "description": "[From specification.entities[Order]]",
1075
+ "effort": "2h",
1076
+ "dependencies": [],
1077
+ "linkedFRs": ["FR-001"],
1078
+ "linkedBRs": ["BR-001", "BR-003"],
1079
+ "acceptance": "Order.cs created with all fields, required validation, state machine"
1080
+ }
1081
+ ]
1082
+ },
1083
+ {
1084
+ "layerId": "SEEDDATA",
1085
+ "name": "SeedData Layer",
1086
+ "description": "Lookup tables and reference data",
1087
+ "tasks": [
1088
+ {
1089
+ "id": "TASK-SEED-001",
1090
+ "title": "Create Order_Status SeedData migration",
1091
+ "description": "[From specification.navigationHierarchy.seedDataRequired[0]]",
1092
+ "effort": "1h",
1093
+ "dependencies": ["TASK-DOMAIN-001"],
1094
+ "linkedFRs": [],
1095
+ "acceptance": "Migration creates Order_Status table with 5 status values seeded"
1096
+ }
1097
+ ]
1098
+ },
1099
+ {
1100
+ "layerId": "APPLICATION",
1101
+ "name": "Application Layer",
1102
+ "description": "Business logic, services, use case orchestration",
1103
+ "tasks": [
1104
+ {
1105
+ "id": "TASK-APP-001",
1106
+ "title": "Implement OrderService (CRUD + Approve)",
1107
+ "description": "[From specification.functionalRequirements FR-001 to FR-004]",
1108
+ "effort": "4h",
1109
+ "dependencies": ["TASK-DOMAIN-001", "TASK-SEED-001"],
1110
+ "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"],
1111
+ "linkedUCs": ["UC-001", "UC-002", "UC-003", "UC-004"],
1112
+ "acceptance": "OrderService has methods: GetAll, GetById, Create, Update, Approve with business rule validation"
1113
+ }
1114
+ ]
1115
+ },
1116
+ {
1117
+ "layerId": "INFRASTRUCTURE",
1118
+ "name": "Infrastructure Layer",
1119
+ "description": "Data access, repositories, database operations",
1120
+ "tasks": [
1121
+ {
1122
+ "id": "TASK-INFRA-001",
1123
+ "title": "Create OrderRepository with filtering & sorting",
1124
+ "description": "[From apiEndpoints.parameters: page, pageSize, status, sortBy]",
1125
+ "effort": "2h",
1126
+ "dependencies": ["TASK-DOMAIN-001"],
1127
+ "linkedFRs": ["FR-001"],
1128
+ "acceptance": "OrderRepository has GetAll(filter, sort, pagination) method"
1129
+ }
1130
+ ]
1131
+ },
1132
+ {
1133
+ "layerId": "API",
1134
+ "name": "API Layer",
1135
+ "description": "REST endpoints, request/response handling",
1136
+ "tasks": [
1137
+ {
1138
+ "id": "TASK-API-001",
1139
+ "title": "Create OrdersController with 6 endpoints",
1140
+ "description": "[From apiEndpoints: GET /orders, POST /orders, GET /orders/{id}, PUT /orders/{id}, DELETE /orders/{id}, POST /orders/{id}/approve]",
1141
+ "effort": "3h",
1142
+ "dependencies": ["TASK-APP-001"],
1143
+ "linkedUCs": ["UC-001", "UC-002", "UC-003", "UC-004", "UC-005", "UC-006"],
1144
+ "acceptance": "Controller has all 6 endpoints with proper HTTP methods, status codes, error handling"
1145
+ }
1146
+ ]
1147
+ },
1148
+ {
1149
+ "layerId": "FRONTEND",
1150
+ "name": "Frontend Layer",
1151
+ "description": "UI pages, components, state management",
1152
+ "tasks": [
1153
+ {
1154
+ "id": "TASK-FE-001",
1155
+ "title": "Create OrderListPage with table and filters",
1156
+ "description": "[From wireframe WF-001]",
1157
+ "effort": "3h",
1158
+ "dependencies": ["TASK-API-001"],
1159
+ "linkedUCs": ["UC-001"],
1160
+ "linkedFRs": ["FR-001"],
1161
+ "acceptance": "Page displays paginated order list, supports filtering by status, sorting, search"
1162
+ },
1163
+ {
1164
+ "id": "TASK-FE-002",
1165
+ "title": "Create CreateOrderForm with validation",
1166
+ "description": "[From wireframe WF-002, specification.validations]",
1167
+ "effort": "3h",
1168
+ "dependencies": ["TASK-API-001"],
1169
+ "linkedUCs": ["UC-002"],
1170
+ "linkedFRs": ["FR-002", "FR-003"],
1171
+ "acceptance": "Form validates all fields inline, shows error messages, prevents submission if invalid"
1172
+ }
1173
+ ]
1174
+ },
1175
+ {
1176
+ "layerId": "I18N",
1177
+ "name": "i18n Layer",
1178
+ "description": "Translation keys and localization",
1179
+ "tasks": [
1180
+ {
1181
+ "id": "TASK-I18N-001",
1182
+ "title": "Add Order module translation keys",
1183
+ "description": "[From i18nKeys list]",
1184
+ "effort": "1h",
1185
+ "dependencies": ["TASK-FE-001", "TASK-FE-002"],
1186
+ "linkedFRs": [],
1187
+ "acceptance": "16 i18n keys added to en/orders.json, ready for translation"
1188
+ }
1189
+ ]
1190
+ },
1191
+ {
1192
+ "layerId": "TESTS",
1193
+ "name": "Tests & Validation Layer",
1194
+ "description": "Unit, integration, and E2E tests",
1195
+ "tasks": [
1196
+ {
1197
+ "id": "TASK-TEST-001",
1198
+ "title": "Unit tests for OrderService",
1199
+ "description": "[From unitTests: 12 test cases]",
1200
+ "effort": "2h",
1201
+ "dependencies": ["TASK-APP-001"],
1202
+ "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"],
1203
+ "acceptance": "12 unit tests covering CRUD, validation, authorization"
1204
+ },
1205
+ {
1206
+ "id": "TASK-TEST-002",
1207
+ "title": "Integration tests for OrdersController",
1208
+ "description": "[From integrationTests: 8 test cases]",
1209
+ "effort": "2h",
1210
+ "dependencies": ["TASK-API-001"],
1211
+ "linkedUCs": ["UC-001", "UC-002", "UC-003"],
1212
+ "acceptance": "8 integration tests covering all endpoints, auth, error handling"
1213
+ },
1214
+ {
1215
+ "id": "TASK-TEST-003",
1216
+ "title": "E2E test for Order creation and approval flow",
1217
+ "description": "[From e2eTests: Create and Approve Order journey]",
1218
+ "effort": "2h",
1219
+ "dependencies": ["TASK-FE-002"],
1220
+ "linkedUCs": ["UC-002", "UC-006"],
1221
+ "acceptance": "E2E test covers complete user journey from create to approve"
1222
+ }
1223
+ ]
1224
+ },
1225
+ {
1226
+ "layerId": "VALIDATION",
1227
+ "name": "Validation & QA Layer",
1228
+ "description": "Final validation against requirements",
1229
+ "tasks": [
1230
+ {
1231
+ "id": "TASK-VALIDATION-001",
1232
+ "title": "Verify all FRs implemented and tested",
1233
+ "description": "[Cross-reference FR vs implementation]",
1234
+ "effort": "1h",
1235
+ "dependencies": ["TASK-TEST-003"],
1236
+ "linkedFRs": ["FR-001", "FR-002", "FR-003", "FR-004"],
1237
+ "acceptance": "All FRs have corresponding code and tests"
1238
+ },
1239
+ {
1240
+ "id": "TASK-VALIDATION-002",
1241
+ "title": "Verify all BRs validated in code",
1242
+ "description": "[Cross-reference BR vs validation points]",
1243
+ "effort": "1h",
1244
+ "dependencies": ["TASK-TEST-003"],
1245
+ "linkedBRs": ["BR-001", "BR-002", "BR-003"],
1246
+ "acceptance": "All BRs have corresponding validation in at least one layer"
1247
+ }
1248
+ ]
1249
+ }
1250
+ ],
1251
+ "totalTasks": 15,
1252
+ "totalEffort": "28h",
1253
+ "estimatedDuration": "1 week (4 developers in parallel)"
1254
+ }
1255
+ }
1256
+ ```
1257
+
1258
+ ### 10.3 prd.json v2.0.0 Schema Validation
1259
+
1260
+ Ensure prd.json follows SmartStack schema:
1261
+
1262
+ ```json
1263
+ {
1264
+ "validation": {
1265
+ "schema": "prd.json v2.0.0",
1266
+ "checks": [
1267
+ {
1268
+ "field": "version",
1269
+ "required": true,
1270
+ "value": "2.0.0",
1271
+ "status": "PASS" ✓
1272
+ },
1273
+ {
1274
+ "field": "source",
1275
+ "required": true,
1276
+ "value": {
1277
+ "type": "ba-handoff",
1278
+ "feature_json": "docs/feature.json"
1279
+ },
1280
+ "status": "PASS" ✓
1281
+ },
1282
+ {
1283
+ "field": "tasks",
1284
+ "required": true,
1285
+ "taskCount": 15,
1286
+ "layerCount": 9,
1287
+ "status": "PASS" ✓
1288
+ }
1289
+ ]
1290
+ }
1291
+ }
1292
+ ```
1293
+
1294
+ ---
1295
+
1296
+ ## 11. Initialize Progress Tracker
1297
+
1298
+ ### 11.1 Create .ralph/progress.txt
1299
+
1300
+ Initialize progress tracking file:
1301
+
1302
+ ```
1303
+ ═════════════════════════════════════════════════════════════════
1304
+ SMARTSTACK RALPH LOOP - PROGRESS TRACKER
1305
+ Project: [Project Name] | Module: [Module Name]
1306
+ Created: 2025-02-01T11:00:00Z
1307
+ Status: HANDED-OFF
1308
+ ═════════════════════════════════════════════════════════════════
1309
+
1310
+ LAYER BREAKDOWN (28h total effort):
1311
+
1312
+ [DOMAIN] Domain Layer (2h)
1313
+ □ TASK-DOMAIN-001: Define Order entity (2h)
1314
+ Status: pending
1315
+ Assigned: [TBD]
1316
+ Started: [TBD]
1317
+ Completed: [TBD]
1318
+ Progress: 0%
1319
+
1320
+ [SEEDDATA] SeedData Layer (1h)
1321
+ □ TASK-SEED-001: Create Order_Status migration (1h)
1322
+ Status: pending
1323
+ Assigned: [TBD]
1324
+ Started: [TBD]
1325
+ Completed: [TBD]
1326
+ Progress: 0%
1327
+
1328
+ [APPLICATION] Application Layer (4h)
1329
+ □ TASK-APP-001: Implement OrderService (4h)
1330
+ Status: pending
1331
+ Assigned: [TBD]
1332
+ Started: [TBD]
1333
+ Completed: [TBD]
1334
+ Progress: 0%
1335
+ Subtasks:
1336
+ - GetAll() method
1337
+ - GetById() method
1338
+ - Create() method with validation
1339
+ - Update() method
1340
+ - Approve() method with authorization
1341
+
1342
+ [INFRASTRUCTURE] Infrastructure Layer (2h)
1343
+ □ TASK-INFRA-001: Create OrderRepository (2h)
1344
+ Status: pending
1345
+ Assigned: [TBD]
1346
+ Started: [TBD]
1347
+ Completed: [TBD]
1348
+ Progress: 0%
1349
+
1350
+ [API] API Layer (3h)
1351
+ □ TASK-API-001: Create OrdersController (3h)
1352
+ Status: pending
1353
+ Assigned: [TBD]
1354
+ Started: [TBD]
1355
+ Completed: [TBD]
1356
+ Progress: 0%
1357
+ Endpoints:
1358
+ - GET /api/v1/orders (List)
1359
+ - POST /api/v1/orders (Create)
1360
+ - GET /api/v1/orders/{id} (Detail)
1361
+ - PUT /api/v1/orders/{id} (Update)
1362
+ - DELETE /api/v1/orders/{id} (Delete)
1363
+ - POST /api/v1/orders/{id}/approve (Approve)
1364
+
1365
+ [FRONTEND] Frontend Layer (6h)
1366
+ □ TASK-FE-001: Create OrderListPage (3h)
1367
+ Status: pending
1368
+ Assigned: [TBD]
1369
+ Progress: 0%
1370
+ □ TASK-FE-002: Create CreateOrderForm (3h)
1371
+ Status: pending
1372
+ Assigned: [TBD]
1373
+ Progress: 0%
1374
+
1375
+ [I18N] i18n Layer (1h)
1376
+ □ TASK-I18N-001: Add translation keys (1h)
1377
+ Status: pending
1378
+ Progress: 0%
1379
+ Keys: 16 total
1380
+ □ Menu labels (1)
1381
+ □ Page titles (1)
1382
+ □ Column headers (3)
1383
+ □ Form labels (2)
1384
+ □ Validation messages (4)
1385
+ □ Success messages (2)
1386
+ □ Error messages (2)
1387
+ □ Enum values (3)
1388
+
1389
+ [TESTS] Tests & Validation Layer (6h)
1390
+ □ TASK-TEST-001: Unit tests for OrderService (2h)
1391
+ Status: pending
1392
+ Progress: 0%
1393
+ Cases: 12 unit tests
1394
+ □ TASK-TEST-002: Integration tests for OrdersController (2h)
1395
+ Status: pending
1396
+ Progress: 0%
1397
+ Cases: 8 integration tests
1398
+ □ TASK-TEST-003: E2E test for Order flow (2h)
1399
+ Status: pending
1400
+ Progress: 0%
1401
+ Cases: 1 E2E scenario
1402
+
1403
+ [VALIDATION] Validation & QA Layer (2h)
1404
+ □ TASK-VALIDATION-001: Verify FRs implemented (1h)
1405
+ Status: pending
1406
+ Progress: 0%
1407
+ □ TASK-VALIDATION-002: Verify BRs validated (1h)
1408
+ Status: pending
1409
+ Progress: 0%
1410
+
1411
+ ═════════════════════════════════════════════════════════════════
1412
+ SUMMARY
1413
+ ═════════════════════════════════════════════════════════════════
1414
+ Total Tasks: 15
1415
+ Total Effort: 28 hours
1416
+ Completed: 0 (0%)
1417
+ In Progress: 0 (0%)
1418
+ Pending: 15 (100%)
1419
+ Blocked: 0 (0%)
1420
+
1421
+ Dependencies:
1422
+ Domain → SeedData → Application → Infrastructure
1423
+ ↘ ↙
1424
+ ↓ ↓
1425
+ API ←─────────── Frontend
1426
+ ↓ ↓
1427
+ i18n & Tests ← ─────┘
1428
+
1429
+ Validation
1430
+
1431
+ Critical Path: Domain → SeedData → App → Infra → API → Tests (18h)
1432
+ Parallel Path: Frontend (6h) can start after API definition
1433
+
1434
+ ═════════════════════════════════════════════════════════════════
1435
+ NOTES
1436
+ ═════════════════════════════════════════════════════════════════
1437
+ - Start Domain tasks immediately (critical path dependency)
1438
+ - Frontend & Infrastructure can run in parallel after API is stubbed
1439
+ - Tests should not begin until implementation 80% complete
1440
+ - Update this file daily during development
1441
+ - Colors: 🟢 Done | 🟡 In Progress | 🔴 Pending | ⚫ Blocked
1442
+
1443
+ ═════════════════════════════════════════════════════════════════
1444
+ ```
1445
+
1446
+ ### 11.2 Progress Tracking Integration
1447
+
1448
+ Link progress.txt to feature.json:
1449
+
1450
+ ```json
1451
+ {
1452
+ "handoff": {
1453
+ "progressFile": ".ralph/progress.txt",
1454
+ "progressTracking": {
1455
+ "enabled": true,
1456
+ "updateFrequency": "daily",
1457
+ "statusOptions": ["pending", "in_progress", "completed", "blocked"],
1458
+ "links": {
1459
+ "feature_json": "docs/feature.json",
1460
+ "prd_json": ".ralph/prd.json",
1461
+ "progress_txt": ".ralph/progress.txt"
1462
+ }
1463
+ }
1464
+ }
1465
+ }
1466
+ ```
1467
+
1468
+ ---
1469
+
1470
+ ## 12. User Choice: Next Agent
1471
+
1472
+ ### 12.1 Present Options
1473
+
1474
+ After generating prd.json, offer user choices:
1475
+
1476
+ ```
1477
+ Handoff package ready!
1478
+
1479
+ Generated:
1480
+ ✓ feature.json.handoff section
1481
+ ✓ .ralph/prd.json (product requirements)
1482
+ ✓ .ralph/progress.txt (task tracker)
1483
+
1484
+ Next step: Choose your development approach
1485
+
1486
+ Options:
1487
+ 1. [Feature Full] Fast scaffolding + test generation
1488
+ Duration: 15-30 min | Coverage: 70-80%
1489
+ ✓ Fast iteration | ✓ Tests included
1490
+ ✗ May need manual polish
1491
+
1492
+ 2. [Ralph Loop] Task-driven development
1493
+ Duration: 1-2 hours | Coverage: 95-100%
1494
+ ✓ Comprehensive | ✓ Detailed implementation
1495
+ ✗ Slower, more verbose
1496
+
1497
+ 3. [Feature Full] Parallel multi-layer generation
1498
+ Duration: 30-45 min | Coverage: 80-90%
1499
+ ✓ Balanced | ✓ All layers in parallel
1500
+ ✗ Complex orchestration
1501
+
1502
+ 4. [End BA] Finish business analysis, manual development
1503
+ Duration: 0 min | Coverage: Depends on developers
1504
+ ✓ Gives team freedom | ✓ Lighter handoff
1505
+ ✗ No code generation
1506
+
1507
+ Recommended: Option 1 (Feature Full) for fast MVP, then Option 2 (Ralph Loop) for polish.
1508
+
1509
+ Select option: [ ]
1510
+ ```
1511
+
1512
+ ### 12.2 Remove Old Documentation Option
1513
+
1514
+ Remove step-06 from final choice:
1515
+ - ~~[Generate HTML documentation]~~ - NOT AVAILABLE in v3.0
1516
+ - Keep: Ralph Loop, Feature Full, End BA
1517
+
1518
+ ---
1519
+
1520
+ ## 13. Execution Workflow
1521
+
1522
+ ### 13.1 Handoff Sequence
1523
+
1524
+ 1. **Verify validation passed** (status: "approved")
1525
+ 2. **Explore existing patterns** (check for code generators)
1526
+ 3. **Map to files** (document implementation locations)
1527
+ 4. **Generate implementation instructions** (task breakdown)
1528
+ 5. **Map BRs to code** (validation points)
1529
+ 6. **Define API endpoints** (RESTful routes)
1530
+ 7. **Plan tests** (coverage strategy)
1531
+ 8. **Plan i18n** (translation keys)
1532
+ 9. **Generate prd.json** (comprehensive requirements)
1533
+ 10. **Initialize progress.txt** (task tracker)
1534
+ 11. **Present user choices** (next agent selection)
1535
+
1536
+ ### 13.2 Output Summary
1537
+
1538
+ Display final summary:
1539
+
1540
+ ```
1541
+ ═══════════════════════════════════════════════════════════════
1542
+ ✓ HANDOFF COMPLETE
1543
+ ═══════════════════════════════════════════════════════════════
1544
+
1545
+ Module: Orders
1546
+ Status: handed-off
1547
+ Specification: 11 sections complete
1548
+ Validation: approved
1549
+ Implementation: Ready to code
1550
+
1551
+ Generated Files:
1552
+ ✓ docs/feature.json (specification + validation + handoff)
1553
+ ✓ .ralph/prd.json (v2.0.0 with 15 tasks)
1554
+ ✓ .ralph/progress.txt (progress tracker)
1555
+
1556
+ Statistics:
1557
+ - Use cases: 6 (UC-001 → UC-006)
1558
+ - Requirements: 12 FRs
1559
+ - Business rules: 5 BRs (mapped to code)
1560
+ - API endpoints: 6 REST routes
1561
+ - Components: 8 frontend components
1562
+ - Tests: 20 test cases (unit + integration + E2E)
1563
+ - i18n keys: 16 translation keys
1564
+ - Implementation: 15 tasks across 9 layers
1565
+ - Total effort: 28 hours
1566
+
1567
+ Dependencies:
1568
+ ✓ Domain → SeedData → Application → Infrastructure → API → Frontend
1569
+ ✓ Tests & i18n run in parallel
1570
+ ✓ Validation confirms all FRs/BRs covered
1571
+
1572
+ Next Step: Choose development approach (Feature Full / Ralph Loop / Manual)
1573
+
1574
+ ═══════════════════════════════════════════════════════════════
1575
+ ```
1576
+
1577
+ ---
1578
+
1579
+ ## OUTPUT
1580
+
1581
+ This step enriches **feature.json** with:
1582
+ - **handoff** section containing file mappings, implementation instructions, BR mappings, API endpoints, test plans, and i18n keys
1583
+ - **Status:** "handed-off"
1584
+
1585
+ Also generates:
1586
+ - **.ralph/prd.json** - Comprehensive product requirements (v2.0.0 schema)
1587
+ - **.ralph/progress.txt** - Task progress tracker with 15 implementation tasks
1588
+
1589
+ **Standard mode:** Full handoff with all implementation details.
1590
+ **Micro mode:** Simplified handoff with minimal tasks, auto-suggest Feature Full.
1591
+ **Delta mode:** Handoff for affected features only, reuse existing patterns.
1592
+
1593
+ Next agent selection: Feature Full, Ralph Loop, or End BA.