@nebulit/embuilder 0.1.48 → 0.1.49
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.
- package/package.json +1 -1
- package/templates/backend/prompt.md +102 -470
- package/templates/frontend/prompt.md +8 -8
- package/templates/prompt.md +1 -1
package/package.json
CHANGED
|
@@ -1,509 +1,141 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Ralph Agent Instructions
|
|
2
|
+
|
|
3
|
+
You are an autonomous coding agent working on the backend of a software project. You apply your skills to build software slices. You only work on one slice at a time.
|
|
4
|
+
|
|
5
|
+
The structure defined in the Project-Skills is relevant.
|
|
6
|
+
If a slice is in status 'planned', Even if a slice seems to have been implemented, make sure to verify the implementation, check for new fields, new specifications, additional custom prompts in the slice json. A "planned" slice can also be an update of an existing slice. If that is the case, match the implemenetation to the updated slice definition.
|
|
2
7
|
|
|
3
|
-
Build React + TypeScript UI components from slice JSON definitions using established patterns.
|
|
4
8
|
|
|
5
9
|
## Your Task
|
|
6
10
|
|
|
7
|
-
0. Do not read the entire code base.
|
|
8
|
-
1. Read the description at `.slices/index.json` (in the same directory as this file). Every item in status "planned" and assigned to "
|
|
11
|
+
0. Do not read the entire code base. Focus on the tasks in this description.
|
|
12
|
+
1. Read the description at `.slices/index.json` (in the same directory as this file). Every item in status "planned" and assigned to "backend_worker" is a task.
|
|
9
13
|
2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
|
|
10
|
-
3. Make sure you are on the right branch "feature/<slicename>",
|
|
11
|
-
5. Pick the **highest priority** task assigned to
|
|
14
|
+
3. Make sure you are on the right branch "feature/<slicename>", if unsure, start from main.
|
|
15
|
+
5. Pick the **highest priority** task assigned to backend_worker. This becomes your only task to work on. Set the status "InProgress", add a started_date ( including date and time ) in the index.json. If no slice has status planned, reply with:
|
|
12
16
|
<promise>NO_TASKS</promise> and stop. Do not work on other slices.
|
|
13
|
-
6. Pick the slice definition from the project root /.slices in <folder> defined in the prd.
|
|
14
|
-
7. A slice can define additional prompts as codegen/
|
|
15
|
-
8.
|
|
16
|
-
9.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
11.
|
|
20
|
-
12.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
17
|
+
6. Pick the slice definition from the project root /.slices in <folder> defined in the prd. Only work on this one assigned task, never other tasks.
|
|
18
|
+
7. A slice can define additional prompts as codegen/backendPrompt in the slice.json. any additional prompts defined in json are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
|
|
19
|
+
8. Define the slice type. If the processors-array is not empty, it´s an automation slice. if there is a readmodel, it´s a state view. If there is a command and no processor, it´s a state change. Load the matching skill (slice-automation, slice-state-change, slice-state-view)
|
|
20
|
+
9. Write a short progress one liner after each step to progress.txt
|
|
21
|
+
10. Analyze and Implement that single slice, make use of the skills in the skills directory, but also your previsously collected
|
|
22
|
+
knowledge. Make a list TODO list for what needs to be done. Also make sure to adjust the implementation according to the json definition, whenever you work on a task. The definition can change for existing slices, which means the implementation has to adapt. Carefully inspect events, fields and compare against the implemented slice. JSON is the desired state. ATTENTION: A "planned" task can also be just added specifications. So always look at the slice itself, but also the specifications. If specifications were added in json, which are not on code, you need to add them in code.
|
|
23
|
+
11. The slice in the json is always true, the code follows what is defined in the json
|
|
24
|
+
12. the backend of a slice is only 'Done' if business logic is implemented as defined in the JSON, APIs are implemented, all scenarios in JSON are implemented in code and it
|
|
25
|
+
fulfills the slice.json. There must be no specification in json, that has no equivalent in code.
|
|
26
|
+
13. make sure to write the ui-prompt.md for the ui_worker as defined if defined in the skill
|
|
27
|
+
14. Run quality checks ( npm run build, npm run test ) - Attention - it´s enough to run the tests for the slice. Do not run all tests.
|
|
28
|
+
15. even if the slice is fully implemented, run your test-analyzer skill and provide the code-slice.json file as defined in the skill
|
|
29
|
+
16. if the slice is an automation slice, set status to 'Done'. Otherwise - Update the Slice in the index.json back to status 'Planned' and assign the 'ui-worker'
|
|
30
|
+
17. If checks pass, commit ALL changes with message: `feat: [Slice Name]`.
|
|
31
|
+
18. Append your progress to `progress.txt` after each step in the iteration.
|
|
32
|
+
19. append your new learnings to AGENTS.md in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
|
|
33
|
+
20. if the slice status is 'Done', merge back to main.
|
|
34
|
+
21. Finish the iteration.
|
|
35
|
+
|
|
36
|
+
## Progress Report Format
|
|
37
|
+
|
|
38
|
+
APPEND to progress.txt (never replace, always append):
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
## [Date/Time] - [Slice]
|
|
42
|
+
|
|
43
|
+
- What was implemented
|
|
44
|
+
- Files changed
|
|
45
|
+
- **Learnings for future iterations:**
|
|
46
|
+
- Patterns discovered (e.g., "this codebase uses X for Y")
|
|
47
|
+
- Gotchas encountered (e.g., "don't forget to update Z when changing W")
|
|
48
|
+
- Useful context (e.g., "the evaluation panel is in component X")
|
|
46
49
|
---
|
|
47
|
-
|
|
48
|
-
## 1. Slice Composition (CRITICAL)
|
|
49
|
-
|
|
50
|
-
### Slice Types
|
|
51
|
-
|
|
52
|
-
- **STATE_VIEW**: One read model table → Query hook → List component
|
|
53
|
-
- **STATE_CHANGE**: One command/POST endpoint → Mutation hook → Form/Dialog
|
|
54
|
-
|
|
55
|
-
### Grouping Rule
|
|
56
|
-
|
|
57
|
-
**Slices with same `groupId` → Implement together as one component**
|
|
58
|
-
|
|
59
|
-
```javascript
|
|
60
|
-
// Multiple slices, same groupId → One component
|
|
61
|
-
Slice A: { groupId: "123", sliceType: "STATE_VIEW", title: "Events View" }
|
|
62
|
-
Slice B: { groupId: "123", sliceType: "STATE_CHANGE", title: "Create Event" }
|
|
63
|
-
Slice C: { groupId: "123", sliceType: "STATE_CHANGE", title: "Cancel Event" }
|
|
64
|
-
// → Combine into EventsPage component
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### UI Prompts Priority
|
|
68
|
-
|
|
69
|
-
1. Check `ui-prompt.md` (detailed specs) - Use `/ui-read-ui-prompts` skill
|
|
70
|
-
2. Check `codeGen.uiPrompts` array (high-level guidance) - Use `/ui-read-ui-prompts` skill
|
|
71
|
-
3. Follow this prompt (standard patterns)
|
|
72
|
-
4. Keep it simple if no guidance
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## 2. Authentication & API Context
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
// AuthContext: user, session, restaurantId
|
|
80
|
-
import { useAuth } from "@/contexts/AuthContext";
|
|
81
|
-
const { user, session } = useAuth();
|
|
82
|
-
|
|
83
|
-
// ApiContext: token, restaurantId, userId (auto-injected into headers)
|
|
84
|
-
import { useApiContext } from "@/hooks/useApiContext";
|
|
85
|
-
const ctx = useApiContext();
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
---
|
|
89
|
-
|
|
90
|
-
## 3. Hooks Pattern
|
|
91
|
-
|
|
92
|
-
### Query Hook (STATE_VIEW)
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
// src/hooks/api/useEvents.ts
|
|
96
|
-
import { useQuery } from "@tanstack/react-query";
|
|
97
|
-
import * as api from "@/lib/api";
|
|
98
|
-
|
|
99
|
-
export function useEvents() {
|
|
100
|
-
return useQuery({
|
|
101
|
-
queryKey: ["events"],
|
|
102
|
-
queryFn: () => api.fetchEvents(),
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
### Mutation Hook (STATE_CHANGE)
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
export function useCreateEvent() {
|
|
111
|
-
const ctx = useApiContext();
|
|
112
|
-
const queryClient = useQueryClient();
|
|
113
|
-
|
|
114
|
-
return useMutation({
|
|
115
|
-
mutationFn: (params: api.CreateEventParams) => api.createEvent(params, ctx),
|
|
116
|
-
onSuccess: () => {
|
|
117
|
-
queryClient.invalidateQueries({ queryKey: ["events"] });
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## 4. API Layer (CQRS)
|
|
126
|
-
|
|
127
|
-
### Query (Read from Supabase)
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
// src/lib/api.ts
|
|
131
|
-
export async function fetchEvents(): Promise<Event[]> {
|
|
132
|
-
const { data, error } = await supabase
|
|
133
|
-
.from("events_for_planning") // Read model table
|
|
134
|
-
.select("*");
|
|
135
|
-
if (error) throw new Error(error.message);
|
|
136
|
-
return data || [];
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Command (POST to Backend)
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
export async function createEvent(params: CreateEventParams, ctx: ApiContext) {
|
|
144
|
-
const response = await apiRequest(
|
|
145
|
-
commandEndpoints.createEvent, // /api/createevent
|
|
146
|
-
ctx,
|
|
147
|
-
{ method: "POST", body: { ...params } }
|
|
148
|
-
);
|
|
149
|
-
if (!response.ok) throw new Error(response.error);
|
|
150
|
-
return response.data;
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
**Add endpoint in `src/lib/api-client.ts`**:
|
|
155
|
-
```typescript
|
|
156
|
-
export const commandEndpoints = {
|
|
157
|
-
createEvent: "/api/createevent",
|
|
158
|
-
// ...
|
|
159
|
-
};
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## 5. Component Patterns
|
|
165
|
-
|
|
166
|
-
### List Component (STATE_VIEW)
|
|
167
|
-
|
|
168
|
-
```typescript
|
|
169
|
-
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
170
|
-
import { Skeleton } from "@/components/ui/skeleton";
|
|
171
|
-
import { useEvents } from "@/hooks/api/useEvents";
|
|
172
|
-
|
|
173
|
-
export function EventList() {
|
|
174
|
-
const { data: events = [], isLoading } = useEvents();
|
|
175
|
-
|
|
176
|
-
if (isLoading) {
|
|
177
|
-
return <Skeleton className="h-20 w-full" />;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<div className="grid gap-4 md:grid-cols-2">
|
|
182
|
-
{events.map(event => (
|
|
183
|
-
<Card key={event.id}>
|
|
184
|
-
<CardHeader><CardTitle>{event.name}</CardTitle></CardHeader>
|
|
185
|
-
<CardContent>{event.date}</CardContent>
|
|
186
|
-
</Card>
|
|
187
|
-
))}
|
|
188
|
-
</div>
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Dialog Component (STATE_CHANGE)
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
import { useState } from "react";
|
|
197
|
-
import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
|
198
|
-
import { Button } from "@/components/ui/button";
|
|
199
|
-
import { Input } from "@/components/ui/input";
|
|
200
|
-
import { Label } from "@/components/ui/label";
|
|
201
|
-
import { useCreateEvent } from "@/hooks/api/useEvents";
|
|
202
|
-
import { toast } from "sonner";
|
|
203
|
-
|
|
204
|
-
export function CreateEventDialog({ open, onOpenChange }) {
|
|
205
|
-
const createEvent = useCreateEvent();
|
|
206
|
-
const [form, setForm] = useState({ name: "", date: "" });
|
|
207
|
-
|
|
208
|
-
const handleSubmit = async () => {
|
|
209
|
-
if (!form.name) return toast.error("Name required");
|
|
210
|
-
try {
|
|
211
|
-
await createEvent.mutateAsync(form);
|
|
212
|
-
toast.success("Planned");
|
|
213
|
-
onOpenChange(false);
|
|
214
|
-
} catch (err) {
|
|
215
|
-
toast.error(`Error: ${err.message}`);
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
return (
|
|
220
|
-
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
221
|
-
<DialogContent>
|
|
222
|
-
<DialogHeader><DialogTitle>Create Event</DialogTitle></DialogHeader>
|
|
223
|
-
<div className="space-y-4">
|
|
224
|
-
<div>
|
|
225
|
-
<Label>Name</Label>
|
|
226
|
-
<Input value={form.name} onChange={(e) => setForm({ ...form, name: e.target.value })} />
|
|
227
|
-
</div>
|
|
228
|
-
<Button onClick={handleSubmit} disabled={createEvent.isPending}>
|
|
229
|
-
Create
|
|
230
|
-
</Button>
|
|
231
|
-
</div>
|
|
232
|
-
</DialogContent>
|
|
233
|
-
</Dialog>
|
|
234
|
-
);
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
### Page Composition (Combine Slices)
|
|
239
|
-
|
|
240
|
-
```typescript
|
|
241
|
-
export function EventsPage() {
|
|
242
|
-
const [dialogOpen, setDialogOpen] = useState(false);
|
|
243
|
-
|
|
244
|
-
return (
|
|
245
|
-
<div className="p-6">
|
|
246
|
-
<div className="flex justify-between mb-6">
|
|
247
|
-
<h1 className="text-2xl font-bold">Events</h1>
|
|
248
|
-
<Button onClick={() => setDialogOpen(true)}>Create Event</Button>
|
|
249
|
-
</div>
|
|
250
|
-
|
|
251
|
-
<EventList />
|
|
252
|
-
<CreateEventDialog open={dialogOpen} onOpenChange={setDialogOpen} />
|
|
253
|
-
</div>
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
50
|
```
|
|
257
51
|
|
|
258
|
-
|
|
52
|
+
The learnings section is critical - it helps future iterations avoid repeating mistakes and understand the codebase
|
|
53
|
+
better.
|
|
259
54
|
|
|
260
|
-
##
|
|
55
|
+
## Consolidate Patterns
|
|
261
56
|
|
|
262
|
-
|
|
57
|
+
If you discover a **reusable pattern** that future iterations should know, add it to the `## Codebase Patterns` section
|
|
58
|
+
at the TOP of progress.txt (create it if it doesn't exist). This section should consolidate the most important
|
|
59
|
+
learnings:
|
|
263
60
|
|
|
264
|
-
**For complete UI generation from slices:**
|
|
265
|
-
```bash
|
|
266
|
-
# Use the orchestrator skill - it handles everything
|
|
267
|
-
/ui-build-slice-ui <slice-file-paths>
|
|
268
61
|
```
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
3. Generate types (`/ui-generate-types`)
|
|
274
|
-
4. Generate API functions (`/ui-generate-api`)
|
|
275
|
-
5. Generate hooks (`/ui-generate-hook`)
|
|
276
|
-
6. Scaffold components (`/ui-scaffold-component`)
|
|
277
|
-
7. Verify integration
|
|
278
|
-
|
|
279
|
-
**For individual tasks:**
|
|
280
|
-
- **Analyze before coding**: `/ui-analyze-slices <slice-files>` - Understand grouping and dependencies
|
|
281
|
-
- **Read requirements**: `/ui-read-ui-prompts <slice-folder>` - Extract design specs and validation rules
|
|
282
|
-
- **Generate types only**: `/ui-generate-types <slice-file>` - Create TypeScript interfaces
|
|
283
|
-
- **Generate API only**: `/ui-generate-api <slice-file>` - Create Supabase queries or POST commands
|
|
284
|
-
- **Generate hook only**: `/ui-generate-hook <slice-file>` - Create React Query hooks
|
|
285
|
-
- **Generate component only**: `/ui-scaffold-component <slice-files>` - Create React components with Bulma CSS
|
|
286
|
-
|
|
287
|
-
### Manual Workflow (If not using skills)
|
|
288
|
-
|
|
289
|
-
### Step 0: Analyze Grouping
|
|
290
|
-
- Find all slices with same `groupId`
|
|
291
|
-
- Check `codeGen.uiPrompts` and `ui-prompt.md`
|
|
292
|
-
- Plan to implement together
|
|
293
|
-
|
|
294
|
-
### Step 1: Types
|
|
295
|
-
```typescript
|
|
296
|
-
// src/types/index.ts
|
|
297
|
-
export interface Event {
|
|
298
|
-
event_id: string;
|
|
299
|
-
name: string;
|
|
300
|
-
date: string;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export interface CreateEventParams {
|
|
304
|
-
name: string;
|
|
305
|
-
date: string;
|
|
306
|
-
}
|
|
62
|
+
## Codebase Patterns
|
|
63
|
+
- Example: Use `sql<number>` template for aggregations
|
|
64
|
+
- Example: Always use `IF NOT EXISTS` for migrations
|
|
65
|
+
- Example: Export types from actions.ts for UI components
|
|
307
66
|
```
|
|
308
67
|
|
|
309
|
-
|
|
310
|
-
- Add endpoints to `src/lib/api-client.ts`
|
|
311
|
-
- Implement queries (Supabase) in `src/lib/api.ts`
|
|
312
|
-
- Implement commands (POST) in `src/lib/api.ts`
|
|
313
|
-
|
|
314
|
-
### Step 3: Hooks
|
|
315
|
-
- Create query/mutation hooks in `src/hooks/api/use<Entity>.ts`
|
|
316
|
-
- Export in `src/hooks/api/index.ts`
|
|
317
|
-
|
|
318
|
-
### Step 4: Components
|
|
319
|
-
- Build list component (STATE_VIEW)
|
|
320
|
-
- Build dialog/form components (STATE_CHANGE)
|
|
321
|
-
- Compose into page component
|
|
322
|
-
|
|
323
|
-
---
|
|
68
|
+
Only add patterns that are **general and reusable**, not story-specific details.
|
|
324
69
|
|
|
325
|
-
##
|
|
70
|
+
## Update AGENTS.md Files
|
|
326
71
|
|
|
327
|
-
|
|
328
|
-
|-----------|-----------|--------------|
|
|
329
|
-
| `string` | `string` | `<Input type="text">` |
|
|
330
|
-
| `number` | `number` | `<Input type="number">` |
|
|
331
|
-
| `date` | `string` | `<Input type="date">` |
|
|
332
|
-
| `time` | `string` | `<Input type="time">` |
|
|
333
|
-
| `boolean` | `boolean` | `<Switch>` or `<Checkbox>` |
|
|
72
|
+
Before committing, check if any edited files have learnings worth preserving in nearby AGENTS.md files:
|
|
334
73
|
|
|
335
|
-
|
|
74
|
+
1. **Identify directories with edited files** - Look at which directories you modified
|
|
75
|
+
3. **Add valuable learnings that apply to all tasks** to the Agents.md - If you discovered something future developers/agents should know:
|
|
76
|
+
- API patterns or conventions specific to that module
|
|
77
|
+
- Gotchas or non-obvious requirements
|
|
78
|
+
- Dependencies between files
|
|
79
|
+
- Testing approaches for that area
|
|
80
|
+
- Configuration or environment requirements
|
|
336
81
|
|
|
337
|
-
|
|
82
|
+
**Examples of good AGENTS.md additions:**
|
|
338
83
|
|
|
339
|
-
|
|
84
|
+
- "When modifying X, also update Y to keep them in sync"
|
|
85
|
+
- "This module uses pattern Z for all API calls"
|
|
86
|
+
- "Tests require the dev server running on PORT 3000"
|
|
87
|
+
- "Field names must match the template exactly"
|
|
340
88
|
|
|
341
|
-
**
|
|
342
|
-
```typescript
|
|
343
|
-
try {
|
|
344
|
-
await mutation.mutateAsync(params);
|
|
345
|
-
toast.success("Success");
|
|
346
|
-
} catch (err) {
|
|
347
|
-
toast.error(`Error: ${err.message}`);
|
|
348
|
-
}
|
|
349
|
-
```
|
|
89
|
+
**Do NOT add:**
|
|
350
90
|
|
|
351
|
-
|
|
91
|
+
- Slice specific implementation details
|
|
92
|
+
- Story-specific implementation details
|
|
93
|
+
- Temporary debugging notes
|
|
94
|
+
- Information already in progress.txt
|
|
95
|
+
- Task speecific learnings like "- Timesheet approval requires: submitted=true, reverted=false, approved=false, declined=false"
|
|
352
96
|
|
|
353
|
-
|
|
97
|
+
Only update AGENTS.md if you have **genuinely reusable knowledge** that would help future work
|
|
354
98
|
|
|
355
|
-
|
|
99
|
+
## Quality Requirements
|
|
356
100
|
|
|
357
|
-
|
|
101
|
+
- ALL commits must pass your project's quality checks (typecheck, lint, test)
|
|
102
|
+
- run 'npm run build'
|
|
103
|
+
- run 'npm run test'
|
|
104
|
+
- Do NOT commit broken code
|
|
105
|
+
- Keep changes focused and minimal
|
|
106
|
+
- Follow existing code patterns
|
|
358
107
|
|
|
359
|
-
|
|
108
|
+
## Skills
|
|
360
109
|
|
|
361
|
-
|
|
110
|
+
Use the provided skills in the skills folder as guidance.
|
|
111
|
+
Update skill definitions if you find an improvement you can make.
|
|
362
112
|
|
|
363
|
-
|
|
364
|
-
- Layout: `container`, `section`, `columns`, `column`
|
|
365
|
-
- Components: `card`, `modal`, `button`, `notification`, `box`
|
|
366
|
-
- Forms: `field`, `control`, `label`, `input`, `select`, `textarea`
|
|
367
|
-
- Modifiers: `is-primary`, `is-active`, `is-fullwidth`, `has-text-centered`
|
|
113
|
+
## Specifications
|
|
368
114
|
|
|
369
|
-
|
|
115
|
+
For every specification added to the Slice, you need to implement one use executable Specification in Code.
|
|
370
116
|
|
|
371
|
-
|
|
117
|
+
A Slice is not complete if specifications are missing or can´t be executed.
|
|
372
118
|
|
|
373
|
-
|
|
374
|
-
- `Button`, `Input`, `Label`, `Textarea`, `Select`
|
|
375
|
-
- `Card`, `CardHeader`, `CardTitle`, `CardContent`
|
|
376
|
-
- `Dialog`, `DialogContent`, `DialogHeader`, `DialogTitle`
|
|
377
|
-
- `Table`, `Tabs`, `Skeleton`
|
|
378
|
-
- `toast` from `sonner`
|
|
119
|
+
## Stop Condition
|
|
379
120
|
|
|
380
|
-
|
|
121
|
+
After completing a user story, check if ALL slices have `status: Done`.
|
|
381
122
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
## Checklist
|
|
123
|
+
If ALL stories are complete and passing, reply with:
|
|
124
|
+
<promise>COMPLETE</promise>
|
|
385
125
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
- [ ] Read `ui-prompt.md` and `codeGen.uiPrompts`
|
|
389
|
-
- [ ] Identify STATE_VIEW vs STATE_CHANGE slices
|
|
126
|
+
If there are no stories with `status: Planned` (but not all are Done), reply with:
|
|
127
|
+
<promise>NO_TASKS</promise>
|
|
390
128
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
- [ ] Add endpoints to `src/lib/api-client.ts`
|
|
394
|
-
- [ ] Implement API functions in `src/lib/api.ts`
|
|
395
|
-
- [ ] Create hooks in `src/hooks/api/use<Entity>.ts`
|
|
396
|
-
- [ ] Build components in `src/components/<domain>/`
|
|
397
|
-
- [ ] Compose page combining all grouped slices
|
|
398
|
-
- [ ] Test loading, error handling, success flows
|
|
129
|
+
If there are still stories with `status: Planned`, end your response normally (another iteration will pick up the next
|
|
130
|
+
story).
|
|
399
131
|
|
|
400
|
-
|
|
132
|
+
## Important
|
|
401
133
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
✅ **STATE_CHANGE** = Command → Mutation hook → Form/Dialog
|
|
407
|
-
✅ **Keep modular** = Sub-components for each slice capability
|
|
408
|
-
✅ **Keep simple** = Follow existing patterns, don't over-engineer
|
|
409
|
-
|
|
410
|
-
---
|
|
411
|
-
|
|
412
|
-
## 10. Skills Usage Examples
|
|
413
|
-
|
|
414
|
-
### Example 1: Building Complete UI from Scratch
|
|
415
|
-
|
|
416
|
-
**User Request**: "Build the UI for the events management slices"
|
|
417
|
-
|
|
418
|
-
**Your Response**:
|
|
419
|
-
```bash
|
|
420
|
-
# First, analyze what we're working with
|
|
421
|
-
/ui-analyze-slices src/slices/events/*.json
|
|
422
|
-
|
|
423
|
-
# Then build everything at once
|
|
424
|
-
/ui-build-slice-ui src/slices/events/ViewEvents.json src/slices/events/CreateEvent.json
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Example 2: Just Need to Understand Slices
|
|
428
|
-
|
|
429
|
-
**User Request**: "What slices are in the orders group?"
|
|
430
|
-
|
|
431
|
-
**Your Response**:
|
|
432
|
-
```bash
|
|
433
|
-
# Use ui-analyze-slices to understand the grouping
|
|
434
|
-
/ui-analyze-slices src/slices/orders/*.json
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
### Example 3: Regenerating Just Types
|
|
438
|
-
|
|
439
|
-
**User Request**: "The Event interface is wrong, regenerate it from the slice"
|
|
440
|
-
|
|
441
|
-
**Your Response**:
|
|
442
|
-
```bash
|
|
443
|
-
# Use ui-generate-types to recreate just the TypeScript interfaces
|
|
444
|
-
/ui-generate-types src/slices/events/ViewEvents.json
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
### Example 4: Adding New API Endpoint
|
|
448
|
-
|
|
449
|
-
**User Request**: "Add the API function for the CancelEvent command"
|
|
450
|
-
|
|
451
|
-
**Your Response**:
|
|
452
|
-
```bash
|
|
453
|
-
# Use ui-generate-api to create the API layer
|
|
454
|
-
/ui-generate-api src/slices/events/CancelEvent.json
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### Example 5: Understanding UI Requirements
|
|
458
|
-
|
|
459
|
-
**User Request**: "What are the validation rules for the event form?"
|
|
460
|
-
|
|
461
|
-
**Your Response**:
|
|
462
|
-
```bash
|
|
463
|
-
# Use ui-read-ui-prompts to extract requirements
|
|
464
|
-
/ui-read-ui-prompts src/slices/events/
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
### Example 6: Fixing Component Styling
|
|
468
|
-
|
|
469
|
-
**User Request**: "The EventList component doesn't look right, regenerate it with proper Bulma styling"
|
|
470
|
-
|
|
471
|
-
**Your Response**:
|
|
472
|
-
```bash
|
|
473
|
-
# Use ui-scaffold-component to regenerate with Bulma CSS
|
|
474
|
-
/ui-scaffold-component src/slices/events/ViewEvents.json
|
|
475
|
-
```
|
|
476
|
-
|
|
477
|
-
### Decision Tree: Which Skill to Use?
|
|
478
|
-
|
|
479
|
-
```
|
|
480
|
-
Need to build complete UI from slices?
|
|
481
|
-
└─> /ui-build-slice-ui (orchestrates everything)
|
|
482
|
-
|
|
483
|
-
Just exploring/understanding?
|
|
484
|
-
└─> /ui-analyze-slices (analysis only)
|
|
485
|
-
|
|
486
|
-
Just need to understand UI requirements?
|
|
487
|
-
└─> /ui-read-ui-prompts (extract specs)
|
|
488
|
-
|
|
489
|
-
Need to fix/regenerate specific layer?
|
|
490
|
-
├─> Types wrong? → /ui-generate-types
|
|
491
|
-
├─> API functions wrong? → /ui-generate-api
|
|
492
|
-
├─> Hooks wrong? → /ui-generate-hook
|
|
493
|
-
└─> Components wrong? → /ui-scaffold-component
|
|
494
|
-
|
|
495
|
-
Don't know which skill to use?
|
|
496
|
-
└─> Start with /ui-analyze-slices, then use /ui-build-slice-ui
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
---
|
|
134
|
+
- Work on ONE slice per iteration
|
|
135
|
+
- Commit frequently
|
|
136
|
+
- update progress.txt frequently
|
|
137
|
+
- Read the Codebase Patterns section in progress.txt before starting
|
|
500
138
|
|
|
501
|
-
##
|
|
139
|
+
## When an iteration completes
|
|
502
140
|
|
|
503
|
-
|
|
504
|
-
- Consistency across the codebase
|
|
505
|
-
- Proper use of Bulma CSS
|
|
506
|
-
- Correct CQRS patterns
|
|
507
|
-
- Proper TypeScript types
|
|
508
|
-
- React Query best practices
|
|
509
|
-
- Adherence to UI prompts and validation rules
|
|
141
|
+
Use all the key learnings from the project.txt and update the Agends.md file with those learning.
|
|
@@ -10,7 +10,7 @@ If a slice is in status 'planned', Even if a slice seems to have been implemente
|
|
|
10
10
|
1. Read the description at `.slices/index.json` (in the same directory as this file). Every item in status "planned" and assigned to "ui_worker" is a task.
|
|
11
11
|
2. Read the progress log at `progress.txt` (check Codebase Patterns section first)
|
|
12
12
|
3. Make sure you are on the right branch "feature/<slicename>", the branch should exist.
|
|
13
|
-
5. Pick the **highest priority** task assigned to ui_worker. This becomes your
|
|
13
|
+
5. Pick the **highest priority** task assigned to ui_worker. This becomes your task. Set the status "InProgress", add a started_date ( including date and time ) in the index.json. If no slice has status planned, reply with:
|
|
14
14
|
<promise>NO_TASKS</promise> and stop. Do not work on other slices.
|
|
15
15
|
6. Pick the slice definition from the project root /.slices in <folder> defined in the prd. Never work on more than one slice per iteration.
|
|
16
16
|
7. A slice can define additional prompts as codegen/uiPrompt. any additional prompts defined in backend are hints for the implementation of the slice and have to be taken into account. If you use the additional prompt, add a line in progress.txt
|
|
@@ -18,15 +18,15 @@ If a slice is in status 'planned', Even if a slice seems to have been implemente
|
|
|
18
18
|
9. Analyze and Implement according to the Rest of the instructions in this file, make use of the skills in the skills directory, but also your previsously collected
|
|
19
19
|
knowledge. Make a list TODO list for what needs to be done. Also make sure to adjust the implementation according to the json definition.
|
|
20
20
|
10. The slice in the json is always true, the code follows what is defined in the json
|
|
21
|
-
11.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
11. make sure to read the ui-prompt.md in /backend/src/slices/<slice>/
|
|
22
|
+
13. carefully read custom uiPrompt in the slice.json and follow the instructions. If no mount point is defined in uiPrompt, verify if there is natural place where to mount the component. If there is no natural place, create a new page, name it after the Component and define a Route in App.tsx
|
|
23
|
+
14. Run quality checks ( npm run build, tsc ) - Attention - the slice is only done if the component is mounted and testable.
|
|
24
|
+
15. Make sure to style components according to the style guides.
|
|
25
25
|
16. Update the Slice in the index.json to status 'Done' and remove assignment
|
|
26
|
-
17.
|
|
26
|
+
17. Append your progress to `progress.txt` after each step in the iteration.
|
|
27
|
+
18. append your new learnings to frontend/AGENTS.md in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
|
|
28
|
+
19. If checks pass, commit ALL changes with message: `feat: [Slice Name]` and merge back to main as FF merge ( update
|
|
27
29
|
first )
|
|
28
|
-
18. Append your progress to `progress.txt` after each step in the iteration.
|
|
29
|
-
19. append your new learnings to frontend/AGENTS.md in a compressed form, reusable for future iterations. Only add learnings if they are not already there.
|
|
30
30
|
20. Finish the iteration.
|
|
31
31
|
|
|
32
32
|
---
|
package/templates/prompt.md
CHANGED
|
@@ -5,7 +5,7 @@ You assign tasks to workers. Only one task can be assigned and in status planned
|
|
|
5
5
|
|
|
6
6
|
## Your Task
|
|
7
7
|
|
|
8
|
-
1. find the most important next slice by
|
|
8
|
+
1. find the most important next slice by reading .slices/index.json
|
|
9
9
|
2. if the slice is in status planned and not assigned, assign it to backend_worker (property "assigned" ) and continue with backend/prompt.md. Ignore the rest of this file.
|
|
10
10
|
3. if the status is in status "InProgress" and assigned to backend_worker, updated started_time and continue with backend/prompt.md. Ignore the rest of this file.
|
|
11
11
|
4. if the status is "done" and assigned to "backend_worker", assign the task to "ui_worker" and move it back to status "planned". continue with frontend/prompt.md. Ignore the rest of this file.
|