@atlashub/smartstack-cli 1.13.2 → 1.14.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 (210) hide show
  1. package/.documentation/agents.html +1 -1
  2. package/.documentation/apex.html +1 -1
  3. package/.documentation/business-analyse.html +1 -1
  4. package/.documentation/cli-commands.html +3 -3
  5. package/.documentation/commands.html +1 -1
  6. package/.documentation/efcore.html +1 -1
  7. package/.documentation/gitflow.html +1 -1
  8. package/.documentation/hooks.html +1 -1
  9. package/.documentation/index.html +1 -1
  10. package/.documentation/init.html +3 -3
  11. package/.documentation/installation.html +1001 -352
  12. package/.documentation/ralph-loop.html +1 -1
  13. package/.documentation/test-web.html +1 -1
  14. package/README.md +88 -20
  15. package/dist/index.js +276 -85
  16. package/dist/index.js.map +1 -1
  17. package/package.json +1 -1
  18. package/templates/agents/code-reviewer.md +163 -0
  19. package/templates/agents/efcore/db-deploy.md +25 -7
  20. package/templates/agents/efcore/db-reset.md +31 -10
  21. package/templates/agents/efcore/db-status.md +22 -5
  22. package/templates/agents/efcore/migration.md +69 -19
  23. package/templates/agents/gitflow/cleanup.md +8 -1
  24. package/templates/agents/gitflow/commit.md +7 -5
  25. package/templates/agents/gitflow/finish.md +6 -4
  26. package/templates/agents/gitflow/pr.md +8 -1
  27. package/templates/agents/gitflow/start.md +1 -1
  28. package/templates/commands/check-version.md +267 -0
  29. package/templates/commands/efcore/_shared.md +30 -1
  30. package/templates/commands/efcore/db-reset.md +18 -6
  31. package/templates/commands/gitflow/OPTIMIZATIONS.md +206 -0
  32. package/templates/commands/refactor.md +164 -0
  33. package/templates/project/DependencyInjection.Application.cs.template +25 -0
  34. package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
  35. package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
  36. package/templates/project/ExampleEntity.cs.template +116 -0
  37. package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
  38. package/templates/project/ExampleService.cs.template +146 -0
  39. package/templates/project/ExtensionsDbContext.cs.template +41 -0
  40. package/templates/project/IExtensionsDbContext.cs.template +22 -0
  41. package/templates/project/Program.cs.template +47 -0
  42. package/templates/project/README.md +79 -0
  43. package/templates/ralph/README.md +10 -8
  44. package/templates/ralph/ralph.config.yaml +2 -2
  45. package/templates/skills/_shared.md +44 -44
  46. package/templates/skills/ai-prompt/SKILL.md +55 -55
  47. package/templates/skills/apex/SKILL.md +235 -0
  48. package/templates/skills/apex/steps/step-00-init.md +203 -0
  49. package/templates/skills/apex/steps/step-01-analyze.md +210 -0
  50. package/templates/skills/apex/steps/step-02-plan.md +217 -0
  51. package/templates/skills/apex/steps/step-03-execute.md +178 -0
  52. package/templates/skills/apex/steps/step-04-validate.md +217 -0
  53. package/templates/skills/apex/steps/step-05-examine.md +207 -0
  54. package/templates/skills/apex/steps/step-06-resolve.md +181 -0
  55. package/templates/skills/apex/steps/step-07-tests.md +206 -0
  56. package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
  57. package/templates/skills/apex/templates/00-context.md +46 -0
  58. package/templates/skills/apex/templates/01-analyze.md +63 -0
  59. package/templates/skills/apex/templates/02-plan.md +63 -0
  60. package/templates/skills/apex/templates/03-execute.md +34 -0
  61. package/templates/skills/apex/templates/04-validate.md +61 -0
  62. package/templates/skills/apex/templates/05-examine.md +58 -0
  63. package/templates/skills/apex/templates/06-resolve.md +39 -0
  64. package/templates/skills/apex/templates/07-tests.md +56 -0
  65. package/templates/skills/apex/templates/08-run-tests.md +41 -0
  66. package/templates/skills/apex/templates/README.md +69 -0
  67. package/templates/skills/application/SKILL.md +50 -50
  68. package/templates/skills/application/templates-backend.md +25 -25
  69. package/templates/skills/application/templates-frontend.md +43 -43
  70. package/templates/skills/application/templates-i18n.md +29 -29
  71. package/templates/skills/application/templates-seed.md +77 -77
  72. package/templates/skills/business-analyse/SKILL.md +223 -0
  73. package/templates/skills/business-analyse/_shared.md +258 -0
  74. package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
  75. package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
  76. package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
  77. package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
  78. package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
  79. package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
  80. package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
  81. package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
  82. package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
  83. package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
  84. package/templates/skills/business-analyse/questionnaire.md +177 -177
  85. package/templates/skills/business-analyse/react/components.md +340 -0
  86. package/templates/skills/business-analyse/react/i18n-template.md +245 -0
  87. package/templates/skills/business-analyse/react/schema.md +151 -0
  88. package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
  89. package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
  90. package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
  91. package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
  92. package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
  93. package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
  94. package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
  95. package/templates/skills/business-analyse/templates/00-context.md +105 -0
  96. package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
  97. package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
  98. package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
  99. package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
  100. package/templates/skills/business-analyse/templates-frd.md +217 -217
  101. package/templates/skills/business-analyse/templates-react.md +26 -26
  102. package/templates/skills/controller/SKILL.md +141 -92
  103. package/templates/skills/controller/postman-templates.md +15 -15
  104. package/templates/skills/controller/steps/step-00-init.md +191 -0
  105. package/templates/skills/controller/steps/step-01-analyze.md +146 -0
  106. package/templates/skills/controller/steps/step-02-plan.md +176 -0
  107. package/templates/skills/controller/steps/step-03-generate.md +219 -0
  108. package/templates/skills/controller/steps/step-04-perms.md +219 -0
  109. package/templates/skills/controller/steps/step-05-validate.md +107 -0
  110. package/templates/skills/controller/templates.md +77 -77
  111. package/templates/skills/documentation/SKILL.md +79 -79
  112. package/templates/skills/feature-full/SKILL.md +38 -38
  113. package/templates/skills/gitflow/SKILL.md +277 -0
  114. package/templates/{commands → skills}/gitflow/_shared.md +20 -20
  115. package/templates/skills/gitflow/phases/abort.md +173 -0
  116. package/templates/skills/gitflow/phases/cleanup.md +226 -0
  117. package/templates/skills/gitflow/phases/status.md +178 -0
  118. package/templates/skills/gitflow/steps/step-commit.md +255 -0
  119. package/templates/skills/gitflow/steps/step-finish.md +255 -0
  120. package/templates/skills/gitflow/steps/step-init.md +209 -0
  121. package/templates/skills/gitflow/steps/step-merge.md +225 -0
  122. package/templates/skills/gitflow/steps/step-plan.md +208 -0
  123. package/templates/skills/gitflow/steps/step-pr.md +235 -0
  124. package/templates/skills/gitflow/steps/step-start.md +234 -0
  125. package/templates/skills/gitflow/steps/step-sync.md +200 -0
  126. package/templates/skills/gitflow/templates/config.json +53 -0
  127. package/templates/skills/notification/SKILL.md +51 -51
  128. package/templates/skills/ralph-loop/SKILL.md +228 -0
  129. package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
  130. package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
  131. package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
  132. package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
  133. package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
  134. package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
  135. package/templates/skills/review-code/SKILL.md +219 -0
  136. package/templates/skills/review-code/references/clean-code-principles.md +140 -0
  137. package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
  138. package/templates/skills/review-code/references/feedback-patterns.md +149 -0
  139. package/templates/skills/review-code/references/security-checklist.md +127 -0
  140. package/templates/skills/ui-components/SKILL.md +54 -54
  141. package/templates/skills/workflow/SKILL.md +46 -46
  142. package/templates/commands/ai-prompt.md +0 -315
  143. package/templates/commands/apex/1-analyze.md +0 -100
  144. package/templates/commands/apex/2-plan.md +0 -145
  145. package/templates/commands/apex/3-execute.md +0 -171
  146. package/templates/commands/apex/4-examine.md +0 -116
  147. package/templates/commands/apex/5-tasks.md +0 -209
  148. package/templates/commands/apex.md +0 -76
  149. package/templates/commands/application/create.md +0 -362
  150. package/templates/commands/application/templates-backend.md +0 -463
  151. package/templates/commands/application/templates-frontend.md +0 -517
  152. package/templates/commands/application/templates-i18n.md +0 -478
  153. package/templates/commands/application/templates-seed.md +0 -362
  154. package/templates/commands/application.md +0 -303
  155. package/templates/commands/business-analyse/0-orchestrate.md +0 -156
  156. package/templates/commands/business-analyse/1-init.md +0 -99
  157. package/templates/commands/business-analyse/2-discover.md +0 -143
  158. package/templates/commands/business-analyse/3-analyse.md +0 -106
  159. package/templates/commands/business-analyse/4-specify.md +0 -133
  160. package/templates/commands/business-analyse/5-validate.md +0 -132
  161. package/templates/commands/business-analyse/6-handoff.md +0 -157
  162. package/templates/commands/business-analyse/7-doc-html.md +0 -103
  163. package/templates/commands/business-analyse/_shared.md +0 -176
  164. package/templates/commands/business-analyse/bug.md +0 -118
  165. package/templates/commands/business-analyse/change-request.md +0 -144
  166. package/templates/commands/business-analyse/hotfix.md +0 -116
  167. package/templates/commands/business-analyse.md +0 -121
  168. package/templates/commands/controller/create.md +0 -216
  169. package/templates/commands/controller/postman-templates.md +0 -528
  170. package/templates/commands/controller/templates.md +0 -600
  171. package/templates/commands/controller.md +0 -337
  172. package/templates/commands/create/agent.md +0 -138
  173. package/templates/commands/create/command.md +0 -166
  174. package/templates/commands/create/hook.md +0 -234
  175. package/templates/commands/create/plugin.md +0 -329
  176. package/templates/commands/create/project.md +0 -508
  177. package/templates/commands/create/skill.md +0 -199
  178. package/templates/commands/create.md +0 -220
  179. package/templates/commands/documentation/module.md +0 -202
  180. package/templates/commands/documentation/templates.md +0 -432
  181. package/templates/commands/documentation.md +0 -190
  182. package/templates/commands/epct.md +0 -69
  183. package/templates/commands/explain.md +0 -186
  184. package/templates/commands/feature-full.md +0 -267
  185. package/templates/commands/gitflow/1-init.md +0 -188
  186. package/templates/commands/gitflow/10-start.md +0 -190
  187. package/templates/commands/gitflow/11-finish.md +0 -382
  188. package/templates/commands/gitflow/12-cleanup.md +0 -103
  189. package/templates/commands/gitflow/13-sync.md +0 -216
  190. package/templates/commands/gitflow/14-rebase.md +0 -251
  191. package/templates/commands/gitflow/2-status.md +0 -122
  192. package/templates/commands/gitflow/3-commit.md +0 -209
  193. package/templates/commands/gitflow/4-plan.md +0 -174
  194. package/templates/commands/gitflow/5-exec.md +0 -202
  195. package/templates/commands/gitflow/6-abort.md +0 -121
  196. package/templates/commands/gitflow/7-pull-request.md +0 -176
  197. package/templates/commands/gitflow/8-review.md +0 -113
  198. package/templates/commands/gitflow/9-merge.md +0 -157
  199. package/templates/commands/gitflow.md +0 -128
  200. package/templates/commands/implement.md +0 -663
  201. package/templates/commands/init.md +0 -567
  202. package/templates/commands/mcp-integration.md +0 -330
  203. package/templates/commands/notification.md +0 -129
  204. package/templates/commands/oneshot.md +0 -57
  205. package/templates/commands/quickstart.md +0 -154
  206. package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
  207. package/templates/commands/ralph-loop/help.md +0 -126
  208. package/templates/commands/ralph-loop/ralph-loop.md +0 -120
  209. package/templates/commands/review.md +0 -106
  210. package/templates/commands/workflow.md +0 -193
@@ -0,0 +1,243 @@
1
+ ---
2
+ name: step-02-analyse
3
+ description: Analysis phase - BRD formalization with business rules
4
+ model: sonnet
5
+ prev_step: steps/step-01-discover.md
6
+ next_step: steps/step-03-specify.md
7
+ ---
8
+
9
+ <objective>
10
+ Transform discovery findings into a formal Business Requirements Document (BRD).
11
+ Identify and formalize all business rules with BR-XXX identifiers.
12
+ </objective>
13
+
14
+ <ultrathink>
15
+ ULTRATHINK MODE - Business Rule Formalization:
16
+ - Extract IMPLICIT rules from discovery responses
17
+ - Challenge completeness of each rule
18
+ - Verify no rule contradicts another
19
+ - Ensure rules are testable
20
+ </ultrathink>
21
+
22
+ ## EXECUTION SEQUENCE
23
+
24
+ ### 1. Read Current State
25
+
26
+ Read `{output_dir}/00-context.md` to restore state variables.
27
+ Read `{output_dir}/1-discovery.md` for discovery findings.
28
+
29
+ Update progress: `02-analyse` -> "In Progress"
30
+
31
+ ---
32
+
33
+ ### 2. Load BRD Template
34
+
35
+ ```
36
+ Read: templates/frd-brd.md # ~90 lines only (vs 477 lines full template)
37
+ ```
38
+
39
+ This template contains ONLY the BRD structure, not FRD or Handoff.
40
+
41
+ ---
42
+
43
+ ### 3. Extract Business Objectives
44
+
45
+ From discovery section 1 (Contexte Business), formalize:
46
+
47
+ | ID | Objective | Metric | Target |
48
+ |----|----------|----------|-------|
49
+ | OBJ-001 | {objective} | {measurable KPI} | {target value} |
50
+ | OBJ-002 | ... | ... | ... |
51
+
52
+ **ULTRATHINK checkpoint:**
53
+ - Each objective is measurable?
54
+ - Target values are realistic?
55
+ - Objectives align with stakeholder needs?
56
+
57
+ ---
58
+
59
+ ### 4. Identify Business Rules
60
+
61
+ Scan discovery document for implicit and explicit rules:
62
+
63
+ **Sources to analyze:**
64
+ - Scope section (constraints)
65
+ - Stakeholder needs (role-specific rules)
66
+ - Data requirements (validation rules)
67
+ - Process flows (workflow rules)
68
+
69
+ **Rule categories:**
70
+ | Category | Example | BR-ID pattern |
71
+ |----------|---------|---------------|
72
+ | Validation | "Email must be unique" | BR-VAL-XXX |
73
+ | Calculation | "Total = sum of lines" | BR-CALC-XXX |
74
+ | Workflow | "Manager must approve > 1000$" | BR-WF-XXX |
75
+ | Security | "Only admin can delete" | BR-SEC-XXX |
76
+ | Data | "Created date is immutable" | BR-DATA-XXX |
77
+
78
+ ---
79
+
80
+ ### 5. Formalize Each Business Rule
81
+
82
+ For each identified rule, create detailed specification:
83
+
84
+ ```markdown
85
+ #### BR-XXX: {Rule Name}
86
+
87
+ **Statement:** {Clear, unambiguous statement}
88
+
89
+ **Conditions:**
90
+ - IF {condition A}
91
+ - AND {condition B}
92
+ - THEN {result}
93
+ - ELSE {alternative result}
94
+
95
+ **Examples:**
96
+ | Input | Expected Output |
97
+ |-------|-----------------|
98
+ | {example input 1} | {expected output 1} |
99
+ | {example input 2} | {expected output 2} |
100
+
101
+ **Testability:** {How to verify this rule}
102
+ ```
103
+
104
+ ---
105
+
106
+ ### 6. Model Business Process
107
+
108
+ Create process diagram for main flow:
109
+
110
+ ```
111
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
112
+ │ Step 1 │────►│ Step 2 │────►│ Step 3 │
113
+ │ {action} │ │ {action} │ │ {action} │
114
+ └─────────────┘ └─────────────┘ └─────────────┘
115
+ │ │ │
116
+ ▼ ▼ ▼
117
+ {actor} {actor} {actor}
118
+ ```
119
+
120
+ Identify:
121
+ - Entry points
122
+ - Decision points (apply BR-WF rules)
123
+ - Exit points
124
+ - Alternative flows
125
+
126
+ ---
127
+
128
+ ### 7. Define Data Entities (Business View)
129
+
130
+ **IMPORTANT: Business attributes only - NO technical types!**
131
+
132
+ | Entity | Description | Cardinality |
133
+ |--------|-------------|-------------|
134
+ | {Entity} | {business description} | 1:N with {other} |
135
+
136
+ | Entity | Attribute | Description | Required |
137
+ |--------|-----------|-------------|----------|
138
+ | {Entity} | {attribute} | {business meaning} | Yes/No |
139
+
140
+ **ULTRATHINK checkpoint:**
141
+ - All entities from discovery captured?
142
+ - Relationships are complete?
143
+ - No orphan entities?
144
+
145
+ ---
146
+
147
+ ### 8. Identify Integrations
148
+
149
+ | System | Direction | Data | Frequency |
150
+ |--------|-----------|------|-----------|
151
+ | {system} | In/Out/Bi | {data} | Real-time/Batch |
152
+
153
+ For each integration, note:
154
+ - Data format expected
155
+ - Error handling strategy
156
+ - Fallback behavior
157
+
158
+ ---
159
+
160
+ ### 9. Compile BRD Document
161
+
162
+ Assemble using `templates/frd-brd.md` structure:
163
+
164
+ ```markdown
165
+ # BRD - {feature_id} {feature_description}
166
+
167
+ > **Module:** business/{application_name}/{module_name}
168
+ > **Version:** 1.0
169
+ > **Based on:** 1-discovery.md v1.0
170
+
171
+ ## 1. Executive Summary
172
+ {3-5 sentence synthesis}
173
+
174
+ ## 2. Business Objectives
175
+ {OBJ table}
176
+
177
+ ## 3. Business Rules
178
+ {BR summary table}
179
+
180
+ ### 3.1 Critical Rules Detail
181
+ {BR-XXX detailed specs}
182
+
183
+ ## 4. Business Process
184
+ {Process diagrams}
185
+
186
+ ## 5. Business Data
187
+ {Entity tables - business view}
188
+
189
+ ## 6. Integrations
190
+ {Integration table}
191
+
192
+ ---
193
+
194
+ ## Version History
195
+
196
+ | Version | Date | Author | Changes |
197
+ |---------|------|--------|---------|
198
+ | 1.0 | {date} | BA | Initial creation |
199
+ ```
200
+
201
+ ---
202
+
203
+ ### 10. Save Output
204
+
205
+ Write to: `{output_dir}/2-business-requirements.md`
206
+
207
+ Update `00-context.md`:
208
+ - Progress: `02-analyse` -> "Complete"
209
+ - Add BR count to state
210
+
211
+ ---
212
+
213
+ ### 11. Display Summary and Load Next Step
214
+
215
+ **Display:**
216
+ ```
217
+ ANALYSE - {feature_id}
218
+ ├── Status: Complete
219
+ ├── Objectives: {OBJ count}
220
+ ├── Business Rules: {BR count}
221
+ ├── Entities: {entity count}
222
+ ├── Integrations: {integration count}
223
+ ├── Output: {output_dir}/2-business-requirements.md
224
+ └── Next: step-03-specify (FRD + Use Cases)
225
+ ```
226
+
227
+ **If NOT auto_mode:**
228
+ Ask: "Proceed with functional specification?"
229
+
230
+ **Load next step:**
231
+ ```
232
+ Read and execute: steps/step-03-specify.md
233
+ ```
234
+
235
+ ---
236
+
237
+ ## OUTPUT
238
+
239
+ This step produces:
240
+ - `{output_dir}/2-business-requirements.md` (created)
241
+ - `{output_dir}/00-context.md` (updated)
242
+
243
+ Template loaded: **~90 lines** (vs 477 lines full file)
@@ -0,0 +1,317 @@
1
+ ---
2
+ name: step-03-specify
3
+ description: Specification phase - FRD with use cases, requirements, permissions
4
+ model: sonnet
5
+ prev_step: steps/step-02-analyse.md
6
+ next_step: steps/step-04-validate.md
7
+ ---
8
+
9
+ <objective>
10
+ Create comprehensive Functional Requirements Document (FRD) with:
11
+ - Use Cases (UC-XXX)
12
+ - Functional Requirements (FR-XXX)
13
+ - Permission matrix
14
+ - UI wireframes
15
+ - Gherkin scenarios
16
+ </objective>
17
+
18
+ <ultrathink>
19
+ ULTRATHINK MODE - Specification:
20
+ - Each UC must be atomic and testable
21
+ - FR must trace back to BR
22
+ - Permissions must follow SmartStack convention
23
+ - No ambiguity in scenarios
24
+ </ultrathink>
25
+
26
+ ## EXECUTION SEQUENCE
27
+
28
+ ### 1. Read Current State
29
+
30
+ Read `{output_dir}/00-context.md` to restore state variables.
31
+ Read `{output_dir}/2-business-requirements.md` for business rules.
32
+
33
+ Update progress: `03-specify` -> "In Progress"
34
+
35
+ ---
36
+
37
+ ### 2. Load FRD Template
38
+
39
+ ```
40
+ Read: templates/frd-spec.md # ~150 lines (UC + FR + permissions sections)
41
+ ```
42
+
43
+ This template contains ONLY the FRD structure.
44
+
45
+ ---
46
+
47
+ ### 3. Define Actors and Permissions
48
+
49
+ From BRD stakeholders, map to system actors:
50
+
51
+ | Actor | Description | Permission base |
52
+ |-------|-------------|-----------------|
53
+ | Admin | Full access | `business.{app}.{module}.*` |
54
+ | Manager | Read + Create + Update | `business.{app}.{module}.read,create,update` |
55
+ | User | Read + Create | `business.{app}.{module}.read,create` |
56
+ | ReadOnly | View only | `business.{app}.{module}.read` |
57
+
58
+ **Permission format:** `business.{application_name}.{module_name}.{action}`
59
+
60
+ Actions:
61
+ - `.read` - View data
62
+ - `.create` - Create new entries
63
+ - `.update` - Modify existing
64
+ - `.delete` - Remove entries
65
+ - `.export` - Export data
66
+ - `.import` - Import data
67
+ - `.admin` - Administrative functions
68
+
69
+ ---
70
+
71
+ ### 4. Create Use Cases
72
+
73
+ For each major functionality, create UC:
74
+
75
+ ```markdown
76
+ ### UC-001: {Use Case Name}
77
+
78
+ | Attribute | Value |
79
+ |-----------|-------|
80
+ | **ID** | UC-001 |
81
+ | **Name** | {Name} |
82
+ | **Primary Actor** | {Role} |
83
+ | **Preconditions** | {required conditions} |
84
+ | **Postconditions** | {final state} |
85
+ | **Permission** | `business.{app}.{module}.{action}` |
86
+
87
+ **Main Scenario:**
88
+ 1. The user {action}
89
+ 2. The system {response}
90
+ 3. The user {action}
91
+ 4. The system {response}
92
+
93
+ **Alternative Scenarios:**
94
+
95
+ | # | Condition | Steps |
96
+ |---|-----------|-------|
97
+ | 3a | {condition} | 3a.1 {action}, 3a.2 {action} |
98
+
99
+ **Error Scenarios:**
100
+
101
+ | # | Error | Message | Action |
102
+ |---|-------|---------|--------|
103
+ | E1 | {error} | {user message} | {behavior} |
104
+
105
+ **Associated Rules:** BR-001, BR-002
106
+ ```
107
+
108
+ **ULTRATHINK checkpoint:**
109
+ - Each UC maps to at least one BR?
110
+ - All actors from BRD have UCs?
111
+ - Error scenarios complete?
112
+
113
+ ---
114
+
115
+ ### 5. Define Functional Requirements
116
+
117
+ For each BR, create corresponding FR:
118
+
119
+ | ID | Requirement | Linked UC | Priority |
120
+ |----|-------------|-----------|----------|
121
+ | FR-001 | The system MUST... | UC-001 | Must |
122
+ | FR-002 | The system SHOULD... | UC-001 | Should |
123
+ | FR-003 | The system COULD... | UC-002 | Could |
124
+
125
+ **Detailed FR specification:**
126
+
127
+ ```markdown
128
+ ### FR-001: {Requirement Name}
129
+
130
+ **Statement:** The system MUST {specific action}
131
+
132
+ **Acceptance Criteria:**
133
+ - [ ] {Measurable criterion 1}
134
+ - [ ] {Measurable criterion 2}
135
+ - [ ] {Measurable criterion 3}
136
+
137
+ **Associated Rules:** BR-001, BR-002
138
+ **Use Cases:** UC-001
139
+ ```
140
+
141
+ **Priority mapping:**
142
+ - Must = FR-0XX (000-099)
143
+ - Should = FR-1XX (100-199)
144
+ - Could = FR-2XX (200-299)
145
+
146
+ ---
147
+
148
+ ### 6. Design Permission Matrix
149
+
150
+ **Role-Permission Matrix:**
151
+
152
+ | Permission | Admin | Manager | User | ReadOnly |
153
+ |------------|-------|---------|------|----------|
154
+ | `business.{app}.{module}.read` | X | X | X | X |
155
+ | `business.{app}.{module}.create` | X | X | X | - |
156
+ | `business.{app}.{module}.update` | X | X | - | - |
157
+ | `business.{app}.{module}.delete` | X | - | - | - |
158
+ | `business.{app}.{module}.export` | X | X | - | - |
159
+
160
+ **Endpoint-Permission Mapping:**
161
+
162
+ | Endpoint | Method | Required Permission |
163
+ |----------|--------|-------------------|
164
+ | `/api/business/{module}` | GET | `.read` |
165
+ | `/api/business/{module}` | POST | `.create` |
166
+ | `/api/business/{module}/{id}` | GET | `.read` |
167
+ | `/api/business/{module}/{id}` | PUT | `.update` |
168
+ | `/api/business/{module}/{id}` | DELETE | `.delete` |
169
+
170
+ ---
171
+
172
+ ### 7. Create UI Wireframes
173
+
174
+ **Main screen wireframe:**
175
+
176
+ ```
177
+ ┌─────────────────────────────────────────────────────────────┐
178
+ │ [Logo] {Module Name} [User] [Menu] │
179
+ ├─────────────────────────────────────────────────────────────┤
180
+ │ │
181
+ │ ┌─────────────────────────────────────────────────────┐ │
182
+ │ │ FILTERS │ │
183
+ │ │ [Field 1 ▼] [Field 2 ▼] [Search] │ │
184
+ │ └─────────────────────────────────────────────────────┘ │
185
+ │ │
186
+ │ ┌─────────────────────────────────────────────────────┐ │
187
+ │ │ DATA TABLE │ │
188
+ │ │ ┌────────┬────────┬────────┬─────────┐ │ │
189
+ │ │ │ Col 1 │ Col 2 │ Col 3 │ Actions │ │ │
190
+ │ │ ├────────┼────────┼────────┼─────────┤ │ │
191
+ │ │ │ data │ data │ data │ [E] [D] │ │ │
192
+ │ │ └────────┴────────┴────────┴─────────┘ │ │
193
+ │ └─────────────────────────────────────────────────────┘ │
194
+ │ │
195
+ │ [+ New] (if .create) [< Prev] [Next >] │
196
+ └─────────────────────────────────────────────────────────────┘
197
+ ```
198
+
199
+ **UI Elements description:**
200
+
201
+ | Element | Type | Behavior | Permission |
202
+ |---------|------|----------|------------|
203
+ | [+ New] | Button | Opens create modal | `.create` |
204
+ | [E] | Icon | Opens edit modal | `.update` |
205
+ | [D] | Icon | Confirm + delete | `.delete` |
206
+
207
+ ---
208
+
209
+ ### 8. Write Gherkin Scenarios
210
+
211
+ ```gherkin
212
+ Feature: {feature_id} {feature_description}
213
+
214
+ Background:
215
+ Given the system is configured with test data
216
+ And the permission system is active
217
+
218
+ @permission @403
219
+ Scenario: User without permission cannot create
220
+ Given I am logged in as "user@test.com" with role "ReadOnly"
221
+ When I send POST to "/api/business/{module}"
222
+ Then the response status should be 403
223
+ And the response should contain "Permission denied"
224
+
225
+ @happy-path
226
+ Scenario: Admin creates new item
227
+ Given I am logged in as "admin@test.com" with role "Admin"
228
+ And I have permission "business.{app}.{module}.create"
229
+ When I send POST to "/api/business/{module}" with:
230
+ | field1 | value1 |
231
+ | field2 | value2 |
232
+ Then the response status should be 201
233
+ And the response should contain "id"
234
+
235
+ @validation
236
+ Scenario: Validation error on required field
237
+ Given I am logged in with permission "business.{app}.{module}.create"
238
+ When I send POST to "/api/business/{module}" with:
239
+ | field1 | |
240
+ Then the response status should be 400
241
+ And the response should contain "field1 is required"
242
+
243
+ @business-rule @BR-001
244
+ Scenario: {BR-001 scenario}
245
+ Given {precondition}
246
+ When {action}
247
+ Then {expected result per BR-001}
248
+ ```
249
+
250
+ ---
251
+
252
+ ### 9. Define Validations and Messages
253
+
254
+ **Field validations:**
255
+
256
+ | Field | Rule | Error Message (i18n key) |
257
+ |-------|------|--------------------------|
258
+ | {field} | Required | `{module}.errors.{field}Required` |
259
+ | {field} | MaxLength(100) | `{module}.errors.{field}TooLong` |
260
+ | email | Email format | `{module}.errors.invalidEmail` |
261
+
262
+ **System messages:**
263
+
264
+ | Code | Type | Message (i18n key) |
265
+ |------|------|-------------------|
266
+ | MSG-001 | Success | `{module}.messages.created` |
267
+ | MSG-002 | Success | `{module}.messages.updated` |
268
+ | MSG-003 | Success | `{module}.messages.deleted` |
269
+ | MSG-004 | Error | `{module}.errors.notFound` |
270
+ | MSG-005 | Error | `{module}.errors.permissionDenied` |
271
+
272
+ ---
273
+
274
+ ### 10. Compile FRD Document
275
+
276
+ Assemble complete FRD using template structure.
277
+
278
+ ---
279
+
280
+ ### 11. Save Output
281
+
282
+ Write to: `{output_dir}/3-functional-specification.md`
283
+
284
+ Update `00-context.md`:
285
+ - Progress: `03-specify` -> "Complete"
286
+ - Add UC count, FR count, permission count
287
+
288
+ ---
289
+
290
+ ### 12. Display Summary and Load Next Step
291
+
292
+ **Display:**
293
+ ```
294
+ SPECIFICATION - {feature_id}
295
+ ├── Status: Complete
296
+ ├── Use Cases: {UC count}
297
+ ├── Requirements: {FR count} (Must: X, Should: Y, Could: Z)
298
+ ├── Permissions: {permission count}
299
+ ├── Gherkin scenarios: {scenario count}
300
+ ├── Output: {output_dir}/3-functional-specification.md
301
+ └── Next: step-04-validate (Validation Gate)
302
+ ```
303
+
304
+ **Load next step:**
305
+ ```
306
+ Read and execute: steps/step-04-validate.md
307
+ ```
308
+
309
+ ---
310
+
311
+ ## OUTPUT
312
+
313
+ This step produces:
314
+ - `{output_dir}/3-functional-specification.md` (created)
315
+ - `{output_dir}/00-context.md` (updated)
316
+
317
+ Template loaded: **~150 lines** (vs 477 lines full file)