oneie 3.6.7 → 3.6.12
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/.claude/agents/agent-backend.md +83 -0
- package/.claude/agents/agent-designer.md +97 -0
- package/.claude/agents/agent-director.md +118 -7
- package/.claude/agents/agent-documenter.md +93 -0
- package/.claude/agents/agent-frontend.md +96 -0
- package/.claude/agents/agent-ops.md +264 -32
- package/.claude/agents/agent-problem-solver.md +166 -0
- package/.claude/agents/agent-quality.md +127 -0
- package/.claude/commands/build.md +293 -0
- package/.claude/commands/cascade.md +231 -127
- package/.claude/commands/deploy.md +56 -17
- package/.claude/commands/mcp-toggle.md +93 -0
- package/.claude/commands/one.md +78 -127
- package/.claude/commands/plan.md +394 -80
- package/.claude/commands/push.md +75 -14
- package/.claude/commands/release.md +89 -25
- package/.claude/commands/server.md +2 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/root-cleanup.py +75 -0
- package/.claude/skills/INDEX.md +523 -0
- package/.claude/skills/REGISTRY.md +529 -0
- package/.claude/skills/agent-backend-create-mutation.md +319 -0
- package/.claude/skills/agent-designer-create-wireframe.md +341 -0
- package/.claude/skills/agent-frontend-create-page.md +413 -0
- package/.claude/skills/agents/README.md +238 -0
- package/dist/clone-web.js +1 -1
- package/dist/clone-web.js.map +1 -1
- package/folders.yaml +1 -1
- package/one/.obsidian/workspace.json +38 -38
- package/one/connections/api/queries-reference.md +842 -0
- package/one/connections/api-reference.md +1011 -0
- package/one/connections/integration-examples.md +875 -0
- package/one/connections/integration-guide.md +869 -0
- package/one/connections/integration-phase2.md +736 -0
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
- package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
- package/one/events/CONNECTIONS_DEMO.md +501 -0
- package/one/events/DELIVERABLES.md +432 -0
- package/one/events/DEMO-GROUPS-PAGE.md +392 -0
- package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
- package/one/events/DEMO_COMPONENTS.md +487 -0
- package/one/events/DEMO_HOOKS_INDEX.md +334 -0
- package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
- package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
- package/one/events/DEMO_SETUP.md +476 -0
- package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
- package/one/events/HOOKS-DEMO.md +441 -0
- package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
- package/one/events/QA-CHECKLIST.md +674 -0
- package/one/events/QUICK-START-ONTOLOGY.md +408 -0
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
- package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
- package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
- package/one/events/TEST-PLAN-INDEX.md +346 -0
- package/one/events/TEST-PLAN.md +1417 -0
- package/one/events/TESTING-DELIVERY.txt +372 -0
- package/one/events/TRANSITIONS-QUICK-START.md +141 -0
- package/one/events/TYPESCRIPT_FIXES.md +152 -0
- package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
- package/one/events/VIEW-TRANSITIONS.md +428 -0
- package/one/events/backend-integration-tests.md +606 -0
- package/one/events/backend-structure-diagram.txt +393 -0
- package/one/events/backend-structure-summary.txt +269 -0
- package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
- package/one/events/convex-analysis-index.md +304 -0
- package/one/events/convex-structure-analysis.md +700 -0
- package/one/events/design-spec-complete.md +208 -0
- package/one/events/ontology-test-examples.md +562 -0
- package/one/events/phase1-backend-implementation-complete.md +518 -0
- package/one/events/test-dashboard.md +345 -0
- package/one/events/test-index.md +361 -0
- package/one/events/test-report-ontology.md +582 -0
- package/one/events/testing-summary.md +344 -0
- package/one/groups/features.md +2878 -0
- package/one/groups/strategy copy.md +869 -0
- package/one/knowledge/backend-api-reference.md +710 -0
- package/one/knowledge/documentation-summary.md +285 -0
- package/one/knowledge/lessons-learned.md +294 -4
- package/one/knowledge/ontology-visual-guide.md +360 -0
- package/one/knowledge/ontology.md +9 -17
- package/one/things/demo-accessibility-animations.md +999 -0
- package/one/things/demo-components.md +1304 -0
- package/one/things/demo-design-summary.md +629 -0
- package/one/things/demo-design-system.md +919 -0
- package/one/things/demo-page-layouts.md +989 -0
- package/one/things/designs/accessibility-audit.md +790 -0
- package/one/things/designs/component-specifications.md +757 -0
- package/one/things/designs/design-overview.md +318 -0
- package/one/things/designs/design-tokens.md +414 -0
- package/one/things/designs/wireframes-dashboard.md +653 -0
- package/one/things/docs/api-requests.md +923 -0
- package/one/things/features/0 All Features.md +2 -0
- package/one/things/implementation/backend-guide.md +412 -0
- package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
- package/one/things/plans/2-sites.md +895 -0
- package/one/things/plans/ai-elements.md +1259 -0
- package/one/things/plans/ai-integration.md +947 -0
- package/one/things/plans/ai-sdk.md +761 -0
- package/one/things/plans/app.md +1 -1
- package/one/things/plans/architecture-summary.md +283 -0
- package/one/things/plans/async-ai-agents.md +215 -0
- package/one/things/plans/backend-agnostic-frontend.md +11 -6
- package/one/things/plans/backend-cleanup-quickstart.md +346 -0
- package/one/things/plans/backend-ontology-conformance.md +416 -0
- package/one/things/plans/backend-status.md +541 -0
- package/one/things/plans/backend-structure.md +799 -0
- package/one/things/plans/backend-target-structure.md +438 -0
- package/one/things/plans/backend.md +1133 -0
- package/one/things/plans/better-auth-any-backend.md +11 -11
- package/one/things/plans/cli-updates-required.md +280 -0
- package/one/things/plans/complete-step-by-step.md +1302 -0
- package/one/things/plans/convex-agents.md +1005 -0
- package/one/things/plans/deployment-architecture.md +426 -0
- package/one/things/plans/development-plan.md +1220 -0
- package/one/things/plans/effect.md +808 -48
- package/one/things/plans/integrate-frontend-and-backend.md +579 -0
- package/one/things/plans/mcp-clear-context-prompt.md +60 -0
- package/one/things/plans/mcp-simple.md +228 -0
- package/one/things/plans/one.md +8 -7
- package/one/things/plans/ontology-6-dimensions.md +20 -14
- package/one/things/plans/quick-wins.md +1273 -0
- package/one/things/plans/readme-backend-cleanup.md +361 -0
- package/one/things/plans/separate-demo.md +830 -0
- package/one/things/plans/separate.md +3 -3
- package/one/things/plans/sequence.md +1897 -0
- package/one/things/plans/sync-checklist.md +321 -0
- package/one/things/plans/unified-implementation-plan.md +3 -3
- package/one/things/plans/update-demos.md +513 -0
- package/package.json +1 -1
- package/.claude/agents/backend-specialist.md +0 -169
- package/.claude/agents/designer.md +0 -216
- package/.claude/agents/frontend-specialist.md +0 -236
- package/.claude/commands/done.md +0 -35
- package/.claude/commands/infer.md +0 -138
- package/.claude/commands/next.md +0 -53
- package/.claude/commands/one copy.md +0 -565
- package/.claude/commands/one-template.md +0 -106
- package/.claude/commands/one-v1.md +0 -609
- package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
- package/one/groups/nine-padel-customers.md +0 -138
- package/one/groups/nine-padel-data-structure.md +0 -167
- package/one/groups/nine-padel-ontology-specification.md +0 -359
- package/one/groups/nine-padel-ontology.md +0 -143
- package/one/groups/nine-padel-strategy.md +0 -234
- package/one/groups/nine-padel.md +0 -211
- package/one/groups/nine-padle-contents.baked.md +0 -1252
- package/one/groups/nine-padle-contents.md +0 -6
- package/one/things/features/1-1-agent-prompts/design.md +0 -470
- package/one/things/features/1-1-agent-prompts/tests.md +0 -264
- package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
- package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
- package/one/things/features/1-3-event-coordination/design.md +0 -544
- package/one/things/features/1-3-event-coordination/tests.md +0 -223
- package/one/things/features/1-4-knowledge-management/design.md +0 -609
- package/one/things/features/1-4-knowledge-management/tests.md +0 -195
- package/one/things/features/1-5-quality-loops/design.md +0 -797
- package/one/things/features/1-5-quality-loops/tests.md +0 -212
- package/one/things/features/1-6-numbering-structure/design.md +0 -610
- package/one/things/features/1-6-numbering-structure/tests.md +0 -213
- package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-backend:create-mutation
|
|
3
|
+
description: Generate Convex mutations with 6-dimension ontology validation, event logging, and organization scoping
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent-Backend: Create Mutation
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Generate production-ready Convex mutations that:
|
|
11
|
+
- Validate authentication and organization context
|
|
12
|
+
- Implement 6-dimension ontology operations (things, connections, events)
|
|
13
|
+
- Log events for audit trails
|
|
14
|
+
- Enforce organization quotas
|
|
15
|
+
- Handle errors with meaningful messages
|
|
16
|
+
|
|
17
|
+
## When to Use This Skill
|
|
18
|
+
|
|
19
|
+
- Implementing new mutation handlers
|
|
20
|
+
- Creating CRUD operations for entities
|
|
21
|
+
- Building state-change operations
|
|
22
|
+
- Enforcing multi-tenant isolation
|
|
23
|
+
- Adding event logging
|
|
24
|
+
|
|
25
|
+
## Instructions
|
|
26
|
+
|
|
27
|
+
### 1. Map to 6 Dimensions
|
|
28
|
+
|
|
29
|
+
Identify what dimensions the mutation affects:
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
// Example: Creating a course (mutation affects multiple dimensions)
|
|
33
|
+
// 3. THINGS: Create course entity
|
|
34
|
+
// 4. CONNECTIONS: Create owns relationship
|
|
35
|
+
// 5. EVENTS: Log course_created event
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Use Standard Mutation Pattern
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
export const create = mutation({
|
|
42
|
+
args: {
|
|
43
|
+
name: v.string(),
|
|
44
|
+
properties: v.any(),
|
|
45
|
+
},
|
|
46
|
+
handler: async (ctx, args) => {
|
|
47
|
+
// 1. AUTHENTICATE
|
|
48
|
+
const identity = await ctx.auth.getUserIdentity();
|
|
49
|
+
if (!identity) throw new Error("Not authenticated");
|
|
50
|
+
|
|
51
|
+
// 2. GET ACTOR (person/creator)
|
|
52
|
+
const person = await ctx.db.query("things")
|
|
53
|
+
.withIndex("by_type_and_email", q =>
|
|
54
|
+
q.eq("type", "user")
|
|
55
|
+
.eq("properties.email", identity.email)
|
|
56
|
+
)
|
|
57
|
+
.first();
|
|
58
|
+
if (!person) throw new Error("User not found");
|
|
59
|
+
|
|
60
|
+
// 3. VALIDATE ORGANIZATION
|
|
61
|
+
const org = await ctx.db.get(person.groupId);
|
|
62
|
+
if (!org || org.status !== "active") {
|
|
63
|
+
throw new Error("Organization invalid or inactive");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 4. CHECK QUOTAS
|
|
67
|
+
if (org.properties.usage.things >= org.properties.limits.things) {
|
|
68
|
+
throw new Error("Entity limit reached for this plan");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 5. CREATE ENTITY (Dimension 3: Things)
|
|
72
|
+
const entityId = await ctx.db.insert("entities", {
|
|
73
|
+
groupId: person.groupId,
|
|
74
|
+
type: args.type, // e.g., "course", "product"
|
|
75
|
+
name: args.name,
|
|
76
|
+
properties: args.properties,
|
|
77
|
+
status: "draft",
|
|
78
|
+
createdAt: Date.now(),
|
|
79
|
+
updatedAt: Date.now(),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// 6. CREATE OWNERSHIP CONNECTION (Dimension 4: Connections)
|
|
83
|
+
await ctx.db.insert("connections", {
|
|
84
|
+
groupId: person.groupId,
|
|
85
|
+
fromEntityId: person._id,
|
|
86
|
+
toEntityId: entityId,
|
|
87
|
+
relationshipType: "owns",
|
|
88
|
+
metadata: { createdVia: "api" },
|
|
89
|
+
validFrom: Date.now(),
|
|
90
|
+
createdAt: Date.now(),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// 7. LOG EVENT (Dimension 5: Events)
|
|
94
|
+
await ctx.db.insert("events", {
|
|
95
|
+
groupId: person.groupId,
|
|
96
|
+
type: `thing_created`,
|
|
97
|
+
actorId: person._id,
|
|
98
|
+
targetId: entityId,
|
|
99
|
+
timestamp: Date.now(),
|
|
100
|
+
metadata: {
|
|
101
|
+
thingType: args.type,
|
|
102
|
+
source: "api",
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// 8. UPDATE ORGANIZATION USAGE
|
|
107
|
+
await ctx.db.patch(org._id, {
|
|
108
|
+
properties: {
|
|
109
|
+
...org.properties,
|
|
110
|
+
usage: {
|
|
111
|
+
...org.properties.usage,
|
|
112
|
+
things: (org.properties.usage?.things || 0) + 1,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
updatedAt: Date.now(),
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
return entityId;
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 3. Validation Patterns
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// Type validation
|
|
127
|
+
export function validateEntityType(type: string): string {
|
|
128
|
+
const validTypes = THING_TYPES; // From ontology
|
|
129
|
+
if (!validTypes.includes(type)) {
|
|
130
|
+
throw new Error(`Invalid type. Must be one of: ${validTypes.join(", ")}`);
|
|
131
|
+
}
|
|
132
|
+
return type;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Permission validation
|
|
136
|
+
export function validatePermission(person, org, requiredRole) {
|
|
137
|
+
const role = person.properties.role;
|
|
138
|
+
const allowedRoles = ROLE_HIERARCHY[requiredRole] || [];
|
|
139
|
+
if (!allowedRoles.includes(role)) {
|
|
140
|
+
throw new Error(`Permission denied. Required role: ${requiredRole}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Organization scoping
|
|
145
|
+
function validateOrgContext(person, org) {
|
|
146
|
+
if (!person.groupId || person.groupId !== org._id) {
|
|
147
|
+
throw new Error("Organization mismatch");
|
|
148
|
+
}
|
|
149
|
+
if (org.status === "suspended") {
|
|
150
|
+
throw new Error("Organization suspended");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 4. Event Logging Pattern
|
|
156
|
+
|
|
157
|
+
Every state change must log an event:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
// ALWAYS log after mutations
|
|
161
|
+
await ctx.db.insert("events", {
|
|
162
|
+
groupId: person.groupId,
|
|
163
|
+
type: "thing_created", // Use specific event types
|
|
164
|
+
actorId: person._id, // Who did it
|
|
165
|
+
targetId: entityId, // What was affected
|
|
166
|
+
timestamp: Date.now(),
|
|
167
|
+
metadata: {
|
|
168
|
+
// Include context for audit trail
|
|
169
|
+
entityType: args.type,
|
|
170
|
+
properties: args.properties,
|
|
171
|
+
source: "api",
|
|
172
|
+
userAgent: ctx.request?.headers.get("user-agent"),
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 5. Error Handling
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
try {
|
|
181
|
+
// Mutation logic
|
|
182
|
+
const entityId = await ctx.db.insert("entities", { /* ... */ });
|
|
183
|
+
return entityId;
|
|
184
|
+
} catch (error) {
|
|
185
|
+
// Log errors for debugging
|
|
186
|
+
console.error("Mutation failed:", {
|
|
187
|
+
handler: "create",
|
|
188
|
+
actor: person._id,
|
|
189
|
+
organization: org._id,
|
|
190
|
+
error: error.message,
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Return meaningful error
|
|
194
|
+
if (error.message.includes("Limit reached")) {
|
|
195
|
+
throw new Error("You've reached your plan limit. Upgrade to create more.");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Critical Rules
|
|
203
|
+
|
|
204
|
+
1. **ALWAYS authenticate** - Every mutation starts with `ctx.auth.getUserIdentity()`
|
|
205
|
+
2. **ALWAYS validate organization** - Check organization status and existence
|
|
206
|
+
3. **ALWAYS check quotas** - Enforce plan limits before operations
|
|
207
|
+
4. **ALWAYS log events** - Every state change creates an event
|
|
208
|
+
5. **ALWAYS scope by groupId** - Multi-tenant isolation is mandatory
|
|
209
|
+
6. **ALWAYS use indexes** - Query with `withIndex()` for performance
|
|
210
|
+
|
|
211
|
+
## Example: Creating a Course
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
export const create = mutation({
|
|
215
|
+
args: {
|
|
216
|
+
name: v.string(),
|
|
217
|
+
description: v.optional(v.string()),
|
|
218
|
+
modules: v.optional(v.array(v.object({
|
|
219
|
+
title: v.string(),
|
|
220
|
+
duration: v.number(),
|
|
221
|
+
}))),
|
|
222
|
+
},
|
|
223
|
+
handler: async (ctx, args) => {
|
|
224
|
+
// 1. Authenticate
|
|
225
|
+
const identity = await ctx.auth.getUserIdentity();
|
|
226
|
+
if (!identity) throw new Error("Not authenticated");
|
|
227
|
+
|
|
228
|
+
// 2. Get creator (person)
|
|
229
|
+
const creator = await ctx.db.query("things")
|
|
230
|
+
.withIndex("by_type_and_email", q =>
|
|
231
|
+
q.eq("type", "user")
|
|
232
|
+
.eq("properties.email", identity.email)
|
|
233
|
+
)
|
|
234
|
+
.first();
|
|
235
|
+
if (!creator) throw new Error("Creator not found");
|
|
236
|
+
|
|
237
|
+
// 3. Validate organization
|
|
238
|
+
const org = await ctx.db.get(creator.groupId);
|
|
239
|
+
if (!org || org.status !== "active") {
|
|
240
|
+
throw new Error("Organization invalid");
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// 4. Check quota
|
|
244
|
+
if (org.properties.usage.courses >= org.properties.limits.courses) {
|
|
245
|
+
throw new Error("Course limit reached");
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// 5. Create course entity
|
|
249
|
+
const courseId = await ctx.db.insert("entities", {
|
|
250
|
+
groupId: creator.groupId,
|
|
251
|
+
type: "course",
|
|
252
|
+
name: args.name,
|
|
253
|
+
properties: {
|
|
254
|
+
description: args.description,
|
|
255
|
+
modules: args.modules || [],
|
|
256
|
+
authorId: creator._id,
|
|
257
|
+
createdByAPI: true,
|
|
258
|
+
},
|
|
259
|
+
status: "draft",
|
|
260
|
+
createdAt: Date.now(),
|
|
261
|
+
updatedAt: Date.now(),
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
// 6. Create ownership connection
|
|
265
|
+
await ctx.db.insert("connections", {
|
|
266
|
+
groupId: creator.groupId,
|
|
267
|
+
fromEntityId: creator._id,
|
|
268
|
+
toEntityId: courseId,
|
|
269
|
+
relationshipType: "owns",
|
|
270
|
+
metadata: { role: "author" },
|
|
271
|
+
validFrom: Date.now(),
|
|
272
|
+
createdAt: Date.now(),
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// 7. Log event
|
|
276
|
+
await ctx.db.insert("events", {
|
|
277
|
+
groupId: creator.groupId,
|
|
278
|
+
type: "course_created",
|
|
279
|
+
actorId: creator._id,
|
|
280
|
+
targetId: courseId,
|
|
281
|
+
timestamp: Date.now(),
|
|
282
|
+
metadata: {
|
|
283
|
+
courseName: args.name,
|
|
284
|
+
moduleCount: args.modules?.length || 0,
|
|
285
|
+
},
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
// 8. Update usage
|
|
289
|
+
await ctx.db.patch(org._id, {
|
|
290
|
+
properties: {
|
|
291
|
+
...org.properties,
|
|
292
|
+
usage: {
|
|
293
|
+
...org.properties.usage,
|
|
294
|
+
courses: (org.properties.usage?.courses || 0) + 1,
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
updatedAt: Date.now(),
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
return courseId;
|
|
301
|
+
},
|
|
302
|
+
});
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Related Skills
|
|
306
|
+
|
|
307
|
+
- `agent-backend:create-query` - Complementary skill for reading data
|
|
308
|
+
- `agent-backend:design-schema` - Schema design for entities
|
|
309
|
+
- `agent-backend:validate-types` - TypeScript type generation
|
|
310
|
+
|
|
311
|
+
## Related Documentation
|
|
312
|
+
|
|
313
|
+
- [6-Dimension Ontology](../../../one/knowledge/ontology.md)
|
|
314
|
+
- [Backend Agent](../agents/agent-backend.md)
|
|
315
|
+
- [Convex Mutation Patterns](https://docs.convex.dev/functions/mutations)
|
|
316
|
+
|
|
317
|
+
## Version History
|
|
318
|
+
|
|
319
|
+
- **1.0.0** (2025-10-27): Initial implementation with 6-dimension mapping
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-designer:create-wireframe
|
|
3
|
+
description: Generate wireframes from feature specs and tests that enable acceptance criteria to pass
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Agent-Designer: Create Wireframe
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
|
|
10
|
+
Generate test-driven wireframes that:
|
|
11
|
+
- Map directly to acceptance criteria
|
|
12
|
+
- Show all states (default, loading, error, success)
|
|
13
|
+
- Include responsive breakpoints (320px, 768px, 1024px, 1440px)
|
|
14
|
+
- Specify component hierarchy and layout
|
|
15
|
+
- Ensure WCAG 2.1 AA accessibility
|
|
16
|
+
- Enable implementation without ambiguity
|
|
17
|
+
|
|
18
|
+
## When to Use This Skill
|
|
19
|
+
|
|
20
|
+
- Converting test requirements to visual designs
|
|
21
|
+
- Designing new features before implementation
|
|
22
|
+
- Creating layout specifications
|
|
23
|
+
- Planning component structure
|
|
24
|
+
- Validating that designs enable tests to pass
|
|
25
|
+
|
|
26
|
+
## Instructions
|
|
27
|
+
|
|
28
|
+
### 1. Read Test Requirements First
|
|
29
|
+
|
|
30
|
+
Before wireframing, read the test specification:
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
// From quality agent: test thing properties
|
|
34
|
+
{
|
|
35
|
+
userFlows: [
|
|
36
|
+
{
|
|
37
|
+
name: "Create Course",
|
|
38
|
+
steps: [
|
|
39
|
+
"Click 'New Course' button",
|
|
40
|
+
"Fill in course name",
|
|
41
|
+
"Select difficulty level",
|
|
42
|
+
"Click 'Create'"
|
|
43
|
+
],
|
|
44
|
+
goal: "User creates new course"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
acceptanceCriteria: [
|
|
48
|
+
"User can create course with just name",
|
|
49
|
+
"Form validates before submission",
|
|
50
|
+
"Loading spinner shows during save",
|
|
51
|
+
"Success message appears after creation",
|
|
52
|
+
"User is redirected to course detail page"
|
|
53
|
+
],
|
|
54
|
+
accessibility: "WCAG 2.1 AA"
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Map Acceptance Criteria to UI Elements
|
|
59
|
+
|
|
60
|
+
Create a mapping table:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
Acceptance Criterion → UI Element
|
|
64
|
+
"Create course with just name" → Input field (name, required)
|
|
65
|
+
"Form validates before submission" → Form validation on blur
|
|
66
|
+
"Loading spinner during save" → Button spinner + disabled state
|
|
67
|
+
"Success message appears" → Toast notification
|
|
68
|
+
"Redirected to detail page" → Automatic navigation
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Rule:** Every acceptance criterion must have a corresponding UI element. If not, the design is incomplete.
|
|
72
|
+
|
|
73
|
+
### 3. Wireframe Template Pattern
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
### Screen: Create Course
|
|
77
|
+
|
|
78
|
+
**Path:** /courses/new
|
|
79
|
+
**Layout Pattern:** centered-form
|
|
80
|
+
**Primary Goal:** User creates new course with minimal friction
|
|
81
|
+
|
|
82
|
+
**Ontology Operations:**
|
|
83
|
+
- Things created: `course` (type: course)
|
|
84
|
+
- Connections created: `owns` (creator → course)
|
|
85
|
+
- Events logged: `course_created`, `entity_created`
|
|
86
|
+
|
|
87
|
+
**Components:**
|
|
88
|
+
```
|
|
89
|
+
Card (max-w-2xl)
|
|
90
|
+
├── CardHeader
|
|
91
|
+
│ └── h1: "Create Course"
|
|
92
|
+
├── CardContent
|
|
93
|
+
│ └── Form
|
|
94
|
+
│ ├── FormField
|
|
95
|
+
│ │ ├── Label: "Course Name"
|
|
96
|
+
│ │ └── Input (type: text, required, autofocus)
|
|
97
|
+
│ ├── FormField
|
|
98
|
+
│ │ ├── Label: "Description"
|
|
99
|
+
│ │ └── Textarea (optional, rows: 4)
|
|
100
|
+
│ ├── FormField
|
|
101
|
+
│ │ ├── Label: "Difficulty"
|
|
102
|
+
│ │ └── Select (beginner, intermediate, advanced)
|
|
103
|
+
│ └── FormField (form actions)
|
|
104
|
+
│ ├── Button (type: submit, "Create Course")
|
|
105
|
+
│ └── Button (type: button, variant: ghost, "Cancel")
|
|
106
|
+
└── CardFooter
|
|
107
|
+
└── p: "Courses appear in draft status"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Responsive:**
|
|
111
|
+
- Mobile (320px): Single column, p-4
|
|
112
|
+
- Tablet (768px): max-w-2xl, mx-auto, p-6
|
|
113
|
+
- Desktop (1024px+): max-w-2xl, mx-auto, p-8
|
|
114
|
+
|
|
115
|
+
**States:**
|
|
116
|
+
- Default: Form ready to submit
|
|
117
|
+
- Validating: Form validates on blur, shows errors below fields
|
|
118
|
+
- Submitting: Button shows spinner, form disabled, cursor: not-allowed
|
|
119
|
+
- Success: Toast shows "Course created!", redirect to /courses/[id]
|
|
120
|
+
- Error: Toast shows error message, form re-enabled
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 4. Specify All States
|
|
124
|
+
|
|
125
|
+
Every interactive element needs state specifications:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
INPUT FIELD States:
|
|
129
|
+
- Default: Border gray-200, cursor text
|
|
130
|
+
- Focused: Border primary, ring blue-500
|
|
131
|
+
- Validating: Show spinner inside field
|
|
132
|
+
- Valid: Border green-500 (optional)
|
|
133
|
+
- Error: Border red-500, error text below
|
|
134
|
+
|
|
135
|
+
BUTTON States:
|
|
136
|
+
- Default: Background primary, cursor pointer
|
|
137
|
+
- Hovered: Background darker (primary-600)
|
|
138
|
+
- Focused: Ring-2 ring-offset-2
|
|
139
|
+
- Loading: Spinner inside button, disabled
|
|
140
|
+
- Disabled: Background gray-300, cursor not-allowed
|
|
141
|
+
- Success: Check icon appears
|
|
142
|
+
- Error: Text color error, appears 2s then fades
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 5. Mobile-First Responsive
|
|
146
|
+
|
|
147
|
+
Start with mobile (320px), then expand:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
MOBILE (320px):
|
|
151
|
+
┌─────────────────┐
|
|
152
|
+
│ Create Course │
|
|
153
|
+
├─────────────────┤
|
|
154
|
+
│ Name: │
|
|
155
|
+
│ [ input ] │
|
|
156
|
+
├─────────────────┤
|
|
157
|
+
│ Description: │
|
|
158
|
+
│ [ ]│
|
|
159
|
+
│ [ textarea ]│
|
|
160
|
+
├─────────────────┤
|
|
161
|
+
│ Difficulty: │
|
|
162
|
+
│ [dropdown ▼] │
|
|
163
|
+
├─────────────────┤
|
|
164
|
+
│ [Create Course] │
|
|
165
|
+
│ [Cancel ] │
|
|
166
|
+
└─────────────────┘
|
|
167
|
+
|
|
168
|
+
TABLET (768px):
|
|
169
|
+
┌──────────────────────────────────┐
|
|
170
|
+
│ Create Course │
|
|
171
|
+
├──────────────────────────────────┤
|
|
172
|
+
│ Course Name: │
|
|
173
|
+
│ [ input ] │
|
|
174
|
+
│ │
|
|
175
|
+
│ Description: │
|
|
176
|
+
│ [ ] │
|
|
177
|
+
│ [ textarea ]│
|
|
178
|
+
│ [ ] │
|
|
179
|
+
│ │
|
|
180
|
+
│ Difficulty: [dropdown ▼] │
|
|
181
|
+
│ │
|
|
182
|
+
│ [Create Course] [Cancel] │
|
|
183
|
+
└──────────────────────────────────┘
|
|
184
|
+
|
|
185
|
+
DESKTOP (1024px+):
|
|
186
|
+
┌─────────────────────────────────────┐
|
|
187
|
+
│ Create Course │
|
|
188
|
+
├─────────────────────────────────────┤
|
|
189
|
+
│ Course Name: │
|
|
190
|
+
│ [ input ] │
|
|
191
|
+
│ │
|
|
192
|
+
│ Description (optional): │
|
|
193
|
+
│ [ ] │
|
|
194
|
+
│ [ textarea ] │
|
|
195
|
+
│ [ ] │
|
|
196
|
+
│ │
|
|
197
|
+
│ Difficulty Level: │
|
|
198
|
+
│ [ Beginner ▼] │
|
|
199
|
+
│ │
|
|
200
|
+
│ [Create Course] [Cancel] │
|
|
201
|
+
│ │
|
|
202
|
+
│ Courses appear as drafts initially. │
|
|
203
|
+
│ Edit to add content and publish. │
|
|
204
|
+
└─────────────────────────────────────┘
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### 6. Accessibility Checklist
|
|
208
|
+
|
|
209
|
+
For every wireframe, validate:
|
|
210
|
+
|
|
211
|
+
- [ ] Color contrast ≥ 4.5:1 for body text
|
|
212
|
+
- [ ] Color contrast ≥ 3:1 for large text (≥18px)
|
|
213
|
+
- [ ] Form labels associated with inputs
|
|
214
|
+
- [ ] ARIA labels on icon-only buttons
|
|
215
|
+
- [ ] Error messages announced to screen readers
|
|
216
|
+
- [ ] Focus states clearly visible (ring or outline)
|
|
217
|
+
- [ ] Keyboard navigation works (Tab, Enter, Escape)
|
|
218
|
+
- [ ] Loading/success states communicated
|
|
219
|
+
- [ ] Color not the only way to convey meaning
|
|
220
|
+
|
|
221
|
+
### 7. Layout Pattern Selection
|
|
222
|
+
|
|
223
|
+
Choose based on use case:
|
|
224
|
+
|
|
225
|
+
| Pattern | Use Case | Example |
|
|
226
|
+
|---------|----------|---------|
|
|
227
|
+
| centered-form | Create/edit operations | Course form, user settings |
|
|
228
|
+
| 3-column-grid | Content-heavy pages | Blog with sidebar |
|
|
229
|
+
| dashboard-sidebar | Admin dashboards | Analytics, settings |
|
|
230
|
+
| grid-of-cards | List views | Course catalog, products |
|
|
231
|
+
| focus-area | Messaging/chat | Comments, email |
|
|
232
|
+
|
|
233
|
+
### 8. Example: Complete Wireframe
|
|
234
|
+
|
|
235
|
+
```markdown
|
|
236
|
+
### Screen: Course Enrollment
|
|
237
|
+
|
|
238
|
+
**Path:** /courses/[courseId]
|
|
239
|
+
**Layout Pattern:** 2-column with aside
|
|
240
|
+
**Goal:** User views course and enrolls
|
|
241
|
+
|
|
242
|
+
**Components:**
|
|
243
|
+
```
|
|
244
|
+
Container (gap-6)
|
|
245
|
+
├── Main (2/3 width)
|
|
246
|
+
│ ├── Image (responsive, 16:9)
|
|
247
|
+
│ ├── h1: Course title
|
|
248
|
+
│ ├── p: Description
|
|
249
|
+
│ └── Tabs
|
|
250
|
+
│ ├── Tab "Overview"
|
|
251
|
+
│ │ └── Content sections
|
|
252
|
+
│ ├── Tab "Lessons"
|
|
253
|
+
│ │ └── Collapsible lessons list
|
|
254
|
+
│ └── Tab "Reviews"
|
|
255
|
+
│ └── ReviewsSection (client:visible)
|
|
256
|
+
└── Aside (1/3 width)
|
|
257
|
+
└── Card "Enrollment"
|
|
258
|
+
├── Price
|
|
259
|
+
├── Enrollment status
|
|
260
|
+
├── Button "Enroll Now" (client:load)
|
|
261
|
+
├── Stats (students, rating)
|
|
262
|
+
└── Instructor info
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Responsive:**
|
|
266
|
+
- Mobile: Single column
|
|
267
|
+
- Desktop: 2 columns (main 2/3, aside 1/3)
|
|
268
|
+
|
|
269
|
+
**Interactive Elements:**
|
|
270
|
+
- Tabs: client:idle
|
|
271
|
+
- Enroll button: client:load
|
|
272
|
+
- Reviews: client:visible
|
|
273
|
+
- Share button: client:idle
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Design-to-Code Handoff
|
|
277
|
+
|
|
278
|
+
When design is complete, include implementation guidance:
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
IMPLEMENTATION NOTES:
|
|
282
|
+
|
|
283
|
+
1. Use shadcn/ui components:
|
|
284
|
+
- Card, CardHeader, CardContent, CardFooter
|
|
285
|
+
- Form, FormField, FormItem, FormLabel, FormControl, FormMessage
|
|
286
|
+
- Input, Textarea, Select, Button
|
|
287
|
+
- Toast for notifications
|
|
288
|
+
- Dialog for confirmation modals
|
|
289
|
+
|
|
290
|
+
2. TypeScript props:
|
|
291
|
+
interface CreateCourseFormProps {
|
|
292
|
+
onSuccess?: (courseId: string) => void;
|
|
293
|
+
onCancel?: () => void;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
3. State management:
|
|
297
|
+
- useState for form data
|
|
298
|
+
- useMutation for submission
|
|
299
|
+
- Loading state: Button disabled + spinner
|
|
300
|
+
|
|
301
|
+
4. Validation:
|
|
302
|
+
- React Hook Form for form state
|
|
303
|
+
- Zod for schema validation
|
|
304
|
+
- Show errors on blur, not submit
|
|
305
|
+
|
|
306
|
+
5. Styling:
|
|
307
|
+
- Tailwind v4 CSS variables
|
|
308
|
+
- Responsive: grid-cols-1 md:grid-cols-2 lg:grid-cols-3
|
|
309
|
+
- Dark mode: dark: variant
|
|
310
|
+
|
|
311
|
+
6. Accessibility:
|
|
312
|
+
- FormLabel htmlFor input id
|
|
313
|
+
- ARIA live regions for messages
|
|
314
|
+
- Focus management: autofocus on first input
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Critical Rules
|
|
318
|
+
|
|
319
|
+
1. **Test-driven** - Every acceptance criterion has a UI element
|
|
320
|
+
2. **All states shown** - Default, loading, error, success, empty
|
|
321
|
+
3. **Mobile-first** - Design starts at 320px, scales up
|
|
322
|
+
4. **Accessibility first** - WCAG 2.1 AA minimum
|
|
323
|
+
5. **Components specified** - Exact component hierarchy
|
|
324
|
+
6. **Responsive specified** - Breakpoints: 320, 768, 1024, 1440px
|
|
325
|
+
7. **No ambiguity** - Implementation can proceed without design questions
|
|
326
|
+
|
|
327
|
+
## Related Skills
|
|
328
|
+
|
|
329
|
+
- `agent-designer:define-components` - Component specifications
|
|
330
|
+
- `agent-designer:set-design-tokens` - Design token generation
|
|
331
|
+
- `agent-designer:validate-accessibility` - WCAG compliance
|
|
332
|
+
|
|
333
|
+
## Related Documentation
|
|
334
|
+
|
|
335
|
+
- [WCAG 2.1 AA](https://www.w3.org/WAI/WCAG21/quickref/)
|
|
336
|
+
- [shadcn/ui Components](https://ui.shadcn.com)
|
|
337
|
+
- [Designer Agent](../agents/agent-designer.md)
|
|
338
|
+
|
|
339
|
+
## Version History
|
|
340
|
+
|
|
341
|
+
- **1.0.0** (2025-10-27): Initial implementation with test-driven approach
|