@atlashub/smartstack-cli 4.18.0 → 4.19.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 (160) hide show
  1. package/package.json +1 -1
  2. package/templates/agents/ba-reader.md +86 -80
  3. package/templates/agents/ba-writer.md +318 -415
  4. package/templates/agents/docs-context-reader.md +3 -3
  5. package/templates/mcp-scaffolding/frontend/nav-routes.ts.hbs +133 -0
  6. package/templates/mcp-scaffolding/frontend/routes.tsx.hbs +126 -0
  7. package/templates/skills/apex/SKILL.md +29 -16
  8. package/templates/skills/apex/_shared.md +62 -9
  9. package/templates/skills/apex/references/analysis-methods.md +8 -6
  10. package/templates/skills/apex/references/challenge-questions.md +5 -5
  11. package/templates/skills/apex/references/core-seed-data.md +68 -45
  12. package/templates/skills/apex/references/frontend-route-wiring-app-tsx.md +26 -21
  13. package/templates/skills/apex/references/parallel-execution.md +156 -0
  14. package/templates/skills/apex/references/person-extension-pattern.md +12 -12
  15. package/templates/skills/apex/references/post-checks.md +1748 -1726
  16. package/templates/skills/apex/references/smartstack-api.md +63 -57
  17. package/templates/skills/apex/references/smartstack-frontend-compliance.md +594 -0
  18. package/templates/skills/apex/references/smartstack-frontend.md +1246 -1842
  19. package/templates/skills/apex/references/smartstack-layers.md +98 -145
  20. package/templates/skills/apex/steps/step-00-init.md +30 -6
  21. package/templates/skills/apex/steps/step-01-analyze.md +27 -23
  22. package/templates/skills/apex/steps/step-02-plan.md +12 -12
  23. package/templates/skills/apex/steps/step-03-execute.md +198 -143
  24. package/templates/skills/apex/steps/step-04-examine.md +24 -93
  25. package/templates/skills/apex/steps/step-05-deep-review.md +16 -16
  26. package/templates/skills/apex/steps/step-06-resolve.md +9 -9
  27. package/templates/skills/apex/steps/step-07-tests.md +3 -1
  28. package/templates/skills/apex/steps/step-08-run-tests.md +1 -1
  29. package/templates/skills/business-analyse/SKILL.md +182 -301
  30. package/templates/skills/business-analyse/_shared.md +119 -336
  31. package/templates/skills/business-analyse/html/ba-interactive.html +703 -82
  32. package/templates/skills/business-analyse/html/build-html.js +41 -3
  33. package/templates/skills/business-analyse/html/src/partials/cadrage-context.html +34 -0
  34. package/templates/skills/business-analyse/html/src/partials/cadrage-risks.html +48 -0
  35. package/templates/skills/business-analyse/html/src/partials/cadrage-scope.html +49 -0
  36. package/templates/skills/business-analyse/html/src/partials/cadrage-stakeholders.html +55 -0
  37. package/templates/skills/business-analyse/html/src/partials/cadrage-success.html +34 -0
  38. package/templates/skills/business-analyse/html/src/partials/consol-datamodel.html +8 -0
  39. package/templates/skills/business-analyse/html/src/partials/consol-flows.html +29 -0
  40. package/templates/skills/business-analyse/html/src/partials/consol-interactions.html +8 -0
  41. package/templates/skills/business-analyse/html/src/partials/consol-permissions.html +8 -0
  42. package/templates/skills/business-analyse/html/src/partials/decomp-dependencies.html +38 -0
  43. package/templates/skills/business-analyse/html/src/partials/decomp-modules.html +51 -0
  44. package/templates/skills/business-analyse/html/src/partials/handoff-summary.html +24 -0
  45. package/templates/skills/business-analyse/html/src/partials/module-spec-container.html +4 -0
  46. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +17 -1
  47. package/templates/skills/business-analyse/html/src/scripts/02-navigation.js +31 -5
  48. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +100 -63
  49. package/templates/skills/business-analyse/html/src/scripts/06-render-mockups.js +372 -0
  50. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +41 -13
  51. package/templates/skills/business-analyse/html/src/styles/09-mockups-html.css +136 -0
  52. package/templates/skills/business-analyse/patterns/suggestion-catalog.md +7 -5
  53. package/templates/skills/business-analyse/questionnaire/02-stakeholders-scope.md +142 -0
  54. package/templates/skills/business-analyse/questionnaire/03-data-ui.md +94 -0
  55. package/templates/skills/business-analyse/questionnaire/04-risks-metrics.md +150 -0
  56. package/templates/skills/business-analyse/questionnaire/05-cross-module.md +69 -0
  57. package/templates/skills/business-analyse/questionnaire.md +23 -280
  58. package/templates/skills/business-analyse/react/application-viewer.md +2 -2
  59. package/templates/skills/business-analyse/react/components.md +4 -4
  60. package/templates/skills/business-analyse/react/i18n-template.md +1 -1
  61. package/templates/skills/business-analyse/react/schema.md +14 -14
  62. package/templates/skills/business-analyse/references/acceptance-criteria.md +21 -21
  63. package/templates/skills/business-analyse/references/analysis-semantic-checks.md +3 -3
  64. package/templates/skills/business-analyse/references/compilation-structure-cards.md +1 -1
  65. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +5 -5
  66. package/templates/skills/business-analyse/references/deploy-data-build.md +12 -11
  67. package/templates/skills/business-analyse/references/deploy-modes.md +10 -10
  68. package/templates/skills/business-analyse/references/detection-strategies.md +6 -6
  69. package/templates/skills/business-analyse/references/html-data-mapping.md +15 -15
  70. package/templates/skills/business-analyse/references/naming-conventions.md +4 -4
  71. package/templates/skills/business-analyse/references/review-data-mapping.md +29 -29
  72. package/templates/skills/business-analyse/references/robustness-checks.md +36 -36
  73. package/templates/skills/business-analyse/references/spec-auto-inference.md +2 -2
  74. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +1 -1
  75. package/templates/skills/business-analyse/references/ui-resource-cards.md +1 -1
  76. package/templates/skills/business-analyse/references/validation-checklist.md +3 -3
  77. package/templates/skills/business-analyse/references/wireframe-svg-style-guide.md +2 -2
  78. package/templates/skills/business-analyse/schemas/application-schema.json +8 -8
  79. package/templates/skills/business-analyse/schemas/feature-schema.json +3 -3
  80. package/templates/skills/business-analyse/schemas/index-schema.json +47 -0
  81. package/templates/skills/business-analyse/schemas/project-schema.json +6 -6
  82. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +1 -1
  83. package/templates/skills/business-analyse/schemas/sections/handoff-schema.json +5 -3
  84. package/templates/skills/business-analyse/schemas/sections/metadata-schema.json +4 -4
  85. package/templates/skills/business-analyse/schemas/sections/specification-schema.json +1 -1
  86. package/templates/skills/business-analyse/schemas/shared/common-defs.json +4 -4
  87. package/templates/skills/business-analyse/steps/step-00-init.md +68 -77
  88. package/templates/skills/business-analyse/steps/step-01-cadrage.md +54 -180
  89. package/templates/skills/business-analyse/steps/step-02-structure.md +175 -0
  90. package/templates/skills/business-analyse/steps/step-03-specify.md +198 -0
  91. package/templates/skills/business-analyse/steps/step-04-consolidate.md +478 -0
  92. package/templates/skills/business-analyse/steps/step-05-deploy.md +220 -0
  93. package/templates/skills/business-analyse/steps/step-06-review.md +51 -69
  94. package/templates/skills/business-analyse/templates/tpl-frd.md +1 -1
  95. package/templates/skills/business-analyse/templates/tpl-handoff.md +20 -17
  96. package/templates/skills/business-analyse/templates/tpl-launch-displays.md +2 -2
  97. package/templates/skills/business-analyse/templates-react.md +2 -2
  98. package/templates/skills/derive-prd/SKILL.md +92 -0
  99. package/templates/skills/derive-prd/references/acceptance-criteria.md +169 -0
  100. package/templates/skills/derive-prd/references/entity-domain-mapping.md +115 -0
  101. package/templates/skills/{business-analyse → derive-prd}/references/handoff-file-templates.md +131 -120
  102. package/templates/skills/{business-analyse → derive-prd}/references/handoff-mappings.md +95 -95
  103. package/templates/skills/{business-analyse → derive-prd}/references/handoff-seeddata-generation.md +312 -312
  104. package/templates/skills/{business-analyse → derive-prd}/references/prd-generation.md +262 -263
  105. package/templates/skills/derive-prd/references/readiness-scoring.md +104 -0
  106. package/templates/skills/derive-prd/schemas/handoff-schema.json +95 -0
  107. package/templates/skills/derive-prd/steps/step-00-validate.md +130 -0
  108. package/templates/skills/derive-prd/steps/step-01-transform.md +206 -0
  109. package/templates/skills/derive-prd/steps/step-02-export.md +181 -0
  110. package/templates/skills/{business-analyse → derive-prd}/templates/tpl-progress.md +172 -172
  111. package/templates/skills/ralph-loop/SKILL.md +2 -1
  112. package/templates/skills/ralph-loop/references/init-resume-recovery.md +1 -1
  113. package/templates/skills/ralph-loop/steps/step-01-task.md +2 -2
  114. package/templates/skills/apex/references/agent-teams-protocol.md +0 -203
  115. package/templates/skills/business-analyse/_architecture.md +0 -124
  116. package/templates/skills/business-analyse/_elicitation.md +0 -206
  117. package/templates/skills/business-analyse/_module-loop.md +0 -115
  118. package/templates/skills/business-analyse/_rules.md +0 -142
  119. package/templates/skills/business-analyse/_suggestions.md +0 -34
  120. package/templates/skills/business-analyse/questionnaire/00-application.md +0 -160
  121. package/templates/skills/business-analyse/questionnaire/00b-project.md +0 -85
  122. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +0 -189
  123. package/templates/skills/business-analyse/questionnaire/03-scope.md +0 -164
  124. package/templates/skills/business-analyse/questionnaire/04-data.md +0 -88
  125. package/templates/skills/business-analyse/questionnaire/05-integrations.md +0 -58
  126. package/templates/skills/business-analyse/questionnaire/06-security.md +0 -68
  127. package/templates/skills/business-analyse/questionnaire/07-ui.md +0 -76
  128. package/templates/skills/business-analyse/questionnaire/08-performance.md +0 -42
  129. package/templates/skills/business-analyse/questionnaire/09-constraints.md +0 -45
  130. package/templates/skills/business-analyse/questionnaire/10-documentation.md +0 -58
  131. package/templates/skills/business-analyse/questionnaire/11-data-lifecycle.md +0 -59
  132. package/templates/skills/business-analyse/questionnaire/12-migration.md +0 -58
  133. package/templates/skills/business-analyse/questionnaire/13-cross-module.md +0 -69
  134. package/templates/skills/business-analyse/questionnaire/14-risk-assumptions.md +0 -135
  135. package/templates/skills/business-analyse/questionnaire/15-success-metrics.md +0 -136
  136. package/templates/skills/business-analyse/references/agent-module-prompt.md +0 -366
  137. package/templates/skills/business-analyse/references/agent-pooling-best-practices.md +0 -557
  138. package/templates/skills/business-analyse/references/cache-warming-strategy.md +0 -566
  139. package/templates/skills/business-analyse/references/cadrage-challenge-patterns.md +0 -41
  140. package/templates/skills/business-analyse/references/cadrage-coverage-matrix.md +0 -74
  141. package/templates/skills/business-analyse/references/cadrage-pre-analysis.md +0 -115
  142. package/templates/skills/business-analyse/references/cadrage-shared-modules.md +0 -68
  143. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +0 -85
  144. package/templates/skills/business-analyse/references/team-orchestration.md +0 -1093
  145. package/templates/skills/business-analyse/references/validate-incremental-html.md +0 -121
  146. package/templates/skills/business-analyse/steps/step-01b-applications.md +0 -419
  147. package/templates/skills/business-analyse/steps/step-02-decomposition.md +0 -387
  148. package/templates/skills/business-analyse/steps/step-03a-data.md +0 -16
  149. package/templates/skills/business-analyse/steps/step-03a1-setup.md +0 -486
  150. package/templates/skills/business-analyse/steps/step-03a2-analysis.md +0 -300
  151. package/templates/skills/business-analyse/steps/step-03b-ui.md +0 -405
  152. package/templates/skills/business-analyse/steps/step-03c-compile.md +0 -516
  153. package/templates/skills/business-analyse/steps/step-03d-validate.md +0 -691
  154. package/templates/skills/business-analyse/steps/step-04-consolidation.md +0 -17
  155. package/templates/skills/business-analyse/steps/step-04a-collect.md +0 -415
  156. package/templates/skills/business-analyse/steps/step-04b-analyze.md +0 -163
  157. package/templates/skills/business-analyse/steps/step-04c-decide.md +0 -186
  158. package/templates/skills/business-analyse/steps/step-05a-handoff.md +0 -937
  159. package/templates/skills/business-analyse/steps/step-05b-deploy.md +0 -522
  160. package/templates/skills/business-analyse/steps/step-05c-ralph-readiness.md +0 -703
@@ -1,263 +1,262 @@
1
- # PRD v3.0 Structure & Validation Rules
2
-
3
- Source: business-analyse step-05c-ralph-readiness.md
4
-
5
- ## PRD File Format v3.0
6
-
7
- ### File Location
8
-
9
- ```
10
- .ralph/prd-{moduleCode}.json
11
- ```
12
-
13
- Example: `.ralph/prd-Projects.json`, `.ralph/prd-TimeTracking.json`
14
-
15
- ---
16
-
17
- ## Structure Requirements
18
-
19
- ### 1. Version Field (MANDATORY)
20
-
21
- ```json
22
- {
23
- "$version": "3.0.0"
24
- }
25
- ```
26
-
27
- **Validation:**
28
- - MUST be exactly `"3.0.0"`
29
- - BLOCKING if missing or wrong version
30
-
31
- **Common Error:**
32
- ```
33
- BLOCKING_ERROR: PRD version must be 3.0.0, got: 2.1.0
34
- Fix: Re-run ss derive-prd with latest version
35
- ```
36
-
37
- ---
38
-
39
- ### 2. Implementation Section (MANDATORY)
40
-
41
- **CRITICAL:** `filesToCreate` MUST be under `implementation`, NOT at root level.
42
-
43
- **Correct Structure:**
44
- ```json
45
- {
46
- "$version": "3.0.0",
47
- "implementation": {
48
- "filesToCreate": {
49
- "domain": [...],
50
- "application": [...],
51
- "infrastructure": [...],
52
- "api": [...],
53
- "frontend": [...],
54
- "seedData": [...],
55
- "tests": [...],
56
- "documentation": [...]
57
- }
58
- }
59
- }
60
- ```
61
-
62
- **Wrong Structure (v2.x legacy):**
63
- ```json
64
- {
65
- "$version": "3.0.0",
66
- "filesToCreate": { // ❌ WRONG - at root level
67
- "domain": [...]
68
- }
69
- }
70
- ```
71
-
72
- **Validation:**
73
- - IF `prd.filesToCreate` exists at root level → BLOCKING ERROR
74
- - IF `prd.implementation.filesToCreate` missing → BLOCKING ERROR
75
-
76
- **Fix Command:**
77
- ```bash
78
- ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json
79
- ```
80
-
81
- ---
82
-
83
- ### 3. Eight Categories (MANDATORY)
84
-
85
- All PRD files MUST include these 8 categories under `implementation.filesToCreate`:
86
-
87
- | Category | Description | Examples |
88
- |----------|-------------|----------|
89
- | **domain** | Domain entities, value objects, domain services | `Project.cs`, `ProjectStatus.cs` |
90
- | **application** | Application services, DTOs, interfaces | `ProjectService.cs`, `CreateProjectDto.cs` |
91
- | **infrastructure** | Data access, repositories, EF Core config | `ProjectRepository.cs`, `ProjectConfiguration.cs` |
92
- | **api** | Controllers, API endpoints | `ProjectsController.cs` |
93
- | **frontend** | React pages, components, hooks | `ProjectsPage.tsx`, `useProjects.ts` |
94
- | **seedData** | Seed data classes | `ProjectSeedData.cs` |
95
- | **tests** | Unit tests, integration tests | `ProjectServiceTests.cs`, `ProjectsControllerTests.cs` |
96
- | **documentation** | Technical docs, user guides, API specs | `doc-data.ts`, `UserGuide.md`, `api-spec.yaml` |
97
-
98
- > **Note `documentation`:** Cette catégorie peut contenir des fichiers générés par le skill `/documentation` après `/ralph-loop`. Elle est obligatoire dans la structure PRD (peut être un tableau vide `[]` si aucune doc n'est prévue, mais DOIT être présente).
99
-
100
- **Validation:**
101
- ```javascript
102
- const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests', 'documentation'];
103
- const missingCategories = categories.filter(cat => !prd.implementation.filesToCreate[cat]);
104
-
105
- if (missingCategories.length > 0) {
106
- BLOCKING_ERROR(`Missing categories: ${missingCategories.join(', ')}`);
107
- }
108
- ```
109
-
110
- **Common Errors:**
111
- - Missing `tests` category → often forgotten
112
- - Missing `seedData` category → sometimes omitted for modules without seed data
113
- - Missing `documentation` category → must be present even if empty
114
- - Empty arrays allowed (e.g., `"seedData": []`, `"documentation": []`) if genuinely no files needed
115
-
116
- ---
117
-
118
- ### 4. File Count Consistency (MANDATORY)
119
-
120
- **Validation:** PRD file counts MUST match feature.json handoff counts.
121
-
122
- ```javascript
123
- const featureHandoff = moduleFeature.handoff.filesToCreate;
124
- const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests', 'documentation'];
125
-
126
- for (const cat of categories) {
127
- const prdCount = prd.implementation.filesToCreate[cat]?.length ?? 0;
128
- const featureCount = featureHandoff[cat]?.length ?? 0;
129
-
130
- if (prdCount !== featureCount) {
131
- BLOCKING_ERROR(`${cat}: prd has ${prdCount} files but feature.json has ${featureCount}`);
132
- }
133
- }
134
- ```
135
-
136
- **Why this matters:**
137
- - Ensures PRD was derived from the correct feature.json
138
- - Catches stale PRD files (derived from old version)
139
- - Validates handoff integrity before ralph-loop
140
-
141
- **Fix:**
142
- - Re-derive PRD from latest feature.json
143
- - Check that feature.json handoff section is complete
144
-
145
- ---
146
-
147
- ### 5. File Entry Schema
148
-
149
- Each file entry in a category array must have:
150
-
151
- ```json
152
- {
153
- "path": "src/SmartStack.HumanResources.Domain/Projects/Project.cs",
154
- "type": "Entity",
155
- "module": "Projects"
156
- }
157
- ```
158
-
159
- **Required Fields:**
160
- - `path` (string): Absolute or relative path where file will be created
161
- - `type` (string): File type hint (Entity, Service, Controller, Page, Test, etc.)
162
- - `module` (string): Module code this file belongs to
163
-
164
- **Optional Fields:**
165
- - `description` (string): Brief description of what the file does
166
- - `dependencies` (array): Other files this depends on
167
-
168
- ---
169
-
170
- ## Validation Checklist
171
-
172
- Use this checklist when validating PRD files:
173
-
174
- | Check | Validation | Status |
175
- |-------|-----------|--------|
176
- | **Version** | `$version === "3.0.0"` | PASS/FAIL |
177
- | **Structure** | `implementation.filesToCreate` exists (not root) | PASS/FAIL |
178
- | **Categories** | All 8 categories present | PASS/FAIL |
179
- | **File Counts** | PRD counts match feature.json handoff | PASS/FAIL |
180
- | **File Schemas** | All files have path, type, module | PASS/FAIL |
181
-
182
- **All checks must PASS before proceeding to /ralph-loop**
183
-
184
- ---
185
-
186
- ## Common Errors & Fixes
187
-
188
- ### Error 1: Wrong Version
189
- ```
190
- BLOCKING_ERROR: PRD version must be 3.0.0, got: 2.1.0
191
- ```
192
- **Fix:** Re-run `ss derive-prd` with latest SmartStack.mcp version
193
-
194
- ### Error 2: filesToCreate at Root Level
195
- ```
196
- BLOCKING_ERROR: filesToCreate is at ROOT level (wrong structure)
197
- ```
198
- **Fix:** Re-run `ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json`
199
-
200
- ### Error 3: Missing Categories
201
- ```
202
- BLOCKING_ERROR: Missing categories: seedData, tests, documentation
203
- ```
204
- **Fix:**
205
- - Check feature.json handoff.filesToCreate has all 8 categories
206
- - Re-derive PRD after fixing feature.json
207
- - If genuinely no files needed, use empty array: `"seedData": []`, `"documentation": []`
208
-
209
- ### Error 4: File Count Mismatch
210
- ```
211
- BLOCKING_ERROR: api: prd has 8 files but feature.json has 12
212
- ```
213
- **Fix:**
214
- - PRD is stale (derived from old feature.json)
215
- - Re-derive PRD from latest feature.json: `ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json`
216
-
217
- ---
218
-
219
- ## Generation Command Reference
220
-
221
- **Derive PRD from feature.json:**
222
- ```bash
223
- ss derive-prd \
224
- --feature docs/{App}/business-analyse/v1.0/feature.json \
225
- --output .ralph/prd-{ModuleCode}.json
226
- ```
227
-
228
- **Example:**
229
- ```bash
230
- ss derive-prd \
231
- --feature docs/HumanResources/business-analyse/v1.0/feature.json \
232
- --output .ralph/prd-Projects.json
233
- ```
234
-
235
- **Batch generation for all modules:**
236
- ```bash
237
- # Typically done in step-05a-handoff.md
238
- for module in $(modules); do
239
- ss derive-prd --feature {module_feature_path} --output .ralph/prd-${module}.json
240
- done
241
- ```
242
-
243
- ---
244
-
245
- ## Why PRD Validation Matters
246
-
247
- | Risk | Without Validation | With Validation |
248
- |------|-------------------|-----------------|
249
- | **Wrong structure** | ralph-loop fails mid-execution | Caught before development starts |
250
- | **Stale PRD** | Generates code from old spec | Detects version mismatch |
251
- | **Missing files** | Incomplete implementation | Ensures all layers covered |
252
- | **Count mismatch** | Silent data loss | Guarantees integrity |
253
-
254
- **Bottom line:** Ralph-loop depends on correct PRD structure. Validating upfront saves hours of debugging.
255
-
256
- ---
257
-
258
- ## Related Files
259
-
260
- - `step-05a-handoff.md`: Generates PRD files via `ss derive-prd`
261
- - `step-05c-ralph-readiness.md`: Validates PRD structure before ralph-loop
262
- - `feature-schema.json`: Schema for feature.json (source of PRD)
263
- - `/ralph-loop` skill: Consumes PRD files for implementation
1
+ # PRD v3.0 Structure & Validation Rules
2
+
3
+ Source: business-analyse step-05-deploy.md
4
+
5
+ ## PRD File Format v3.0
6
+
7
+ ### File Location
8
+
9
+ ```
10
+ .ralph/prd-{moduleCode}.json
11
+ ```
12
+
13
+ Example: `.ralph/prd-Projects.json`, `.ralph/prd-TimeTracking.json`
14
+
15
+ ---
16
+
17
+ ## Structure Requirements
18
+
19
+ ### 1. Version Field (MANDATORY)
20
+
21
+ ```json
22
+ {
23
+ "$version": "3.0.0"
24
+ }
25
+ ```
26
+
27
+ **Validation:**
28
+ - MUST be exactly `"3.0.0"`
29
+ - BLOCKING if missing or wrong version
30
+
31
+ **Common Error:**
32
+ ```
33
+ BLOCKING_ERROR: PRD version must be 3.0.0, got: 2.1.0
34
+ Fix: Re-run ss derive-prd with latest version
35
+ ```
36
+
37
+ ---
38
+
39
+ ### 2. Implementation Section (MANDATORY)
40
+
41
+ **CRITICAL:** `filesToCreate` MUST be under `implementation`, NOT at root level.
42
+
43
+ **Correct Structure:**
44
+ ```json
45
+ {
46
+ "$version": "3.0.0",
47
+ "implementation": {
48
+ "filesToCreate": {
49
+ "domain": [...],
50
+ "application": [...],
51
+ "infrastructure": [...],
52
+ "api": [...],
53
+ "frontend": [...],
54
+ "seedData": [...],
55
+ "tests": [...],
56
+ "documentation": [...]
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ **Wrong Structure (v2.x legacy):**
63
+ ```json
64
+ {
65
+ "$version": "3.0.0",
66
+ "filesToCreate": { // ❌ WRONG - at root level
67
+ "domain": [...]
68
+ }
69
+ }
70
+ ```
71
+
72
+ **Validation:**
73
+ - IF `prd.filesToCreate` exists at root level → BLOCKING ERROR
74
+ - IF `prd.implementation.filesToCreate` missing → BLOCKING ERROR
75
+
76
+ **Fix Command:**
77
+ ```bash
78
+ ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json
79
+ ```
80
+
81
+ ---
82
+
83
+ ### 3. Eight Categories (MANDATORY)
84
+
85
+ All PRD files MUST include these 8 categories under `implementation.filesToCreate`:
86
+
87
+ | Category | Description | Examples |
88
+ |----------|-------------|----------|
89
+ | **domain** | Domain entities, value objects, domain services | `Project.cs`, `ProjectStatus.cs` |
90
+ | **application** | Application services, DTOs, interfaces | `ProjectService.cs`, `CreateProjectDto.cs` |
91
+ | **infrastructure** | Data access, repositories, EF Core config | `ProjectRepository.cs`, `ProjectConfiguration.cs` |
92
+ | **api** | Controllers, API endpoints | `ProjectsController.cs` |
93
+ | **frontend** | React pages, components, hooks | `ProjectsPage.tsx`, `useProjects.ts` |
94
+ | **seedData** | Seed data classes | `ProjectSeedData.cs` |
95
+ | **tests** | Unit tests, integration tests | `ProjectServiceTests.cs`, `ProjectsControllerTests.cs` |
96
+ | **documentation** | Technical docs, user guides, API specs | `doc-data.ts`, `UserGuide.md`, `api-spec.yaml` |
97
+
98
+ > **Note `documentation`:** Cette catégorie peut contenir des fichiers générés par le skill `/documentation` après `/ralph-loop`. Elle est obligatoire dans la structure PRD (peut être un tableau vide `[]` si aucune doc n'est prévue, mais DOIT être présente).
99
+
100
+ **Validation:**
101
+ ```javascript
102
+ const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests', 'documentation'];
103
+ const missingCategories = categories.filter(cat => !prd.implementation.filesToCreate[cat]);
104
+
105
+ if (missingCategories.length > 0) {
106
+ BLOCKING_ERROR(`Missing categories: ${missingCategories.join(', ')}`);
107
+ }
108
+ ```
109
+
110
+ **Common Errors:**
111
+ - Missing `tests` category → often forgotten
112
+ - Missing `seedData` category → sometimes omitted for modules without seed data
113
+ - Missing `documentation` category → must be present even if empty
114
+ - Empty arrays allowed (e.g., `"seedData": []`, `"documentation": []`) if genuinely no files needed
115
+
116
+ ---
117
+
118
+ ### 4. File Count Consistency (MANDATORY)
119
+
120
+ **Validation:** PRD file counts MUST match index.json handoff counts.
121
+
122
+ ```javascript
123
+ const featureHandoff = moduleFeature.handoff.filesToCreate;
124
+ const categories = ['domain', 'application', 'infrastructure', 'api', 'frontend', 'seedData', 'tests', 'documentation'];
125
+
126
+ for (const cat of categories) {
127
+ const prdCount = prd.implementation.filesToCreate[cat]?.length ?? 0;
128
+ const featureCount = featureHandoff[cat]?.length ?? 0;
129
+
130
+ if (prdCount !== featureCount) {
131
+ BLOCKING_ERROR(`${cat}: prd has ${prdCount} files but index.json has ${featureCount}`);
132
+ }
133
+ }
134
+ ```
135
+
136
+ **Why this matters:**
137
+ - Ensures PRD was derived from the correct index.json
138
+ - Catches stale PRD files (derived from old version)
139
+ - Validates handoff integrity before ralph-loop
140
+
141
+ **Fix:**
142
+ - Re-derive PRD from latest index.json
143
+ - Check that index.json handoff section is complete
144
+
145
+ ---
146
+
147
+ ### 5. File Entry Schema
148
+
149
+ Each file entry in a category array must have:
150
+
151
+ ```json
152
+ {
153
+ "path": "src/SmartStack.HumanResources.Domain/Projects/Project.cs",
154
+ "type": "Entity",
155
+ "module": "Projects"
156
+ }
157
+ ```
158
+
159
+ **Required Fields:**
160
+ - `path` (string): Absolute or relative path where file will be created
161
+ - `type` (string): File type hint (Entity, Service, Controller, Page, Test, etc.)
162
+ - `module` (string): Module code this file belongs to
163
+
164
+ **Optional Fields:**
165
+ - `description` (string): Brief description of what the file does
166
+ - `dependencies` (array): Other files this depends on
167
+
168
+ ---
169
+
170
+ ## Validation Checklist
171
+
172
+ Use this checklist when validating PRD files:
173
+
174
+ | Check | Validation | Status |
175
+ |-------|-----------|--------|
176
+ | **Version** | `$version === "3.0.0"` | PASS/FAIL |
177
+ | **Structure** | `implementation.filesToCreate` exists (not root) | PASS/FAIL |
178
+ | **Categories** | All 8 categories present | PASS/FAIL |
179
+ | **File Counts** | PRD counts match index.json handoff.filesToCreate | PASS/FAIL |
180
+ | **File Schemas** | All files have path, type, module | PASS/FAIL |
181
+
182
+ **All checks must PASS before proceeding to /ralph-loop**
183
+
184
+ ---
185
+
186
+ ## Common Errors & Fixes
187
+
188
+ ### Error 1: Wrong Version
189
+ ```
190
+ BLOCKING_ERROR: PRD version must be 3.0.0, got: 2.1.0
191
+ ```
192
+ **Fix:** Re-run `ss derive-prd` with latest SmartStack.mcp version
193
+
194
+ ### Error 2: filesToCreate at Root Level
195
+ ```
196
+ BLOCKING_ERROR: filesToCreate is at ROOT level (wrong structure)
197
+ ```
198
+ **Fix:** Re-run `ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json`
199
+
200
+ ### Error 3: Missing Categories
201
+ ```
202
+ BLOCKING_ERROR: Missing categories: seedData, tests, documentation
203
+ ```
204
+ **Fix:**
205
+ - Check index.json handoff.filesToCreate has all 8 categories
206
+ - Re-derive PRD after fixing index.json
207
+ - If genuinely no files needed, use empty array: `"seedData": []`, `"documentation": []`
208
+
209
+ ### Error 4: File Count Mismatch
210
+ ```
211
+ BLOCKING_ERROR: api: prd has 8 files but index.json has 12
212
+ ```
213
+ **Fix:**
214
+ - PRD is stale (derived from old index.json)
215
+ - Re-derive PRD from latest index.json: `ss derive-prd --feature {path} --output .ralph/prd-{moduleCode}.json`
216
+
217
+ ---
218
+
219
+ ## Generation Command Reference
220
+
221
+ **Derive PRD from index.json:**
222
+ ```bash
223
+ ss derive-prd \
224
+ --feature docs/{App}/business-analyse/v1.0/index.json \
225
+ --output .ralph/prd-{ModuleCode}.json
226
+ ```
227
+
228
+ **Example:**
229
+ ```bash
230
+ ss derive-prd \
231
+ --feature docs/HumanResources/business-analyse/v1.0/index.json \
232
+ --output .ralph/prd-Projects.json
233
+ ```
234
+
235
+ **Batch generation for all modules:**
236
+ ```bash
237
+ # Typically done in step-05-deploy.md
238
+ for module in $(modules); do
239
+ ss derive-prd --feature {module_feature_path} --output .ralph/prd-${module}.json
240
+ done
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Why PRD Validation Matters
246
+
247
+ | Risk | Without Validation | With Validation |
248
+ |------|-------------------|-----------------|
249
+ | **Wrong structure** | ralph-loop fails mid-execution | Caught before development starts |
250
+ | **Stale PRD** | Generates code from old spec | Detects version mismatch |
251
+ | **Missing files** | Incomplete implementation | Ensures all layers covered |
252
+ | **Count mismatch** | Silent data loss | Guarantees integrity |
253
+
254
+ **Bottom line:** Ralph-loop depends on correct PRD structure. Validating upfront saves hours of debugging.
255
+
256
+ ---
257
+
258
+ ## Related Files
259
+
260
+ - `step-05-deploy.md`: Generates PRD files via `ss derive-prd`
261
+ - `feature-schema.json`: Schema for index.json (source of PRD)
262
+ - `/ralph-loop` skill: Consumes PRD files for implementation
@@ -0,0 +1,104 @@
1
+ # Readiness Scoring Algorithm
2
+
3
+ > **Used by:** step-00-validate (section 4: Calculate Readiness Score)
4
+ > **Purpose:** Evaluate module readiness for handoff based on acceptance criteria from validation-checklist.md.
5
+
6
+ ---
7
+
8
+ ## Algorithm
9
+
10
+ For each module, evaluate all acceptance criteria (AC-01 to AC-17) from `references/acceptance-criteria.md`.
11
+
12
+ ### Score Calculation
13
+
14
+ ```javascript
15
+ const blockingACs = ['AC-01', 'AC-02', 'AC-03', 'AC-04', 'AC-05', 'AC-06', 'AC-07',
16
+ 'AC-08', 'AC-09', 'AC-10', 'AC-11', 'AC-12', 'AC-13',
17
+ 'AC-15', 'AC-16', 'AC-17']; // 16 blocking
18
+ const nonBlockingACs = ['AC-14']; // 1 non-blocking (warning only)
19
+
20
+ // Count passes
21
+ const blockingPassed = blockingACs.filter(ac => results[ac] === 'PASS').length;
22
+ const blockingTotal = blockingACs.length;
23
+ const nonBlockingPassed = nonBlockingACs.filter(ac => results[ac] === 'PASS').length;
24
+ const nonBlockingTotal = nonBlockingACs.length;
25
+
26
+ // Scores
27
+ const blockingScore = (blockingPassed / blockingTotal) * 100; // Must be 100%
28
+ const nonBlockingScore = (nonBlockingPassed / nonBlockingTotal) * 100; // Warn if < 80%
29
+ ```
30
+
31
+ ### Gate Rules
32
+
33
+ | Condition | Action |
34
+ |-----------|--------|
35
+ | Blocking score = 100% | PASS — module ready for handoff |
36
+ | Blocking score < 100% | BLOCKING — list failed ACs, require fix |
37
+ | Non-blocking score >= 80% | OK — proceed normally |
38
+ | Non-blocking score < 80% | WARNING — suggest fixes but don't block |
39
+
40
+ ---
41
+
42
+ ## Output Format
43
+
44
+ ### Per-Module Result
45
+
46
+ ```javascript
47
+ {
48
+ moduleCode: "Employees",
49
+ blockingScore: 100, // percentage
50
+ blockingPassed: 16,
51
+ blockingTotal: 16,
52
+ nonBlockingScore: 100,
53
+ nonBlockingPassed: 1,
54
+ nonBlockingTotal: 1,
55
+ ready: true,
56
+ failedACs: [], // empty if ready
57
+ warnings: [] // non-blocking failures
58
+ }
59
+ ```
60
+
61
+ ### Readiness Table
62
+
63
+ ```
64
+ ┌──────────────┬──────────┬────────────┬──────────────┬────────┐
65
+ │ Module │ Status │ Blocking │ Non-blocking │ Ready │
66
+ ├──────────────┼──────────┼────────────┼──────────────┼────────┤
67
+ │ Employees │ consol. │ 16/16 100% │ 1/1 100% │ YES │
68
+ │ Absences │ consol. │ 14/16 88% │ 1/1 100% │ NO │
69
+ └──────────────┴──────────┴────────────┴──────────────┴────────┘
70
+ ```
71
+
72
+ ### Failure Detail (when blocked)
73
+
74
+ ```
75
+ Module "Absences" — 2 blocking ACs FAILED:
76
+
77
+ FAIL AC-05: wireframes >= 1 = 0 (min: 1)
78
+ Recovery: Re-run /business-analyse step-03 wireframe generation
79
+
80
+ FAIL AC-09: seedDataCore 9 arrays = 7 (min: 9)
81
+ Recovery: Re-run /business-analyse step-03 seedDataCore transform
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Recovery Actions
87
+
88
+ Each failed AC has a specific recovery action (from `references/acceptance-criteria.md`):
89
+
90
+ | AC | Recovery |
91
+ |----|----------|
92
+ | AC-01/02 | Re-run step-03 entity specification |
93
+ | AC-03/04 | Re-run step-03 use case / functional requirements |
94
+ | AC-05/06/07 | Re-run step-03 wireframe generation |
95
+ | AC-08 | Re-run step-03 section definition |
96
+ | AC-09 | Re-run step-03 seedDataCore transform |
97
+ | AC-10 | Auto-fix: wrap in array |
98
+ | AC-11 | Re-run step-03 API endpoints |
99
+ | AC-12 | Re-run step-03 messages |
100
+ | AC-13 | Re-run step-03 validations |
101
+ | AC-14 | Auto-fix: rename fields (non-blocking) |
102
+ | AC-15 | Auto-fix: wrap string in array |
103
+ | AC-16 | Auto-fix: copy description to message |
104
+ | AC-17 | Re-run step-03 gherkin |