@atlashub/smartstack-cli 4.75.0 → 4.79.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 (81) hide show
  1. package/dist/index.js +87 -41
  2. package/dist/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/project/claude-md/root.CLAUDE.md.template +1 -1
  5. package/templates/skills/ai-prompt/SKILL.md +64 -0
  6. package/templates/skills/ai-prompt/references/ai-agent-modes.md +89 -0
  7. package/templates/skills/ai-prompt/references/eval-framework.md +129 -0
  8. package/templates/skills/apex/SKILL.md +2 -2
  9. package/templates/skills/apex/references/checks/frontend-checks.sh +123 -11
  10. package/templates/skills/apex/references/checks/seed-checks.sh +81 -7
  11. package/templates/skills/apex/references/core-seed-data.md +27 -22
  12. package/templates/skills/apex/references/domain-events-pattern.md +45 -0
  13. package/templates/skills/apex/references/entity-hooks-pattern.md +68 -0
  14. package/templates/skills/apex/references/licensing-enforcement.md +52 -0
  15. package/templates/skills/apex/references/post-checks.md +18 -1
  16. package/templates/skills/apex/references/smartstack-api.md +116 -5
  17. package/templates/skills/apex/references/smartstack-frontend.md +1 -1
  18. package/templates/skills/apex/references/smartstack-layers.md +6 -6
  19. package/templates/skills/apex/steps/step-00-init.md +1 -1
  20. package/templates/skills/apex/steps/step-03b-layer1-seed.md +26 -0
  21. package/templates/skills/apex/steps/step-03d-layer3-frontend.md +124 -2
  22. package/templates/skills/apex/steps/step-04-examine.md +163 -0
  23. package/templates/skills/apex-verify/SKILL.md +110 -0
  24. package/templates/skills/apex-verify/references/audit-rules.md +50 -0
  25. package/templates/skills/apex-verify/steps/step-00-init.md +119 -0
  26. package/templates/skills/apex-verify/steps/step-01-nav-audit.md +96 -0
  27. package/templates/skills/apex-verify/steps/step-02-crud-audit.md +127 -0
  28. package/templates/skills/apex-verify/steps/step-03-perm-audit.md +119 -0
  29. package/templates/skills/apex-verify/steps/step-04-route-audit.md +98 -0
  30. package/templates/skills/apex-verify/steps/step-05-report.md +110 -0
  31. package/templates/skills/application/references/contexts-cheatsheet.md +86 -0
  32. package/templates/skills/application/references/extensions-system.md +158 -0
  33. package/templates/skills/application/references/frontend-route-naming.md +7 -5
  34. package/templates/skills/application/references/frontend-verification.md +7 -5
  35. package/templates/skills/application/references/provider-template.md +4 -2
  36. package/templates/skills/application/references/smartstack-provider.md +118 -0
  37. package/templates/skills/application/references/themes-db-driven.md +484 -0
  38. package/templates/skills/application/templates-frontend.md +2 -2
  39. package/templates/skills/application/templates-seed.md +4 -2
  40. package/templates/skills/audit-route/references/routing-pattern.md +3 -1
  41. package/templates/skills/business-analyse/SKILL.md +3 -3
  42. package/templates/skills/business-analyse/_shared.md +37 -0
  43. package/templates/skills/business-analyse/react/components.md +30 -28
  44. package/templates/skills/business-analyse/references/03-json-schemas.md +11 -3
  45. package/templates/skills/business-analyse/references/03-post-check-validation.md +64 -0
  46. package/templates/skills/business-analyse/references/canonical-json-formats.md +7 -3
  47. package/templates/skills/business-analyse/references/robustness-checks.md +1 -1
  48. package/templates/skills/business-analyse/references/validation-checklist.md +5 -5
  49. package/templates/skills/business-analyse/schemas/sections/analysis-schema.json +15 -4
  50. package/templates/skills/business-analyse/steps/step-03-specify.md +162 -4
  51. package/templates/skills/business-analyse/steps/step-04-consolidate.md +211 -1
  52. package/templates/skills/business-analyse/templates-react.md +15 -15
  53. package/templates/skills/business-analyse-handoff/references/agent-handoff-transform-prompt.md +3 -0
  54. package/templates/skills/business-analyse-html/html/ba-interactive.html +198 -16
  55. package/templates/skills/business-analyse-html/html/src/scripts/01-data-init.js +64 -0
  56. package/templates/skills/business-analyse-html/html/src/scripts/05-render-specs.js +80 -11
  57. package/templates/skills/business-analyse-html/html/src/scripts/06-render-consolidation.js +2 -2
  58. package/templates/skills/business-analyse-html/html/src/scripts/06-render-mockups.js +6 -3
  59. package/templates/skills/business-analyse-html/html/src/scripts/12-render-diagrams.js +46 -0
  60. package/templates/skills/business-analyse-html/references/02-feature-data-building.md +4 -2
  61. package/templates/skills/business-analyse-html/references/data-build.md +2 -0
  62. package/templates/skills/business-analyse-html/references/data-mapping.md +88 -21
  63. package/templates/skills/business-analyse-html/steps/step-02-build-data.md +6 -0
  64. package/templates/skills/business-analyse-html/steps/step-04-verify.md +92 -3
  65. package/templates/skills/business-analyse-quick/SKILL.md +807 -0
  66. package/templates/skills/{sketch → business-analyse-quick}/references/domain-heuristics.md +59 -3
  67. package/templates/skills/business-analyse-quick/references/prd-schema.md +268 -0
  68. package/templates/skills/business-analyse-review/references/review-data-mapping.md +6 -0
  69. package/templates/skills/cli-app-sync/SKILL.md +105 -4
  70. package/templates/skills/cli-app-sync/references/comparison-map.md +13 -0
  71. package/templates/skills/cli-app-sync/references/diff-entities.md +162 -0
  72. package/templates/skills/dev-start/SKILL.md +7 -7
  73. package/templates/skills/documentation/templates.md +16 -16
  74. package/templates/skills/migrate/SKILL.md +312 -0
  75. package/templates/skills/migrate/references/v3.34-to-v3.46.md +289 -0
  76. package/templates/skills/sketch/SKILL.md +15 -153
  77. package/templates/skills/smoke-generation/SKILL.md +313 -0
  78. package/templates/skills/ui-components/SKILL.md +11 -1
  79. package/templates/skills/ui-components/patterns/data-table.md +1 -1
  80. package/templates/skills/ui-components/references/component-catalog.md +82 -0
  81. package/templates/skills/workflow/SKILL.md +70 -1
@@ -0,0 +1,289 @@
1
+ # Migration rules: v3.34 → v3.46
2
+
3
+ > Used by `/migrate --from=3.34 --to=3.46`.
4
+ > Covers the breaking changes shipped during the v3.46 alignment work
5
+ > (ApplicationZone removal, layout consolidation, NavigationApplication.Create
6
+ > signature change, Tailwind tokenisation, mergeRoutes deprecation, AI patterns).
7
+
8
+ ## Rule list (machine-readable)
9
+
10
+ ```yaml
11
+ rules:
12
+ # ──────────────────────────────────────────────────────────────────
13
+ # BACKEND — Domain / Seed / API
14
+ # ──────────────────────────────────────────────────────────────────
15
+
16
+ - id: R-BE-001
17
+ category: backend
18
+ description: "ApplicationZone enum and Zone column removed (replaced by IsPersonal + IsOpen flags on NavigationApplication)."
19
+ detect_pattern: 'ApplicationZone\.\w+|Zone\s*=\s*ApplicationZone\.\w+|public\s+ApplicationZone\s+Zone'
20
+ glob: "src/**/*.cs"
21
+ severity: BLOCKING
22
+ requires_confirmation: false
23
+ references:
24
+ - templates/skills/apex/references/core-seed-data.md
25
+ - templates/skills/application/references/provider-template.md
26
+ - templates/skills/apex/references/checks/seed-checks.sh # check C66 enforces this
27
+
28
+ - id: R-BE-002
29
+ category: backend
30
+ description: "NavigationApplication.Create() signature lost the first 'zone' parameter; gained isOpen + isPersonal at the end (both default false)."
31
+ detect_pattern: 'NavigationApplication\.Create\(\s*ApplicationZone\.\w+'
32
+ glob: "src/**/*.cs"
33
+ severity: BLOCKING
34
+ requires_confirmation: true # contextual — review each call site
35
+ references:
36
+ - D:/01 - projets/SmartStack.app/features/IA-Workflow/src/SmartStack.Domain/Navigation/NavigationApplication.cs
37
+
38
+ - id: R-BE-003
39
+ category: backend
40
+ description: "ApplicationMenuDto.Zone (string) field removed; consume IsPersonal + IsOpen instead."
41
+ detect_pattern: '\.Zone\b|"Zone"'
42
+ glob: "src/SmartStack.Application/Navigation/**/*.cs"
43
+ severity: BLOCKING
44
+ requires_confirmation: true
45
+
46
+ - id: R-BE-004
47
+ category: backend
48
+ description: "Migration to drop the 'Zone' column and add IsPersonal/IsOpen columns. Generate via dotnet ef if missing."
49
+ detect_pattern: 'Zone'
50
+ glob: "src/SmartStack.Infrastructure/Persistence/Migrations/*.cs"
51
+ severity: WARNING
52
+ requires_confirmation: true
53
+ note: "If the project's last migration is older than core_v3.46.0, prompt user to run /efcore:migration RemoveApplicationZone."
54
+
55
+ - id: R-BE-005
56
+ category: backend
57
+ description: "Domain Hooks moved to SmartStack.Application.Common.Interfaces.Hooks namespace (previously: scattered)."
58
+ detect_pattern: 'SmartStack\.(?:Domain|Application)\.(?!Common\.Interfaces\.Hooks)\w+\.(?:IBeforeCreate|IAfterCreate|IBeforeUpdate|IAfterUpdate|IBeforeDelete|IAfterDelete)'
59
+ glob: "src/**/*.cs"
60
+ severity: WARNING
61
+ requires_confirmation: false
62
+ references:
63
+ - templates/skills/apex/references/smartstack-api.md # Entity Lifecycle Hooks section
64
+
65
+ - id: R-BE-006
66
+ category: backend
67
+ description: "BaseEntity gained an ExtensionData (string JSON) property + 7 typed methods. EF configuration must include builder.Property(x => x.ExtensionData).HasColumnType(\"nvarchar(max)\").HasDefaultValue(\"{}\")."
68
+ detect_pattern: 'class\s+\w+Configuration\s*:\s*IEntityTypeConfiguration<\w+>'
69
+ glob: "src/SmartStack.Infrastructure/Persistence/Configurations/**/*.cs"
70
+ severity: WARNING
71
+ requires_confirmation: true
72
+ note: "Inspect each EF config file; only add the ExtensionData mapping where the entity inherits BaseEntity AND the table is meant to store extension data."
73
+
74
+ # ──────────────────────────────────────────────────────────────────
75
+ # FRONTEND — Layouts / Routing / Theme
76
+ # ──────────────────────────────────────────────────────────────────
77
+
78
+ - id: R-FE-001
79
+ category: frontend
80
+ description: "Legacy domain-specific layouts (AdminLayout / BusinessLayout / UserLayout / HRLayout / SalesLayout) consolidated into AppLayout (sole authenticated shell)."
81
+ detect_pattern: '<\s*(AdminLayout|BusinessLayout|UserLayout|HRLayout|SalesLayout)\b|from\s+["\x27][^"\x27]*\/(AdminLayout|BusinessLayout|UserLayout|HRLayout|SalesLayout)["\x27]'
82
+ glob: "web/**/*.tsx"
83
+ severity: BLOCKING
84
+ requires_confirmation: false
85
+ references:
86
+ - templates/skills/application/references/frontend-route-naming.md
87
+ - templates/skills/apex/references/checks/seed-checks.sh # check C67
88
+
89
+ - id: R-FE-002
90
+ category: frontend
91
+ description: "Hardcoded Tailwind colors must be replaced by CSS variables. Mapping table in themes-db-driven.md (24 rows: bg-blue-* → var(--info-bg), text-gray-900 → var(--text-primary), etc.)."
92
+ detect_pattern: '(bg|text|border)-(?!\[)(red|blue|green|gray|amber|yellow|orange|purple|indigo|violet|cyan|pink|emerald|rose|sky|teal|lime|fuchsia|stone|slate|zinc|neutral)-\d'
93
+ glob: "web/**/*.tsx"
94
+ severity: WARNING # was BLOCKING in iteration 2 — but for a migration we relax to WARNING and let the user batch-fix
95
+ requires_confirmation: true
96
+ references:
97
+ - templates/skills/application/references/themes-db-driven.md # Section 5: Migration map
98
+ - templates/skills/apex/references/checks/frontend-checks.sh # check C9
99
+
100
+ - id: R-FE-003
101
+ category: frontend
102
+ description: "Tailwind dark: prefix removed. SmartStack toggles a .dark class on root; CSS vars adapt automatically."
103
+ detect_pattern: '\bdark:(bg|text|border)-'
104
+ glob: "web/**/*.tsx"
105
+ severity: WARNING
106
+ requires_confirmation: false
107
+
108
+ - id: R-FE-004
109
+ category: frontend
110
+ description: "mergeRoutes() and getStaticAppRoutes() removed in v3.7+. Pages must register via PageRegistry.register() in componentRegistry.generated.ts."
111
+ detect_pattern: 'mergeRoutes\s*\(|getStaticAppRoutes\s*\('
112
+ glob: "web/**/*.{ts,tsx}"
113
+ severity: BLOCKING
114
+ requires_confirmation: true
115
+ references:
116
+ - templates/skills/audit-route/references/routing-pattern.md
117
+ - templates/skills/application/references/smartstack-provider.md
118
+
119
+ - id: R-FE-005
120
+ category: frontend
121
+ description: "RouteGuard.tsx replaced by ProtectedRoute.tsx (API-driven permissions)."
122
+ detect_pattern: 'RouteGuard|from\s+["\x27][^"\x27]*\/RouteGuard["\x27]'
123
+ glob: "web/**/*.{ts,tsx}"
124
+ severity: BLOCKING
125
+ requires_confirmation: false
126
+
127
+ - id: R-FE-006
128
+ category: frontend
129
+ description: "useParams must use generic { id: string } (not custom names like { ticketId, userId }). Custom names go in the destructuration."
130
+ detect_pattern: 'useParams<\{\s*(?!id\s*:)\w+Id\s*:'
131
+ glob: "web/**/*.tsx"
132
+ severity: WARNING
133
+ requires_confirmation: true
134
+ note: "Refactor: const { id: ticketId } = useParams<{ id: string }>(). Param URL must be 'id' for DynamicRouter."
135
+
136
+ - id: R-FE-007
137
+ category: frontend
138
+ description: "Client App.tsx must wrap with <SmartStackProvider config={...}> (replaces ad-hoc provider stacks)."
139
+ detect_pattern: 'AuthProvider|TenantProvider|ThemeProvider' # if present in App.tsx without SmartStackProvider above
140
+ glob: "web/**/{App,main}.tsx"
141
+ severity: WARNING
142
+ requires_confirmation: true
143
+ references:
144
+ - templates/skills/application/references/smartstack-provider.md
145
+
146
+ # ──────────────────────────────────────────────────────────────────
147
+ # SEED — Navigation & Roles
148
+ # ──────────────────────────────────────────────────────────────────
149
+
150
+ - id: R-SEED-001
151
+ category: seed
152
+ description: "NavigationApplicationSeedEntry must include IsPersonal + IsOpen (both bool, default false). Replaces the Zone field."
153
+ detect_pattern: 'NavigationApplicationSeedEntry'
154
+ glob: "src/**/*NavigationApplicationSeedData.cs"
155
+ severity: BLOCKING
156
+ requires_confirmation: false
157
+
158
+ - id: R-SEED-002
159
+ category: seed
160
+ description: "MySpace and Personal-scope apps should set IsPersonal = true."
161
+ detect_pattern: 'NavigationApplicationSeedEntry'
162
+ glob: "src/**/*MySpace*SeedData.cs"
163
+ severity: WARNING
164
+ requires_confirmation: true
165
+ note: "Manual judgement: only set IsPersonal=true on apps that genuinely belong to user space."
166
+
167
+ # ──────────────────────────────────────────────────────────────────
168
+ # CONFIG — appsettings / package.json
169
+ # ──────────────────────────────────────────────────────────────────
170
+
171
+ - id: R-CFG-001
172
+ category: config
173
+ description: "@atlashub/smartstack peer must be at least 3.46.0."
174
+ detect_pattern: '"@atlashub/smartstack":\s*"\^?[0-2]\.|^"@atlashub/smartstack":\s*"\^?3\.[0-3][0-9]\.|^"@atlashub/smartstack":\s*"\^?3\.4[0-5]\.'
175
+ glob: "web/smartstack-web/package.json"
176
+ severity: BLOCKING
177
+ requires_confirmation: false
178
+ note: "Bump @atlashub/smartstack to ^3.46.0 (or latest)."
179
+
180
+ - id: R-CFG-002
181
+ category: config
182
+ description: "Tailwind v4 + @tailwindcss/vite required. Old @tailwindcss/postcss configuration deprecated."
183
+ detect_pattern: '"@tailwindcss/postcss"'
184
+ glob: "web/smartstack-web/package.json"
185
+ severity: WARNING
186
+ requires_confirmation: false
187
+ note: "Install @tailwindcss/vite, remove @tailwindcss/postcss, update vite.config.ts plugins list."
188
+
189
+ - id: R-CFG-003
190
+ category: config
191
+ description: "appsettings.json should include the new sections : SlaMonitoring, SolutionAutoClose, AutoAssignment, WorkflowExecution (added in v3.45/v3.46)."
192
+ detect_pattern: '^\s*"(?:Logging|Email)\s*"'
193
+ glob: "src/SmartStack.Api/appsettings.json"
194
+ severity: WARNING
195
+ requires_confirmation: true
196
+ note: "Compare against templates/project/appsettings.json.template ; add missing sections (defaults are safe)."
197
+ ```
198
+
199
+ ## Implementation recipes
200
+
201
+ The rules above are declarative ; some need a step-by-step recipe when a single regex isn't enough. The skill's `--apply` mode falls back to these recipes for any rule with `requires_confirmation: true`.
202
+
203
+ ### R-BE-001 — `ApplicationZone` removal
204
+
205
+ For each file matched :
206
+
207
+ 1. Remove every line that matches `^\s*Zone\s*=\s*ApplicationZone\.\w+,?\s*$`
208
+ 2. After the line `Id = ApplicationId,` (or the first property of the SeedEntry), insert :
209
+ ```
210
+ IsPersonal = false,
211
+ IsOpen = false,
212
+ ```
213
+ 3. Replace `public ApplicationZone Zone { get; init; }` (DTO) by :
214
+ ```csharp
215
+ public bool IsPersonal { get; init; }
216
+ public bool IsOpen { get; init; }
217
+ ```
218
+ 4. Remove `using` directives for `SmartStack.Domain.Navigation` if `ApplicationZone` was the only reason they were imported.
219
+
220
+ ### R-BE-002 — `NavigationApplication.Create()` signature
221
+
222
+ For each call site :
223
+
224
+ - Old signature : `NavigationApplication.Create(ApplicationZone.X, code, label, description, icon, iconType, route, displayOrder)`
225
+ - New signature : `NavigationApplication.Create(code, label, description, icon, iconType, route, displayOrder, isOpen: bool, isPersonal: bool)`
226
+
227
+ **Recipe** :
228
+ 1. Remove the first argument (`ApplicationZone.X`).
229
+ 2. Append two named arguments at the end : `isOpen: false, isPersonal: false` (or `true` based on context — see R-SEED-002).
230
+ 3. **Manual review** : if the original call passed `Personal` zone, propose `isPersonal: true`. If `Admin` zone (system app), propose `isOpen: true`.
231
+
232
+ ### R-FE-001 — Layout consolidation
233
+
234
+ For each `.tsx` file containing `<AdminLayout>`, `<BusinessLayout>`, `<UserLayout>`, `<HRLayout>`, or `<SalesLayout>` :
235
+
236
+ 1. Replace the JSX tag (open + close) by `<AppLayout>` / `</AppLayout>`.
237
+ 2. Update the import : `import { AppLayout } from '@/layouts/AppLayout'`.
238
+ 3. Remove the old import line.
239
+
240
+ If the file was `src/layouts/AdminLayout.tsx` (or similar), DELETE the file — it no longer has a purpose.
241
+
242
+ ### R-FE-002 — Tailwind tokenisation
243
+
244
+ This rule is **bulk** but **noisy**. Apply only if the user accepts (default WARNING in migration ; was BLOCKING in iteration 2).
245
+
246
+ Use the migration map in `templates/skills/application/references/themes-db-driven.md` Section 5. For each `(bg|text|border)-{color}-{shade}` occurrence, propose the canonical CSS-var replacement based on context :
247
+ - Status badges (success/warning/error/info) → `var(--{status}-bg)` / `var(--{status}-text)` / `var(--{status}-border)`
248
+ - Action buttons → `var(--color-accent-600)` / `hover:bg-[var(--color-accent-700)]`
249
+ - Body text → `var(--text-primary)` / `var(--text-secondary)`
250
+ - Card backgrounds → `var(--bg-card)`
251
+ - Borders → `var(--border-color)`
252
+
253
+ When the context is ambiguous (e.g. random `bg-blue-100`), prompt for the intent (info badge ? accent ? branding ?) and apply accordingly.
254
+
255
+ ### R-FE-004 — `mergeRoutes` / `getStaticAppRoutes` removal
256
+
257
+ These calls usually live in `src/main.tsx` or `src/App.tsx`. Recipe :
258
+
259
+ 1. Open the file.
260
+ 2. Find the call to `mergeRoutes(...)` or `getStaticAppRoutes(...)`.
261
+ 3. For each route registered :
262
+ - Convert to `PageRegistry.register('module.section', lazy(() => import(...)))`
263
+ - Place those calls in `src/extensions/componentRegistry.generated.ts` (create the file if missing).
264
+ 4. Remove the original `mergeRoutes` call ; remove its imports.
265
+ 5. Ensure `main.tsx` imports `./extensions/componentRegistry.generated` early (before render).
266
+
267
+ This is a refactor — the skill SHOULD prompt the user to confirm and provide a diff preview.
268
+
269
+ ### R-CFG-002 — Tailwind v4 migration
270
+
271
+ ```bash
272
+ # Inside web/smartstack-web/
273
+ npm uninstall @tailwindcss/postcss
274
+ npm install --save-dev @tailwindcss/vite
275
+
276
+ # Edit vite.config.ts:
277
+ # + import tailwindcss from '@tailwindcss/vite';
278
+ # + plugins: [react(), tailwindcss()],
279
+
280
+ # Edit index.css to use the new @theme {} syntax (see themes-db-driven.md Section 3.3)
281
+ ```
282
+
283
+ The skill prompts and applies one step at a time, since these touch different files.
284
+
285
+ ## Notes
286
+
287
+ - This rule file is the single source of truth for `v3.34 → v3.46`. Add new rules here as breaking changes are discovered.
288
+ - For future migrations (e.g. `v3.46 → v3.47`), create `references/v3.46-to-v3.47.md` and register it in the SKILL.md mapping table.
289
+ - Always run with `--dry-run` first. Always commit before `--apply`.
@@ -1,172 +1,34 @@
1
1
  ---
2
2
  name: sketch
3
3
  description: |
4
- Transform a vague idea into a precise /apex command in under 5 minutes.
5
- Use this skill when:
6
- - User has a vague idea ("I want an HR app with employees and absences")
7
- - User doesn't know the exact entities, fields, or structure needed
8
- - User needs help designing a module before running /apex
9
- Zero MCP, zero file generation — pure domain inference.
10
- model: opus
11
- argument-hint: "<vague idea in natural language>"
4
+ DEPRECATED Redirects to /business-analyse-quick.
5
+ Use /business-analyse-quick instead for Mini-BA with PRD generation.
6
+ model: sonnet
7
+ argument-hint: "<use /business-analyse-quick instead>"
12
8
  ---
13
9
 
14
10
  <objective>
15
- Transform a vague user prompt into a precise, ready-to-run /apex command. /sketch is a rapid design assistant — it infers entities, properties, relationships, labels, and code patterns from minimal input using domain heuristics and LLM knowledge.
16
-
17
- **Key principles:**
18
- - MAX 2 questions total (1 subject guard + 1 optional confirmation)
19
- - Zero MCP calls — pure inference (validation is /apex's job)
20
- - Zero file generation — output is text in conversation only
21
- - Domain heuristics ACCELERATE inference, they do NOT limit it
11
+ This skill has been renamed to `/business-analyse-quick`. Redirect the user.
22
12
  </objective>
23
13
 
24
- <quick_start>
25
-
26
- ```bash
27
- /sketch une app RH avec employés et absences
28
- /sketch I want to manage customer orders and invoices
29
- /sketch gestion de projets avec tâches et jalons
30
- /sketch stock management
31
- ```
32
-
33
- </quick_start>
34
-
35
- <anti_patterns>
36
- - DO NOT ask more than 2 questions total
37
- - DO NOT generate any files (no JSON, no code, no documents)
38
- - DO NOT call any MCP tools (validation is /apex's job)
39
- - DO NOT scan the entire codebase (max 1 Glob for app detection)
40
- - DO NOT duplicate business analysis logic (no stakeholders, risks, use cases)
41
- - DO NOT output structured syntax — /apex parses natural language, not custom formats
42
- - DO NOT call Skill("apex") directly — instruct the agent to do it based on user choice
43
- </anti_patterns>
44
-
45
14
  <algorithm>
46
15
 
47
- ## 1. SUBJECT GUARD
48
-
49
- Check if the user prompt contains at least one identifiable business object (noun that could be an entity: employees, orders, projects, invoices, etc.).
50
-
51
- ```
52
- IF no business object identifiable in prompt:
53
- → AskUserQuestion: "What do you want to manage? (e.g., employees, orders, projects, invoices...)"
54
- → Wait for answer, then continue to step 2
55
- → This is the ONLY mandatory question
56
- ```
57
-
58
- ## 2. LOAD DOMAIN HEURISTICS
59
-
60
- Read `references/domain-heuristics.md` — domain pattern table with entities, properties, FK relationships, and i18n labels for 15 common business domains.
61
-
62
- ## 3. ULTRA THINK — Domain Inference
63
-
64
- **ULTRA THINK deeply about the user's domain before proceeding.**
65
-
66
- From the user prompt + domain heuristics table:
67
-
68
- 1. **Extract keywords** from user prompt (nouns, domain terms, action verbs)
69
- 2. **Match against heuristics table** — find the closest domain pattern(s)
70
- 3. **If no match:** use general LLM knowledge (the table accelerates, it does NOT limit)
71
- 4. **Infer entities:** name, key properties, types, nullable flags
72
- 5. **Infer FK relationships:** between entities (EmployeeId→Employee, etc.)
73
- 6. **Infer sections:** 1 section per main entity, code = plural kebab-case (e.g., "employees")
74
- 7. **Infer i18n labels** in 4 languages (fr, en, it, de) — from table or LLM knowledge
75
- 8. **Deduce code_patterns:** strategy = "sequential" by default, prefix = first 3 letters of entity name
76
- 9. **Deduce tenantMode:** "strict" by default (multi-tenant)
77
- 10. **Deduce complexity:**
78
- - `simple-crud` if ≤ 2 entities with no workflow/status transitions
79
- - `crud-rules` otherwise (validations, computed fields, status)
80
- - `crud-workflow` if mentions approval, email, notification
81
- - `complex` if > 4 entities with specific business logic
82
-
83
- ## 4. DETECT EXISTING APPLICATION
84
-
16
+ Display:
85
17
  ```
86
- Glob("**/NavigationApplicationSeedData.cs") ← single scan, MAX 1
18
+ ═══════════════════════════════════════════════════════════
19
+ /sketch has been renamed to /business-analyse-quick
20
+ ═══════════════════════════════════════════════════════════
87
21
 
88
- IF files found:
89
- Extract application names from seed data classes
90
- Check if the inferred module fits an existing application
91
- If multiple apps match: flag as ambiguity for step 5
92
-
93
- IF no files found:
94
- → New application — infer name from domain
95
- → app_name = domain-appropriate PascalCase name (e.g., "HumanResources")
22
+ /business-analyse-quick provides:
23
+ - Interactive Mini-BA (12-15 questions)
24
+ - Structured Mini-PRD output for /apex -d
25
+ - Entity, rules, use cases, permissions, screens specs
96
26
  ```
97
27
 
98
- ## 5. CONFIRMATION GATE MAX 1 optional question
28
+ Then immediately invoke the new skill with the user's original arguments:
99
29
 
100
30
  ```
101
- IF real ambiguity exists (multiple matching apps, genuinely ambiguous domain):
102
- → AskUserQuestion with specific options to resolve the ambiguity
103
- → This is the ONLY optional question
104
-
105
- IF no ambiguity:
106
- → Zero questions — proceed directly to output
31
+ Skill("business-analyse-quick", args: "{original user arguments}")
107
32
  ```
108
33
 
109
- ## 6. OUTPUT — Display result and choices
110
-
111
- Display the design summary and generated /apex prompt using the exact format below.
112
-
113
34
  </algorithm>
114
-
115
- <output_format>
116
-
117
- ```
118
- ══════════════════════════════════════════════════════════
119
- /sketch — Module Design Complete
120
- ══════════════════════════════════════════════════════════
121
-
122
- Application: {app_name}
123
- Module: {module_code}
124
- Sections: {section1_code} ({fr_label}/{en_label}/{it_label}/{de_label})
125
- {section2_code} ({fr_label}/{en_label}/{it_label}/{de_label})
126
- Entities: {Entity1} ({prop1}:{type}, {prop2}:{type}, {fk}:{type} FK→{Target})
127
- {Entity2} ({prop1}:{type}, {prop2}:{type}, {fk}:{type} FK→{Target})
128
- Complexity: {complexity}
129
- Code: {Entity1} → {prefix}-{tenant}-00001 | {Entity2} → {prefix}-{tenant}-00001
130
-
131
- Ready to run:
132
- ──────────────────────────────────────────────────────
133
- /apex add {sections} sections to {app_name} module with
134
- {Entity1} entity ({properties with types and FKs}) and
135
- {Entity2} entity ({properties with types and FKs}),
136
- code patterns sequential {prefixes}, complexity {complexity}
137
- ──────────────────────────────────────────────────────
138
-
139
- [1] Run this /apex command now
140
- [2] Edit before running
141
- [3] Cancel
142
- ```
143
-
144
- **Rules for the generated /apex prompt:**
145
- - Natural language, dense but readable
146
- - Include ALL entities with their key properties and types
147
- - Include FK relationships explicitly (e.g., "EmployeeId:Guid FK→Employee")
148
- - Include code pattern prefixes
149
- - Include complexity level
150
- - Mention the target application name
151
-
152
- </output_format>
153
-
154
- <handoff>
155
-
156
- Based on user selection:
157
-
158
- ```
159
- IF user selects [1]:
160
- → Call: Skill("apex", args: "{the generated prompt text}")
161
-
162
- IF user selects [2]:
163
- → Display the generated prompt for the user to edit
164
- → Wait for edited version
165
- → Re-display choices [1] Run / [3] Cancel
166
-
167
- IF user selects [3]:
168
- → Display: "Cancelled. Run /sketch again when ready."
169
- → STOP
170
- ```
171
-
172
- </handoff>