@atlashub/smartstack-cli 3.8.0 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/index.js +365 -2
  2. package/dist/index.js.map +1 -1
  3. package/package.json +2 -1
  4. package/templates/agents/action.md +1 -0
  5. package/templates/agents/ba-writer.md +33 -0
  6. package/templates/agents/explore-codebase.md +1 -0
  7. package/templates/agents/explore-docs.md +1 -0
  8. package/templates/agents/fix-grammar.md +1 -0
  9. package/templates/agents/snipper.md +1 -0
  10. package/templates/skills/admin/SKILL.md +6 -0
  11. package/templates/skills/ai-prompt/SKILL.md +32 -136
  12. package/templates/skills/ai-prompt/steps/step-01-implementation.md +122 -0
  13. package/templates/skills/apex/SKILL.md +120 -0
  14. package/templates/skills/apex/_shared.md +86 -0
  15. package/templates/skills/apex/references/agent-teams-protocol.md +164 -0
  16. package/templates/skills/apex/references/smartstack-layers.md +173 -0
  17. package/templates/skills/apex/steps/step-00-init.md +156 -0
  18. package/templates/skills/apex/steps/step-01-analyze.md +169 -0
  19. package/templates/skills/apex/steps/step-02-plan.md +160 -0
  20. package/templates/skills/apex/steps/step-03-execute.md +166 -0
  21. package/templates/skills/apex/steps/step-04-validate.md +138 -0
  22. package/templates/skills/apex/steps/step-05-examine.md +124 -0
  23. package/templates/skills/apex/steps/step-06-resolve.md +105 -0
  24. package/templates/skills/apex/steps/step-07-tests.md +130 -0
  25. package/templates/skills/apex/steps/step-08-run-tests.md +115 -0
  26. package/templates/skills/application/SKILL.md +10 -0
  27. package/templates/skills/application/references/backend-controller-hierarchy.md +58 -0
  28. package/templates/skills/application/references/backend-entity-seeding.md +72 -0
  29. package/templates/skills/application/references/backend-verification.md +88 -0
  30. package/templates/skills/application/references/frontend-verification.md +111 -0
  31. package/templates/skills/application/references/nav-fallback-procedure.md +200 -0
  32. package/templates/skills/application/references/provider-template.md +134 -0
  33. package/templates/skills/application/references/test-frontend.md +73 -0
  34. package/templates/skills/application/references/test-prerequisites.md +72 -0
  35. package/templates/skills/application/steps/step-01-navigation.md +7 -198
  36. package/templates/skills/application/steps/step-03b-provider.md +4 -128
  37. package/templates/skills/application/steps/step-04-backend.md +20 -350
  38. package/templates/skills/application/steps/step-05-frontend.md +12 -101
  39. package/templates/skills/application/steps/step-07-tests.md +12 -132
  40. package/templates/skills/business-analyse/SKILL.md +11 -2
  41. package/templates/skills/business-analyse/html/ba-interactive.html +176 -14
  42. package/templates/skills/business-analyse/html/src/scripts/01-data-init.js +1 -0
  43. package/templates/skills/business-analyse/html/src/scripts/05-render-specs.js +16 -4
  44. package/templates/skills/business-analyse/html/src/scripts/06-render-consolidation.js +7 -2
  45. package/templates/skills/business-analyse/html/src/scripts/09-export.js +103 -0
  46. package/templates/skills/business-analyse/html/src/scripts/10-comments.js +12 -6
  47. package/templates/skills/business-analyse/html/src/scripts/11-review-panel.js +24 -2
  48. package/templates/skills/business-analyse/html/src/styles/08-review-panel.css +12 -0
  49. package/templates/skills/business-analyse/html/src/template.html +1 -0
  50. package/templates/skills/business-analyse/references/cadrage-structure-cards.md +78 -0
  51. package/templates/skills/business-analyse/references/cadrage-vibe-coding.md +97 -0
  52. package/templates/skills/business-analyse/references/consolidation-structural-checks.md +92 -0
  53. package/templates/skills/business-analyse/references/deploy-data-build.md +121 -0
  54. package/templates/skills/business-analyse/references/deploy-modes.md +49 -0
  55. package/templates/skills/business-analyse/references/handoff-file-templates.md +119 -0
  56. package/templates/skills/business-analyse/references/handoff-mappings.md +81 -0
  57. package/templates/skills/business-analyse/references/html-data-mapping.md +10 -2
  58. package/templates/skills/business-analyse/references/init-schema-deployment.md +65 -0
  59. package/templates/skills/business-analyse/references/review-data-mapping.md +363 -0
  60. package/templates/skills/business-analyse/references/spec-auto-inference.md +57 -0
  61. package/templates/skills/business-analyse/references/ui-dashboard-spec.md +85 -0
  62. package/templates/skills/business-analyse/references/ui-resource-cards.md +110 -0
  63. package/templates/skills/business-analyse/references/validate-incremental-html.md +55 -0
  64. package/templates/skills/business-analyse/steps/step-00-init.md +35 -68
  65. package/templates/skills/business-analyse/steps/step-01-cadrage.md +5 -194
  66. package/templates/skills/business-analyse/steps/step-03a-data.md +6 -49
  67. package/templates/skills/business-analyse/steps/step-03b-ui.md +12 -178
  68. package/templates/skills/business-analyse/steps/step-03d-validate.md +3 -48
  69. package/templates/skills/business-analyse/steps/step-04-consolidation.md +9 -104
  70. package/templates/skills/business-analyse/steps/step-05a-handoff.md +25 -441
  71. package/templates/skills/business-analyse/steps/step-05b-deploy.md +19 -187
  72. package/templates/skills/business-analyse/steps/step-06-review.md +277 -0
  73. package/templates/skills/cc-agent/references/agent-behavior-patterns.md +95 -0
  74. package/templates/skills/cc-agent/steps/step-02-generate.md +5 -78
  75. package/templates/skills/check-version/SKILL.md +7 -0
  76. package/templates/skills/controller/references/controller-code-templates.md +159 -0
  77. package/templates/skills/controller/references/permission-sync-templates.md +152 -0
  78. package/templates/skills/controller/steps/step-03-generate.md +6 -158
  79. package/templates/skills/controller/steps/step-04-perms.md +5 -144
  80. package/templates/skills/debug/SKILL.md +7 -0
  81. package/templates/skills/explore/SKILL.md +6 -0
  82. package/templates/skills/feature-full/SKILL.md +39 -142
  83. package/templates/skills/feature-full/steps/step-01-implementation.md +120 -0
  84. package/templates/skills/gitflow/references/init-config-template.md +135 -0
  85. package/templates/skills/gitflow/references/init-name-normalization.md +103 -0
  86. package/templates/skills/gitflow/references/plan-template.md +69 -0
  87. package/templates/skills/gitflow/references/start-efcore-preflight.md +70 -0
  88. package/templates/skills/gitflow/references/start-local-config.md +110 -0
  89. package/templates/skills/gitflow/steps/step-init.md +18 -289
  90. package/templates/skills/gitflow/steps/step-plan.md +6 -63
  91. package/templates/skills/gitflow/steps/step-start.md +16 -126
  92. package/templates/skills/mcp/SKILL.md +9 -213
  93. package/templates/skills/mcp/steps/step-01-healthcheck.md +108 -0
  94. package/templates/skills/mcp/steps/step-02-tools.md +73 -0
  95. package/templates/skills/notification/SKILL.md +7 -0
  96. package/templates/skills/quick-search/SKILL.md +5 -0
  97. package/templates/skills/ralph-loop/SKILL.md +99 -381
  98. package/templates/skills/ralph-loop/references/category-rules.md +259 -0
  99. package/templates/skills/ralph-loop/references/compact-loop.md +182 -0
  100. package/templates/skills/ralph-loop/references/task-transform-legacy.md +259 -0
  101. package/templates/skills/ralph-loop/references/team-orchestration.md +189 -0
  102. package/templates/skills/ralph-loop/steps/step-00-init.md +111 -383
  103. package/templates/skills/ralph-loop/steps/step-01-task.md +79 -896
  104. package/templates/skills/ralph-loop/steps/step-02-execute.md +68 -680
  105. package/templates/skills/ralph-loop/steps/step-03-commit.md +47 -277
  106. package/templates/skills/ralph-loop/steps/step-04-check.md +124 -607
  107. package/templates/skills/ralph-loop/steps/step-05-report.md +68 -367
  108. package/templates/skills/refactor/SKILL.md +12 -176
  109. package/templates/skills/refactor/steps/step-01-discover.md +60 -0
  110. package/templates/skills/refactor/steps/step-02-execute.md +67 -0
  111. package/templates/skills/review-code/SKILL.md +19 -257
  112. package/templates/skills/review-code/steps/step-01-smartstack.md +96 -0
  113. package/templates/skills/review-code/steps/step-02-detailed-review.md +80 -0
  114. package/templates/skills/review-code/steps/step-03-react.md +44 -0
  115. package/templates/skills/ui-components/SKILL.md +7 -0
  116. package/templates/skills/utils/SKILL.md +6 -0
  117. package/templates/skills/validate/SKILL.md +6 -0
  118. package/templates/skills/validate-feature/SKILL.md +8 -0
  119. package/templates/skills/workflow/SKILL.md +40 -118
  120. package/templates/skills/workflow/steps/step-01-implementation.md +84 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlashub/smartstack-cli",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "SmartStack Claude Code automation toolkit - GitFlow, EF Core migrations, prompts and more",
5
5
  "author": {
6
6
  "name": "SmartStack",
@@ -80,6 +80,7 @@
80
80
  "test:all": "npm run test:mcp && npm run test:ba"
81
81
  },
82
82
  "dependencies": {
83
+ "@atlashub/smartstack-cli": "file:../02-Develop",
83
84
  "@modelcontextprotocol/sdk": "^1.0.0",
84
85
  "axios": "^1.7.0",
85
86
  "bcryptjs": "^2.4.3",
@@ -3,6 +3,7 @@ name: action
3
3
  description: Conditional action executor - performs actions only when specific conditions are met
4
4
  color: purple
5
5
  model: haiku
6
+ tools: Read, Glob, Grep, Bash
6
7
  ---
7
8
 
8
9
  Batch conditional executor. Handle ≤5 tasks. VERIFY INDEPENDENTLY before each action.
@@ -203,6 +203,39 @@ Create a new version for refactoring or major changes.
203
203
  6. Append changelog entry with old and new versions
204
204
  7. Return paths of both versions
205
205
 
206
+ ### applyReview
207
+ Apply corrections from a ba-review.json export to create a new version of the analysis.
208
+
209
+ **Input:**
210
+ - featureId: FEAT-NNN of the existing application
211
+ - reviewData: parsed content of ba-review.json (with `_reviewMeta` envelope)
212
+
213
+ **Process:**
214
+ 1. Validate `reviewData._reviewMeta` has `sourceVersion` and `sourceApplicationId`
215
+ 2. Determine version bump:
216
+ - If `_reviewMeta.changeSummary.modulesAdded.length > 0` OR `modulesRemoved.length > 0`: major bump (v1.0 → v2.0)
217
+ - Otherwise: minor bump (v1.0 → v1.1)
218
+ 3. Call `createVersion(featureId, "Review corrections applied")`
219
+ 4. Read the new version's master feature.json
220
+ 5. Apply reverse mapping from review data to feature.json (see `references/review-data-mapping.md`):
221
+ - `reviewData.cadrage.scope.vital[]` → `cadrage.globalScope.mustHave[]`
222
+ - `reviewData.cadrage.scope.important[]` → `cadrage.globalScope.shouldHave[]`
223
+ - `reviewData.cadrage.scope.optional[]` → `cadrage.globalScope.couldHave[]`
224
+ - `reviewData.cadrage.scope.excluded[]` → `cadrage.globalScope.outOfScope[]`
225
+ - `reviewData.cadrage.stakeholders[]` → reverse-map access/frequency back to involvement/frequency
226
+ - `reviewData.cadrage.risks[]` → `cadrage.risks[]`
227
+ - `reviewData.modules[]` → update `modules[]` (add/remove/modify)
228
+ 6. For each module in `reviewData.moduleSpecifications`:
229
+ - Reverse-map useCases, businessRules, entities, permissions back to module feature.json
230
+ 7. Preserve review comments in a new `review` section of the master feature.json:
231
+ - `review.comments`: all inline comments from `reviewData.comments`
232
+ - `review.specComments`: text comments from `reviewData.specComments`
233
+ - `review.wireframeComments`: wireframe feedback from `reviewData.wireframeComments`
234
+ - `review.appliedAt`: ISO timestamp
235
+ 8. Update metadata.updatedAt
236
+ 9. Write the updated feature.json
237
+ 10. Return confirmation with: new version path, changes applied count, comments preserved count
238
+
206
239
  ## Schema Validation Rules
207
240
 
208
241
  Perform these structural checks before every write:
@@ -3,6 +3,7 @@ name: explore-codebase
3
3
  description: Use this agent whenever you need to explore the codebase to implement a feature.
4
4
  color: yellow
5
5
  model: haiku
6
+ tools: Read, Glob, Grep, Bash
6
7
  ---
7
8
 
8
9
  You are a codebase exploration specialist. Your only job is to find and present ALL relevant code and logic for the requested feature.
@@ -3,6 +3,7 @@ name: explore-docs
3
3
  description: Use this agent IMMEDIATELY when the user asks about library features, implementation methods, "how to do X with Y library", documentation searches, or ANY question about using/implementing specific libraries or frameworks (in any language) - launches Context7 and WebFetch for precise technical information with code examples
4
4
  color: yellow
5
5
  model: haiku
6
+ tools: Read, Glob, Grep, WebSearch, WebFetch, ToolSearch
6
7
  ---
7
8
 
8
9
  You are a documentation exploration specialist. Your mission is to retrieve precise, actionable documentation with code examples while eliminating superficial content.
@@ -3,6 +3,7 @@ name: fix-grammar
3
3
  description: Use this agent to fix grammar and spelling errors in a single file while preserving formatting
4
4
  color: blue
5
5
  model: haiku
6
+ tools: Read, Edit, Write, Glob, Grep
6
7
  ---
7
8
 
8
9
  You are DevProfCorrectorGPT, a professional text corrector. Fix grammar and spelling errors in the specified file while preserving all formatting and meaning.
@@ -3,6 +3,7 @@ name: Snipper
3
3
  description: Use this agent when you need to modify code. This agent is specialized to be fast. The output is small and optimized to code as fast as agent can.
4
4
  color: blue
5
5
  model: haiku
6
+ tools: Read, Edit, Write, Glob, Grep
6
7
  ---
7
8
 
8
9
  You are a rapid code modification specialist. No explanations, just execute.
@@ -40,3 +40,9 @@ Manage SmartStack admin accounts. Wraps the `smartstack admin` CLI command with
40
40
  4. **Report result** - Show new credentials or error message
41
41
 
42
42
  </workflow>
43
+
44
+ <success_criteria>
45
+ - Admin command executed successfully or clear error displayed
46
+ - New credentials shown to user (for reset)
47
+ - SmartStack.app project correctly detected
48
+ </success_criteria>
@@ -13,12 +13,12 @@ description: |
13
13
 
14
14
  # Skill AI Prompt SmartStack
15
15
 
16
- > **Architecture:** Prompt + Blocks Provider + Model Completion Schema Validation
16
+ > **Architecture:** Prompt + Blocks -> Provider + Model -> Completion -> Schema Validation
17
17
  > Multi-provider: OpenAI, Anthropic (Claude), Azure OpenAI, Google Gemini
18
18
 
19
19
  **Reference:** [_shared.md](../_shared.md) for common patterns
20
20
 
21
- ## WHEN THIS SKILL ACTIVATES
21
+ ## When This Skill Activates
22
22
 
23
23
  | Trigger | Example |
24
24
  |---------|---------|
@@ -28,17 +28,17 @@ description: |
28
28
  | Text analysis | "Analyze the sentiment of comments" |
29
29
  | Keywords | "prompt", "GPT", "Claude", "IA", "completion", "LLM" |
30
30
 
31
- ## AI FLOW
31
+ ## AI Flow
32
32
 
33
33
  ```
34
- Feature IAiCompletionService.ExecutePromptAsync()
35
-
36
- Prompt + Blocks Provider Instance External API (OpenAI/Claude/Azure/Gemini)
37
-
38
- AI Response OutputSchema Validation Typed Result<T>
34
+ Feature -> IAiCompletionService.ExecutePromptAsync()
35
+ |
36
+ Prompt + Blocks -> Provider Instance -> External API (OpenAI/Claude/Azure/Gemini)
37
+ |
38
+ AI Response -> OutputSchema Validation -> Typed Result<T>
39
39
  ```
40
40
 
41
- ## MAIN ENTITIES
41
+ ## Main Entities
42
42
 
43
43
  ### AiProvider & AiModel
44
44
  - **Providers:** OpenAI, Anthropic, Azure OpenAI, Google
@@ -58,138 +58,27 @@ Configured instance: Code, Name, SystemContext, DefaultModel, MonthlyBudgetLimit
58
58
  ### OutputSchema
59
59
  JSON Schema for validation: Code, Name, JsonSchema, DotNetType
60
60
 
61
- ## WORKFLOW INTEGRATION
61
+ ## Implementation
62
62
 
63
- ### 1. Define the Use Case
64
- | Question | Impact |
65
- |----------|--------|
66
- | Content type? | Model choice |
67
- | Structured response? | OutputSchema |
68
- | Multi-language? | Language variables |
69
- | Budget limited? | ProviderInstance |
70
- | Real-time? | Streaming |
63
+ See [steps/step-01-implementation.md](steps/step-01-implementation.md) for:
64
+ - Workflow steps (define use case, create prompt, define schema, execute)
65
+ - AI service interfaces (IAiCompletionService, IPromptService)
66
+ - Frontend integration (API, hooks, components)
67
+ - Advanced patterns (streaming, fallback provider)
71
68
 
72
- ### 2. Create the Prompt
73
- ```csharp
74
- var promptId = await _promptService.CreatePromptAsync(new CreatePromptRequest
75
- {
76
- Code = "ticket-analyzer",
77
- Name = "Ticket Analyzer",
78
- Blocks = new[] {
79
- new CreateBlockRequest {
80
- BlockType = PromptBlockType.System,
81
- Content = "Instructions...",
82
- IsRequired = true
83
- },
84
- new CreateBlockRequest {
85
- BlockType = PromptBlockType.User,
86
- Content = "Ticket: {{ticketTitle}}\nDescription: {{ticketDescription}}",
87
- IsRequired = true
88
- }
89
- }
90
- });
91
- ```
92
-
93
- ### 3. Define OutputSchema (if structured response)
94
- ```csharp
95
- var schemaId = await _schemaService.CreateAsync(new CreateSchemaRequest
96
- {
97
- Code = "ticket-analysis-result",
98
- JsonSchema = @"{ ""type"": ""object"", ""required"": [""category"", ""priority""], ... }",
99
- DotNetType = "SmartStack.Application.AI.TicketAnalysisResult"
100
- });
101
- ```
102
-
103
- ### 4. Execute the Prompt
104
- ```csharp
105
- // Simple execution
106
- var result = await _aiService.ExecutePromptAsync(promptId, new Dictionary<string, object>
107
- {
108
- ["ticketTitle"] = ticket.Title,
109
- ["ticketDescription"] = ticket.Description
110
- });
111
-
112
- // With typed validation
113
- var typedResult = await _aiService.ExecutePromptWithValidationAsync<TicketAnalysisResult>(
114
- promptId, variables);
115
- if (typedResult.Success && typedResult.IsValid) { /* use typedResult.Data */ }
116
- ```
117
-
118
- ## AI SERVICES
119
-
120
- ### IAiCompletionService
121
- ```csharp
122
- Task<AiCompletionResult> CompleteAsync(AiCompletionRequest request, CancellationToken ct);
123
- Task<AiCompletionResult> ExecutePromptAsync(Guid promptId, Dictionary<string, object>? variables, ...);
124
- Task<AiValidatedCompletionResult<T>> ExecutePromptWithValidationAsync<T>(Guid promptId, ...);
125
- Task<AiValidatedCompletionResult<T>> ExecutePromptByCodeWithValidationAsync<T>(string promptCode, ...);
126
- ```
127
-
128
- ### IPromptService
129
- ```csharp
130
- Task<PromptDto> GetPromptByCodeAsync(string code, string? version = null);
131
- Task<string> RenderPromptAsync(string code, Dictionary<string, object>? variables);
132
- Task<Guid> CreatePromptAsync(CreatePromptRequest request);
133
- Task ActivatePromptAsync(Guid promptId);
134
- // Block management: AddBlockToPromptAsync, UpdateBlockAsync, ReorderBlocksAsync
135
- ```
69
+ ## Checklist
136
70
 
137
- ## FRONTEND INTEGRATION
138
-
139
- ### API
140
- ```typescript
141
- aiApi.getPrompts(status?, isTemplate?)
142
- aiApi.executePrompt(promptId, variables)
143
- aiApi.previewPrompt(promptId, variables)
144
- aiApi.getProviders() / aiApi.getModels(providerId?)
145
- aiApi.getSchemas() / aiApi.createSchema(data)
146
- ```
147
-
148
- ### Hook useAiCompletion
149
- ```typescript
150
- const { execute, loading, error, result } = useAiCompletion<T>(promptCode);
151
- const data = await execute(variables);
152
71
  ```
153
-
154
- ### Component AiAssistantButton
155
- ```tsx
156
- <AiAssistantButton
157
- promptCode="ticket-analyzer"
158
- variables={{ ticketTitle, ticketDescription }}
159
- onResult={(result) => handleAnalysis(result)}
160
- label="Analyze with AI"
161
- />
72
+ - Prompt created (unique Code, Blocks, Variables, Version)
73
+ - OutputSchema if structured response
74
+ - Service with IAiCompletionService injected
75
+ - Error handling + Logging (tokens, time)
76
+ - Frontend: Hook/component, Loading, Error handling
77
+ - ProviderInstance with budget limit
78
+ - Tests: execution, variables, schema validation
162
79
  ```
163
80
 
164
- ## ADVANCED PATTERNS
165
-
166
- ### Streaming Response
167
- ```typescript
168
- const reader = response.body?.getReader();
169
- while (true) { const { done, value } = await reader.read(); if (done) break; /* append chunk */ }
170
- ```
171
-
172
- ### Fallback Provider
173
- ```csharp
174
- foreach (var provider in providers.OrderBy(p => p.Priority)) {
175
- var result = await _aiService.ExecutePromptAsync(promptId, variables, providerId: provider.Id);
176
- if (result.Success) return result;
177
- }
178
- ```
179
-
180
- ## CHECKLIST
181
-
182
- ```
183
- □ Prompt created (unique Code, Blocks, Variables, Version)
184
- □ OutputSchema if structured response
185
- □ Service with IAiCompletionService injected
186
- □ Error handling + Logging (tokens, time)
187
- □ Frontend: Hook/component, Loading, Error handling
188
- □ ProviderInstance with budget limit
189
- □ Tests: execution, variables, schema validation
190
- ```
191
-
192
- ## ABSOLUTE RULES
81
+ ## Absolute Rules
193
82
 
194
83
  | DO | DON'T |
195
84
  |----|-------|
@@ -199,7 +88,7 @@ foreach (var provider in providers.OrderBy(p => p.Priority)) {
199
88
  | Log executions (tokens, duration) | Hardcode API keys |
200
89
  | Variables for dynamic content | Expose system prompts to frontend |
201
90
 
202
- ## KEY FILES
91
+ ## Key Files
203
92
 
204
93
  | File | Role |
205
94
  |------|------|
@@ -209,3 +98,10 @@ foreach (var provider in providers.OrderBy(p => p.Priority)) {
209
98
  | `Application/Common/Interfaces/IAiCompletionService.cs` | Service interface |
210
99
  | `Infrastructure/Services/AI/AiCompletionService.cs` | Implementation |
211
100
  | `web/src/services/api/aiApi.ts` | Frontend API |
101
+
102
+ <success_criteria>
103
+ - Prompt entity created with OutputSchema validation
104
+ - IAiCompletionService integration wired correctly
105
+ - Error handling for API failures and quota limits implemented
106
+ - Token usage logged per execution
107
+ </success_criteria>
@@ -0,0 +1,122 @@
1
+ # AI Prompt - Implementation Workflow
2
+
3
+ ## 1. Define the Use Case
4
+
5
+ | Question | Impact |
6
+ |----------|--------|
7
+ | Content type? | Model choice |
8
+ | Structured response? | OutputSchema |
9
+ | Multi-language? | Language variables |
10
+ | Budget limited? | ProviderInstance |
11
+ | Real-time? | Streaming |
12
+
13
+ ## 2. Create the Prompt
14
+
15
+ ```csharp
16
+ var promptId = await _promptService.CreatePromptAsync(new CreatePromptRequest
17
+ {
18
+ Code = "ticket-analyzer",
19
+ Name = "Ticket Analyzer",
20
+ Blocks = new[] {
21
+ new CreateBlockRequest {
22
+ BlockType = PromptBlockType.System,
23
+ Content = "Instructions...",
24
+ IsRequired = true
25
+ },
26
+ new CreateBlockRequest {
27
+ BlockType = PromptBlockType.User,
28
+ Content = "Ticket: {{ticketTitle}}\nDescription: {{ticketDescription}}",
29
+ IsRequired = true
30
+ }
31
+ }
32
+ });
33
+ ```
34
+
35
+ ## 3. Define OutputSchema (if structured response)
36
+
37
+ ```csharp
38
+ var schemaId = await _schemaService.CreateAsync(new CreateSchemaRequest
39
+ {
40
+ Code = "ticket-analysis-result",
41
+ JsonSchema = @"{ ""type"": ""object"", ""required"": [""category"", ""priority""], ... }",
42
+ DotNetType = "SmartStack.Application.AI.TicketAnalysisResult"
43
+ });
44
+ ```
45
+
46
+ ## 4. Execute the Prompt
47
+
48
+ ```csharp
49
+ // Simple execution
50
+ var result = await _aiService.ExecutePromptAsync(promptId, new Dictionary<string, object>
51
+ {
52
+ ["ticketTitle"] = ticket.Title,
53
+ ["ticketDescription"] = ticket.Description
54
+ });
55
+
56
+ // With typed validation
57
+ var typedResult = await _aiService.ExecutePromptWithValidationAsync<TicketAnalysisResult>(
58
+ promptId, variables);
59
+ if (typedResult.Success && typedResult.IsValid) { /* use typedResult.Data */ }
60
+ ```
61
+
62
+ ## AI Services
63
+
64
+ ### IAiCompletionService
65
+ ```csharp
66
+ Task<AiCompletionResult> CompleteAsync(AiCompletionRequest request, CancellationToken ct);
67
+ Task<AiCompletionResult> ExecutePromptAsync(Guid promptId, Dictionary<string, object>? variables, ...);
68
+ Task<AiValidatedCompletionResult<T>> ExecutePromptWithValidationAsync<T>(Guid promptId, ...);
69
+ Task<AiValidatedCompletionResult<T>> ExecutePromptByCodeWithValidationAsync<T>(string promptCode, ...);
70
+ ```
71
+
72
+ ### IPromptService
73
+ ```csharp
74
+ Task<PromptDto> GetPromptByCodeAsync(string code, string? version = null);
75
+ Task<string> RenderPromptAsync(string code, Dictionary<string, object>? variables);
76
+ Task<Guid> CreatePromptAsync(CreatePromptRequest request);
77
+ Task ActivatePromptAsync(Guid promptId);
78
+ // Block management: AddBlockToPromptAsync, UpdateBlockAsync, ReorderBlocksAsync
79
+ ```
80
+
81
+ ## Frontend Integration
82
+
83
+ ### API
84
+ ```typescript
85
+ aiApi.getPrompts(status?, isTemplate?)
86
+ aiApi.executePrompt(promptId, variables)
87
+ aiApi.previewPrompt(promptId, variables)
88
+ aiApi.getProviders() / aiApi.getModels(providerId?)
89
+ aiApi.getSchemas() / aiApi.createSchema(data)
90
+ ```
91
+
92
+ ### Hook useAiCompletion
93
+ ```typescript
94
+ const { execute, loading, error, result } = useAiCompletion<T>(promptCode);
95
+ const data = await execute(variables);
96
+ ```
97
+
98
+ ### Component AiAssistantButton
99
+ ```tsx
100
+ <AiAssistantButton
101
+ promptCode="ticket-analyzer"
102
+ variables={{ ticketTitle, ticketDescription }}
103
+ onResult={(result) => handleAnalysis(result)}
104
+ label="Analyze with AI"
105
+ />
106
+ ```
107
+
108
+ ## Advanced Patterns
109
+
110
+ ### Streaming Response
111
+ ```typescript
112
+ const reader = response.body?.getReader();
113
+ while (true) { const { done, value } = await reader.read(); if (done) break; /* append chunk */ }
114
+ ```
115
+
116
+ ### Fallback Provider
117
+ ```csharp
118
+ foreach (var provider in providers.OrderBy(p => p.Priority)) {
119
+ var result = await _aiService.ExecutePromptAsync(promptId, variables, providerId: provider.Id);
120
+ if (result.Success) return result;
121
+ }
122
+ ```
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: apex
3
+ description: |
4
+ SmartStack incremental development using APEX methodology (Analyze-Plan-Execute-eXamine).
5
+ Use this skill when:
6
+ - Adding a new section/resource to an existing module
7
+ - Developing feature by feature without /business-analyse
8
+ - Fixing or extending code generated by /ralph-loop
9
+ - Any incremental SmartStack development task
10
+ argument-hint: "[-a] [-x] [-s] [-t] [-e] [-r] [-pr] <task description>"
11
+ ---
12
+
13
+ <objective>
14
+ Execute incremental SmartStack development using the APEX methodology. This skill knows the SmartStack hierarchy (context/application/module/section/resource), delegates code creation to existing skills (/controller, /application, /ui-components, /efcore, /notification, /workflow) and MCP tools, and validates via MCP conventions.
15
+
16
+ **Key principle:** /apex ORCHESTRATES — it never generates SmartStack code directly. All generation goes through skills and MCP tools.
17
+ </objective>
18
+
19
+ <quick_start>
20
+
21
+ ```bash
22
+ /apex add absence management to HR module # Add section to module
23
+ /apex -a fix the leave request controller # Auto fix
24
+ /apex -a -x -s -t -pr add PDF export to Orders # Full workflow
25
+ /apex -e add status field to Project entity # Economy (no agents)
26
+ /apex -r # Resume previous
27
+ ```
28
+
29
+ </quick_start>
30
+
31
+ <parameters>
32
+
33
+ | Flag | Description |
34
+ |------|-------------|
35
+ | `-a` | Auto mode: skip confirmations |
36
+ | `-x` | Examine mode: adversarial code review |
37
+ | `-s` | Save mode: output to `.claude/output/apex/` |
38
+ | `-t` | Test mode: scaffold + run tests via MCP |
39
+ | `-e` | Economy mode: no subagents |
40
+ | `-r` | Resume: continue from previous state |
41
+ | `-pr` | PR mode: create pull request at end |
42
+
43
+ </parameters>
44
+
45
+ <state_variables>
46
+
47
+ | Variable | Type | Description |
48
+ |----------|------|-------------|
49
+ | `{task_description}` | string | What to implement (flags removed) |
50
+ | `{task_id}` | string | Kebab-case identifier |
51
+ | `{auto_mode}` | boolean | Skip confirmations |
52
+ | `{examine_mode}` | boolean | Adversarial review |
53
+ | `{save_mode}` | boolean | Save outputs to `.claude/output/apex/{task-id}/` |
54
+ | `{test_mode}` | boolean | Include test steps (07-08) |
55
+ | `{economy_mode}` | boolean | No subagents |
56
+ | `{pr_mode}` | boolean | Create PR at end |
57
+ | `{context_code}` | string | "business", "platform", "personal" |
58
+ | `{app_name}` | string | Application name |
59
+ | `{module_code}` | string | Module code |
60
+ | `{sections}` | string[] | Sections being added/modified |
61
+ | `{prd_path}` | string? | `.ralph/prd-{module}.json` if exists |
62
+ | `{feature_path}` | string? | `docs/business/.../feature.json` if exists |
63
+ | `{needs_seed_data}` | boolean | Seed data creation required |
64
+ | `{needs_migration}` | boolean | EF Core migration required |
65
+ </state_variables>
66
+
67
+ <entry_point>
68
+
69
+ **FIRST ACTION:** Load `steps/step-00-init.md`
70
+
71
+ </entry_point>
72
+
73
+ <step_files>
74
+ **Progressive loading - only load current step:**
75
+
76
+ | Step | File | Model | Purpose |
77
+ |------|------|-------|---------|
78
+ | 00 | `steps/step-00-init.md` | Sonnet | Parse flags, detect SmartStack context, verify MCP |
79
+ | 01 | `steps/step-01-analyze.md` | Opus | Explore existing code (Agent Teams or direct) |
80
+ | 02 | `steps/step-02-plan.md` | Opus | Layer-by-layer plan with skill/MCP mapping |
81
+ | 03 | `steps/step-03-execute.md` | Opus | Orchestrate execution via skills and MCP |
82
+ | 04 | `steps/step-04-validate.md` | Opus | MCP validation, build, seed data check |
83
+ | 05 | `steps/step-05-examine.md` | Opus | Adversarial review (if -x) |
84
+ | 06 | `steps/step-06-resolve.md` | Opus | Fix BLOCKING findings (if any) |
85
+ | 07 | `steps/step-07-tests.md` | Opus | Scaffold tests via MCP (if -t) |
86
+ | 08 | `steps/step-08-run-tests.md` | Opus | Run tests until 100% pass (if -t) |
87
+ </step_files>
88
+
89
+ <reference_files>
90
+ **Loaded conditionally by steps that need them:**
91
+
92
+ | File | Purpose | Loaded by |
93
+ |------|---------|-----------|
94
+ | `references/smartstack-layers.md` | Layer execution rules, skill/MCP mapping, seed data | step-02, step-03 |
95
+ | `references/agent-teams-protocol.md` | TeamCreate, coordination, shutdown protocol | step-01, step-03 |
96
+ </reference_files>
97
+
98
+ <execution_rules>
99
+
100
+ - **Load one step at a time** - Progressive loading to manage context
101
+ - **ORCHESTRATE, never generate** - All SmartStack code via skills (/controller, /application, etc.) or MCP tools
102
+ - **MCP-first** - Use MCP scaffold/validate tools before manual approaches
103
+ - **Verify MCP at startup** - step-00 checks MCP availability
104
+ - **Layer order** - domain -> infra -> migration(BLOCKING) -> app -> api -> frontend -> i18n -> tests
105
+ - **Agent Teams** - Parallel execution for scan (step-01) and Layer 1 (step-03), unless economy_mode
106
+ - **Save outputs** if `{save_mode}` = true
107
+ - **Commits per layer** - Atomic commits after each execution layer
108
+
109
+ </execution_rules>
110
+
111
+ <success_criteria>
112
+ - SmartStack context detected (context/app/module)
113
+ - Plan validated with skill/MCP mapped for each file
114
+ - Code created/corrected via existing skills and MCP (no direct generation)
115
+ - MCP validate_conventions: 0 errors
116
+ - Build: dotnet build PASS + npm run typecheck PASS (if frontend)
117
+ - Seed data complete (navigation, permissions, roles, provider) if required
118
+ - Tests: 100% pass, >= 80% coverage (if -t)
119
+ - Commits atomic per layer
120
+ </success_criteria>
@@ -0,0 +1,86 @@
1
+ # APEX Shared — SmartStack Detection & MCP References
2
+
3
+ > **Loaded by:** step-00-init (always), other steps as needed
4
+
5
+ ---
6
+
7
+ ## SmartStack Project Detection
8
+
9
+ ### Scan Pattern
10
+
11
+ 1. `*.sln` → .NET backend confirmed
12
+ 2. `docs/business/` → BA artifacts exist
13
+ 3. `.ralph/prd-*.json` → PRDs exist
14
+ 4. `src/pages/` → React frontend exists
15
+
16
+ ### Context-to-Folder Mapping
17
+
18
+ | Context | Backend | Controller | Frontend Layout |
19
+ |---------|---------|------------|----------------|
20
+ | `business` | `Business` | `Business` | `BusinessLayout` |
21
+ | `platform.administration` | `Platform/Administration` | `Admin` | `AdminLayout` |
22
+ | `platform.support` | `Platform/Support` | `Support` | `AdminLayout` |
23
+ | `personal` | `Personal` | `User` | `UserLayout` |
24
+
25
+ ---
26
+
27
+ ## MCP Tools Reference
28
+
29
+ ### Mandatory (every execution)
30
+
31
+ | Tool | Purpose | Step |
32
+ |------|---------|------|
33
+ | `validate_conventions` | Validate SmartStack conventions | 00 (check), 04 (validate) |
34
+
35
+ ### Generation (step-03)
36
+
37
+ | Tool | Purpose | Condition |
38
+ |------|---------|-----------|
39
+ | `scaffold_extension` | Generate entities, services, controllers | New code creation |
40
+ | `suggest_migration` | Get standardized migration name | EF Core changes |
41
+ | `generate_permissions` | Generate RBAC permissions + seed data | New module/section |
42
+ | `scaffold_api_client` | Generate TypeScript API client | Frontend changes |
43
+ | `scaffold_routes` | Generate React Router routes | Frontend changes |
44
+
45
+ ### Validation (step-04)
46
+
47
+ | Tool | Purpose | Condition |
48
+ |------|---------|-----------|
49
+ | `check_migrations` | Validate EF Core migrations | Migration created |
50
+ | `validate_frontend_routes` | Validate route/layout alignment | Frontend changes |
51
+ | `validate_security` | Check security patterns | API changes |
52
+
53
+ ### Analysis (step-01)
54
+
55
+ | Tool | Purpose |
56
+ |------|---------|
57
+ | `api_docs` | Existing API documentation |
58
+ | `analyze_extension_points` | React extension points |
59
+
60
+ ### Tests (step-07, if -t)
61
+
62
+ | Tool | Purpose |
63
+ |------|---------|
64
+ | `scaffold_tests` | Generate tests (domain, app, api, security) |
65
+ | `suggest_test_scenarios` | Suggest test scenarios |
66
+ | `analyze_test_coverage` | Check coverage percentage |
67
+
68
+ ### Review (step-05, if -x)
69
+
70
+ | Tool | Purpose |
71
+ |------|---------|
72
+ | `review_code` | Adversarial code review |
73
+ | `analyze_code_quality` | Code quality metrics |
74
+
75
+ ---
76
+
77
+ ## Existing Skills Delegation
78
+
79
+ | Skill | When to delegate |
80
+ |-------|-----------------|
81
+ | `/controller` | Complex controller with custom routes |
82
+ | `/application` | New context/application/module structure |
83
+ | `/ui-components` | Complex React pages (tables, grids, dashboards) |
84
+ | `/efcore` | Complex EF Core configurations |
85
+ | `/notification` | In-app or email notifications |
86
+ | `/workflow` | Automated workflow triggers |