@nebulit/embuilder 0.1.40 → 0.1.41

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 (24) hide show
  1. package/package.json +1 -1
  2. package/templates/.claude/skills/sample-slices/templates/.slices/index.json +1 -1
  3. package/templates/.claude/skills/ui-analyze-slices/SKILL.md +102 -0
  4. package/templates/.claude/skills/ui-build-slice-ui/SKILL.md +228 -0
  5. package/templates/.claude/skills/ui-generate-api/SKILL.md +141 -0
  6. package/templates/.claude/skills/ui-generate-hook/SKILL.md +118 -0
  7. package/templates/.claude/skills/ui-generate-types/SKILL.md +223 -0
  8. package/templates/.claude/skills/ui-read-ui-prompts/SKILL.md +192 -0
  9. package/templates/.claude/skills/ui-scaffold-component/SKILL.md +274 -0
  10. package/templates/frontend/prompt.md +250 -90
  11. package/templates/.claude/skills/sample-slices/templates/Cart/additem/slice.json +0 -979
  12. package/templates/.claude/skills/sample-slices/templates/Cart/archiveitem/slice.json +0 -529
  13. package/templates/.claude/skills/sample-slices/templates/Cart/cartitems/slice.json +0 -1072
  14. package/templates/.claude/skills/sample-slices/templates/Cart/cartwithproducts/slice.json +0 -394
  15. package/templates/.claude/skills/sample-slices/templates/Cart/changedprices/slice.json +0 -88
  16. package/templates/.claude/skills/sample-slices/templates/Cart/changeinventory/slice.json +0 -264
  17. package/templates/.claude/skills/sample-slices/templates/Cart/changeprice/slice.json +0 -308
  18. package/templates/.claude/skills/sample-slices/templates/Cart/clearcart/slice.json +0 -358
  19. package/templates/.claude/skills/sample-slices/templates/Cart/inventories/slice.json +0 -203
  20. package/templates/.claude/skills/sample-slices/templates/Cart/publishcart/slice.json +0 -876
  21. package/templates/.claude/skills/sample-slices/templates/Cart/removeitem/slice.json +0 -560
  22. package/templates/.claude/skills/sample-slices/templates/Cart/submitcart/slice.json +0 -708
  23. package/templates/.claude/skills/sample-slices/templates/Cart/submittedcartdata/slice.json +0 -399
  24. package/templates/.claude/skills/sample-slices/templates/index.json +0 -108
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nebulit/embuilder",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "Event-model driven development toolkit for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -6,7 +6,7 @@
6
6
  "index": 1,
7
7
  "context": "Library",
8
8
  "folder": "addbook",
9
- "status": "Done"
9
+ "status": "Planned"
10
10
  },
11
11
  {
12
12
  "id": "3458764661595862502",
@@ -0,0 +1,102 @@
1
+ ---
2
+ skill_name: ui-analyze-slices
3
+ description: Analyze slice JSON files to identify grouping, dependencies, and implementation strategy
4
+ version: 1.0.0
5
+ author: Frontend Development Team
6
+ tags: [ui, analysis, slices, planning, cqrs]
7
+ ---
8
+
9
+ # Slice Analyzer Skill
10
+
11
+ Analyze slice JSON files to identify grouping, dependencies, and implementation strategy.
12
+
13
+ ## Instructions
14
+
15
+ You will be provided with one or more slice JSON file paths. Your task is to:
16
+
17
+ 1. **Read all slice JSON files** provided
18
+ 2. **Analyze and extract**:
19
+ - Slice names and types (STATE_VIEW, STATE_CHANGE)
20
+ - Group IDs (`groupId` field)
21
+ - Entity names derived from slice names
22
+ - Read model table names (for STATE_VIEW slices)
23
+ - Command endpoints (for STATE_CHANGE slices)
24
+ - UI prompts from `codeGen.uiPrompts` array
25
+ - Field definitions for each slice
26
+
27
+ 3. **Group slices** by their `groupId`
28
+
29
+ 4. **Identify UI prompt locations**:
30
+ - Check for `ui-prompt.md` in the slice folder in /backend/src/slices. Those files have been provided by the backend engineers.
31
+ - Extract prompts from `codeGen.uiPrompts` if present from the slice.json
32
+
33
+ 5. **Recommend implementation strategy**:
34
+ - Which hooks to create (query hooks for STATE_VIEW, mutation hooks for STATE_CHANGE)
35
+ - Which components to scaffold (List, Dialog, Page)
36
+ - How to combine slices in the same group
37
+
38
+ ## Output Format
39
+
40
+ Provide a structured analysis in the following format:
41
+
42
+ ```
43
+ # Slice Analysis Results
44
+
45
+ ## Groups Found
46
+
47
+ ### Group: "{groupId}" ({count} slices)
48
+
49
+ **Slices:**
50
+ 1. **{sliceName}** (TYPE: {STATE_VIEW|STATE_CHANGE})
51
+ - Entity: {entityName}
52
+ - Table/Endpoint: {tableName or commandEndpoint}
53
+ - Fields: {list of field names}
54
+ - Recommended Hook: {hookName}()
55
+
56
+ 2. **{sliceName}** ...
57
+
58
+ **UI Prompts:**
59
+ - codeGen.uiPrompts:
60
+ - "{prompt1}"
61
+ - "{prompt2}"
62
+ - ui-prompt.md: {Found/Not Found} at {path}
63
+
64
+ **Implementation Recommendations:**
65
+ - Create hooks: {list of hook names}
66
+ - Create components: {list of component names}
67
+ - Page composition: {description of how to combine}
68
+
69
+ ---
70
+
71
+ ## Ungrouped Slices
72
+
73
+ (List any slices without a groupId)
74
+
75
+ ---
76
+
77
+ ## Summary
78
+
79
+ Total Slices: {count}
80
+ Groups: {count}
81
+ STATE_VIEW slices: {count}
82
+ STATE_CHANGE slices: {count}
83
+ ```
84
+
85
+ ## Example Usage
86
+
87
+ User provides: `src/slices/events/CreateEvent.json`, `src/slices/events/ViewEvents.json`
88
+
89
+ You should:
90
+ 1. Read both JSON files
91
+ 2. Identify they belong to the same group (e.g., "event-management")
92
+ 3. Determine ViewEvents is STATE_VIEW, CreateEvent is STATE_CHANGE
93
+ 4. Check for ui-prompt.md in `src/slices/events/`
94
+ 5. Recommend creating `useEvents()` query hook and `useCreateEvent()` mutation hook
95
+ 6. Suggest creating EventList component, CreateEventDialog, and EventsPage
96
+
97
+ ## Notes
98
+
99
+ - Always read the actual JSON files before analyzing
100
+ - Look for common patterns in slice naming to infer entity names
101
+ - Consider whether slices in the same group should be on the same page or separate pages
102
+ - Identify any dependencies between slices (e.g., a create action should refresh a list view)
@@ -0,0 +1,228 @@
1
+ ---
2
+ skill_name: ui-build-slice-ui
3
+ description: Orchestrate the complete process of building a UI from slice definitions by coordinating all other frontend skills
4
+ version: 1.0.0
5
+ author: Frontend Development Team
6
+ tags: [ui, orchestrator, slices, automation, full-stack]
7
+ ---
8
+
9
+ # Full Slice Builder Skill (Orchestrator)
10
+
11
+ Orchestrate the complete process of building a UI from slice definitions by coordinating all other frontend skills.
12
+
13
+ ## Instructions
14
+
15
+ You will be provided with:
16
+ - Group ID or slice JSON file paths
17
+ - Domain/entity name (optional, can be inferred)
18
+
19
+ Your task is to execute the full workflow to generate a complete, working UI implementation:
20
+
21
+ ## Workflow Steps
22
+
23
+ ### 1. Analyze Slices
24
+ Use the **ui-analyze-slices** skill to:
25
+ - Identify all slices in the group
26
+ - Determine slice types (STATE_VIEW, STATE_CHANGE)
27
+ - Find grouping and dependencies
28
+ - Create implementation plan
29
+
30
+ ### 2. Read UI Prompts
31
+ Use the **ui-read-ui-prompts** skill to:
32
+ - Extract UI requirements from `ui-prompt.md`
33
+ - Parse `codeGen.uiPrompts`
34
+ - Understand design, validation, and UX flow requirements
35
+
36
+ ### 3. Generate Types
37
+ Use the **ui-generate-types** skill to:
38
+ - Create TypeScript interfaces for entities
39
+ - Create parameter interfaces for commands
40
+ - Add types to `src/types/index.ts`
41
+
42
+ ### 4. Generate API Functions
43
+ Use the **ui-generate-api** skill to:
44
+ - Create Supabase query functions for STATE_VIEW slices
45
+ - Create command POST functions for STATE_CHANGE slices
46
+ - Add functions to `src/lib/api.ts`
47
+ - Update `src/lib/api-client.ts` with command endpoints
48
+
49
+ ### 5. Generate Hooks
50
+ Use the **ui-generate-hook** skill to:
51
+ - Create query hooks for STATE_VIEW slices
52
+ - Create mutation hooks for STATE_CHANGE slices
53
+ - Add hooks to `src/hooks/api/`
54
+ - Update `src/hooks/api/index.ts` with exports
55
+
56
+ ### 6. Scaffold Components
57
+ Use the **ui-scaffold-component** skill to:
58
+ - Create list components for STATE_VIEW slices
59
+ - Create dialog components for STATE_CHANGE slices
60
+ - Create page component to compose list and dialogs
61
+ - Add components to `src/components/{domain}/`
62
+ - Apply UI prompt requirements (Bulma CSS, validation, formatting)
63
+
64
+ ### 7. Verify Integration
65
+ - Check that all imports are correct
66
+ - Verify types are properly exported and imported
67
+ - Ensure hooks are properly exported
68
+ - Confirm components import hooks and types correctly
69
+
70
+ ## Execution Order
71
+
72
+ ```
73
+ 1. ui-analyze-slices
74
+
75
+ 2. ui-read-ui-prompts
76
+
77
+ 3. ui-generate-types
78
+
79
+ 4. ui-generate-api
80
+
81
+ 5. ui-generate-hook
82
+
83
+ 6. ui-scaffold-component
84
+
85
+ 7. Integration verification
86
+ ```
87
+
88
+ ## Output Format
89
+
90
+ Provide a comprehensive summary:
91
+
92
+ ```
93
+ # Slice UI Build Complete
94
+
95
+ ## Group: {groupId}
96
+ Domain: {domain}
97
+
98
+ ## Summary
99
+
100
+ ✓ Analyzed {count} slices
101
+ ✓ Generated types for {entities}
102
+ ✓ Created {count} API functions
103
+ ✓ Created {count} hooks
104
+ ✓ Scaffolded {count} components
105
+
106
+ ## Files Created/Modified
107
+
108
+ ### Types (src/types/index.ts)
109
+ - {Entity} interface
110
+ - {Action}{Entity}Params interface
111
+
112
+ ### API Functions (src/lib/api.ts)
113
+ - fetch{Entity}()
114
+ - {action}{Entity}()
115
+
116
+ ### API Client (src/lib/api-client.ts)
117
+ - {COMMAND_ENDPOINT} added
118
+
119
+ ### Hooks (src/hooks/api/)
120
+ - use{Entity}.ts
121
+ - use{Action}{Entity}.ts
122
+ - Updated index.ts with exports
123
+
124
+ ### Components (src/components/{domain}/)
125
+ - {Entity}List.tsx
126
+ - {Action}{Entity}Dialog.tsx
127
+ - {Entity}Page.tsx
128
+
129
+ ## Next Steps
130
+
131
+ 1. Add route to router configuration:
132
+ ```typescript
133
+ import { {Entity}Page } from '@/components/{domain}/{Entity}Page';
134
+
135
+ // In routes:
136
+ { path: '/{entities}', element: <{Entity}Page /> }
137
+ ```
138
+
139
+ 2. Test the implementation:
140
+ ```bash
141
+ npm run dev
142
+ ```
143
+
144
+ 3. Navigate to `/{entities}` to see the UI
145
+
146
+ ## Implementation Notes
147
+
148
+ - {any special notes from UI prompts}
149
+ - {any validation rules applied}
150
+ - {any custom formatting implemented}
151
+ ```
152
+
153
+ ## Error Handling
154
+
155
+ If any step fails:
156
+ 1. Report which step failed
157
+ 2. Provide the error details
158
+ 3. Suggest fixes or next steps
159
+ 4. Do not proceed to dependent steps
160
+
161
+ ## Validation Checklist
162
+
163
+ Before completing, verify:
164
+
165
+ - [ ] All TypeScript types are properly defined
166
+ - [ ] API functions handle errors appropriately
167
+ - [ ] Hooks are properly exported from index.ts
168
+ - [ ] Components import all necessary dependencies
169
+ - [ ] Bulma CSS classes are used correctly
170
+ - [ ] Form validation matches UI prompt requirements
171
+ - [ ] Date/time formatting matches specifications
172
+ - [ ] Loading and error states are handled
173
+ - [ ] Success/error feedback is implemented
174
+ - [ ] Responsive design is applied (Bulma columns)
175
+ - [ ] All files follow project conventions
176
+
177
+ ## Integration with Existing Code
178
+
179
+ When modifying existing files:
180
+
181
+ 1. **src/types/index.ts**:
182
+ - Add new interfaces at the end
183
+ - Maintain alphabetical ordering if followed
184
+ - Check for duplicate type names
185
+
186
+ 2. **src/lib/api.ts**:
187
+ - Add functions in relevant sections (queries/commands)
188
+ - Follow existing error handling patterns
189
+ - Import necessary types
190
+
191
+ 3. **src/lib/api-client.ts**:
192
+ - Add command endpoints to the `commandEndpoints` object
193
+ - Follow existing naming convention (UPPER_SNAKE_CASE)
194
+
195
+ 4. **src/hooks/api/index.ts**:
196
+ - Add exports in alphabetical order if followed
197
+ - Use named exports consistently
198
+
199
+ ## Best Practices
200
+
201
+ - Generate minimal, focused code (avoid over-engineering)
202
+ - Follow existing project patterns and conventions
203
+ - Use Bulma CSS exclusively (no custom CSS unless necessary)
204
+ - Include JSDoc comments for public APIs
205
+ - Handle edge cases (empty lists, errors, loading)
206
+ - Implement proper TypeScript types (no `any`)
207
+ - Follow React best practices (hooks rules, controlled components)
208
+ - Ensure accessibility (semantic HTML, ARIA when needed)
209
+
210
+ ## Example Usage
211
+
212
+ ```bash
213
+ # Build UI for all slices in the events group
214
+ /build-slice-ui --group "event-management-group"
215
+
216
+ # Build UI from specific slice files
217
+ /build-slice-ui src/slices/events/ViewEvents.json src/slices/events/CreateEvent.json
218
+ ```
219
+
220
+ ## Notes
221
+
222
+ - This skill orchestrates all other skills in sequence
223
+ - Each step depends on the previous step's output
224
+ - If UI prompts provide specific requirements, prioritize them over defaults
225
+ - Always use Bulma CSS components and utilities
226
+ - Generate clean, maintainable, production-ready code
227
+ - Follow TypeScript strict mode requirements
228
+ - Test the generated code before marking as complete
@@ -0,0 +1,141 @@
1
+ ---
2
+ skill_name: ui-generate-api
3
+ description: Generate API layer functions for queries (Supabase reads) and commands (POST requests)
4
+ version: 1.0.0
5
+ author: Frontend Development Team
6
+ tags: [ui, api, supabase, cqrs, commands, queries]
7
+ ---
8
+
9
+ # API Function Generator Skill
10
+
11
+ Generate API layer functions for queries (Supabase reads) and commands (POST requests).
12
+
13
+ ## Instructions
14
+
15
+ You will be provided with:
16
+ - Slice JSON file path
17
+ - Slice type (STATE_VIEW or STATE_CHANGE)
18
+
19
+ Your task is to:
20
+
21
+ 1. **Read the slice JSON file** to understand:
22
+ - Fields and their types
23
+ - Read model table name (for STATE_VIEW)
24
+ - Command endpoint (for STATE_CHANGE)
25
+ - Field mappings between frontend and backend
26
+
27
+ 2. **Generate API functions**:
28
+ - For STATE_VIEW: Create Supabase query function in `src/lib/api.ts`
29
+ - For STATE_CHANGE: Create POST command function in `src/lib/api.ts`
30
+
31
+ 3. **Update API client configuration** in `src/lib/api-client.ts`:
32
+ - Add command endpoint to `commandEndpoints` object (for STATE_CHANGE only)
33
+
34
+ 4. **Generate TypeScript interfaces** for parameters and return types
35
+
36
+ ## API Function Patterns
37
+
38
+ ### For STATE_VIEW (Supabase Query)
39
+
40
+ ```typescript
41
+ /**
42
+ * Fetch {entity} from read model
43
+ */
44
+ export async function fetch{Entity}(): Promise<{Entity}[]> {
45
+ const { data, error } = await supabase
46
+ .from('{table_name}')
47
+ .select('*')
48
+ .order('created_at', { ascending: false });
49
+
50
+ if (error) {
51
+ throw new Error(`Failed to fetch {entity}: ${error.message}`);
52
+ }
53
+
54
+ return data || [];
55
+ }
56
+ ```
57
+
58
+ ### For STATE_CHANGE (Command POST)
59
+
60
+ ```typescript
61
+ /**
62
+ * {Action description}
63
+ */
64
+ export async function {actionCamelCase}{Entity}(
65
+ params: {Action}{Entity}Params
66
+ ): Promise<void> {
67
+ const response = await apiClient.post(
68
+ commandEndpoints.{ACTION_ENTITY},
69
+ params
70
+ );
71
+
72
+ if (!response.ok) {
73
+ throw new Error(`Failed to {action} {entity}`);
74
+ }
75
+ }
76
+ ```
77
+
78
+ ## Command Endpoint Entry
79
+
80
+ For STATE_CHANGE slices, add to `src/lib/api-client.ts`:
81
+
82
+ ```typescript
83
+ export const commandEndpoints = {
84
+ // ... existing endpoints
85
+ {ACTION_ENTITY}: '{commandEndpoint}',
86
+ } as const;
87
+ ```
88
+
89
+ ## Output Format
90
+
91
+ Provide:
92
+
93
+ 1. **API function** to add to `src/lib/api.ts`
94
+ 2. **Command endpoint** to add to `src/lib/api-client.ts` (if STATE_CHANGE)
95
+ 3. **Type interface** for parameters (if STATE_CHANGE)
96
+
97
+ Example:
98
+
99
+ ```
100
+ # API Functions Generated
101
+
102
+ ## Add to src/lib/api.ts
103
+
104
+ [Function code here]
105
+
106
+ ## Add to src/lib/api-client.ts (commandEndpoints)
107
+
108
+ CREATE_EVENT: '/api/events/create',
109
+
110
+ ## Type Interface (add to src/types/index.ts if not exists)
111
+
112
+ export interface CreateEventParams {
113
+ name: string;
114
+ date: string;
115
+ startTime: string;
116
+ endTime: string;
117
+ persons: number;
118
+ }
119
+ ```
120
+
121
+ ## Field Mapping
122
+
123
+ When generating command functions:
124
+ - Map frontend field names to backend field names based on slice definition
125
+ - Handle camelCase ↔ snake_case conversions
126
+ - Include only fields marked as command parameters in the slice JSON
127
+
128
+ ## Error Handling
129
+
130
+ - All functions should throw descriptive errors
131
+ - Include the operation context in error messages
132
+ - For Supabase queries, check the `error` object
133
+ - For command POSTs, check response status
134
+
135
+ ## Notes
136
+
137
+ - Check if the function already exists before adding
138
+ - Ensure TypeScript types are properly imported
139
+ - For queries, use appropriate Supabase filters if specified in slice
140
+ - For commands, ensure all required fields are included
141
+ - Follow existing code patterns in the project
@@ -0,0 +1,118 @@
1
+ ---
2
+ skill_name: ui-generate-hook
3
+ description: Generate React Query hooks from slice definitions for STATE_VIEW (queries) and STATE_CHANGE (mutations)
4
+ version: 1.0.0
5
+ author: Frontend Development Team
6
+ tags: [ui, react-query, hooks, queries, mutations]
7
+ ---
8
+
9
+ # Hook Generator Skill
10
+
11
+ Generate React Query hooks from slice definitions for STATE_VIEW (queries) and STATE_CHANGE (mutations).
12
+
13
+ ## Instructions
14
+
15
+ You will be provided with:
16
+ - Slice JSON file path
17
+ - Slice type (STATE_VIEW or STATE_CHANGE)
18
+ - Entity name
19
+
20
+ Your task is to:
21
+
22
+ 1. **Read the slice JSON file** to understand:
23
+ - Fields and their types
24
+ - Read model table name (for STATE_VIEW)
25
+ - Command endpoint (for STATE_CHANGE)
26
+ - Required vs optional fields
27
+
28
+ 2. **Generate the appropriate hook file** in `src/hooks/api/`:
29
+ - For STATE_VIEW: Create `use{Entity}.ts` with a query hook
30
+ - For STATE_CHANGE: Create `use{Action}{Entity}.ts` with a mutation hook
31
+
32
+ 3. **Follow React Query patterns**:
33
+ - STATE_VIEW hooks use `useQuery`
34
+ - STATE_CHANGE hooks use `useMutation`
35
+ - Include proper TypeScript types
36
+ - Add JSDoc comments
37
+
38
+ 4. **Generate hook exports** for `src/hooks/api/index.ts`
39
+
40
+ ## Hook Structure
41
+
42
+ ### For STATE_VIEW (Query Hook)
43
+
44
+ ```typescript
45
+ import { useQuery } from '@tanstack/react-query';
46
+ import { fetch{Entity} } from '@/lib/api';
47
+ import type { {Entity} } from '@/types';
48
+
49
+ /**
50
+ * Hook to fetch {entity} data
51
+ */
52
+ export function use{Entity}() {
53
+ return useQuery<{Entity}[]>({
54
+ queryKey: ['{entity}'],
55
+ queryFn: fetch{Entity},
56
+ });
57
+ }
58
+ ```
59
+
60
+ ### For STATE_CHANGE (Mutation Hook)
61
+
62
+ ```typescript
63
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
64
+ import { {actionCamelCase}{Entity} } from '@/lib/api';
65
+ import type { {Action}{Entity}Params } from '@/types';
66
+
67
+ /**
68
+ * Hook to {action description} {entity}
69
+ */
70
+ export function use{Action}{Entity}() {
71
+ const queryClient = useQueryClient();
72
+
73
+ return useMutation({
74
+ mutationFn: ({actionCamelCase}{Entity}),
75
+ onSuccess: () => {
76
+ // Invalidate and refetch related queries
77
+ queryClient.invalidateQueries({ queryKey: ['{relatedEntity}'] });
78
+ },
79
+ });
80
+ }
81
+ ```
82
+
83
+ ## Output Format
84
+
85
+ Provide:
86
+
87
+ 1. **Hook file path and content**
88
+ 2. **Export statement** to add to `src/hooks/api/index.ts`
89
+ 3. **API function signature** that needs to be created in `src/lib/api.ts`
90
+
91
+ Example:
92
+
93
+ ```
94
+ # Hook Generated
95
+
96
+ ## File: src/hooks/api/useEvents.ts
97
+
98
+ [Hook content here]
99
+
100
+ ## Export for src/hooks/api/index.ts
101
+
102
+ export { useEvents } from './useEvents';
103
+
104
+ ## Required API Function in src/lib/api.ts
105
+
106
+ export async function fetchEvents(): Promise<Event[]> {
107
+ // Implementation needed
108
+ }
109
+ ```
110
+
111
+ ## Notes
112
+
113
+ - Always check if the hook file already exists before creating
114
+ - For mutations, determine which queries should be invalidated based on the entity and action
115
+ - Use proper naming conventions: `useEntityName` for queries, `useActionEntity` for mutations
116
+ - Include error handling patterns
117
+ - For create/update actions, typically invalidate the list query
118
+ - For delete actions, invalidate both list and detail queries if applicable