oneie 3.6.5 → 3.6.7

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 (98) hide show
  1. package/.claude/commands/onboard.md +179 -0
  2. package/.claude/commands/one copy.md +565 -0
  3. package/.claude/commands/one.md +125 -487
  4. package/.claude/commands/server.md +333 -0
  5. package/.claude/hooks/README-knowledge-hooks.md +265 -0
  6. package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
  7. package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
  8. package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
  9. package/.claude/hooks/check-filenames.py +40 -0
  10. package/.claude/hooks/clean-post.py +301 -0
  11. package/.claude/hooks/clean-pre.py +308 -0
  12. package/.claude/hooks/done.py +175 -0
  13. package/.claude/hooks/format-hook.sh +75 -0
  14. package/.claude/hooks/hook-logger.sh +59 -0
  15. package/.claude/hooks/knowledge-post.py +251 -0
  16. package/.claude/hooks/knowledge-pre.py +150 -0
  17. package/.claude/hooks/notification-hook.sh +112 -0
  18. package/.claude/hooks/security-hook.sh +157 -0
  19. package/.claude/hooks/tag-all-docs.py +338 -0
  20. package/.claude/hooks/todo.py +298 -0
  21. package/.claude/hooks/validate-ontology-structure.py +455 -0
  22. package/.claude/skills/astro/add-content-collection.md +30 -0
  23. package/.claude/skills/astro/check-build.md +29 -0
  24. package/.claude/skills/astro/create-component.md +29 -0
  25. package/.claude/skills/astro/create-page.md +30 -0
  26. package/.claude/skills/astro/optimize-performance.md +21 -0
  27. package/.claude/skills/convex/check-deployment.md +46 -0
  28. package/.claude/skills/convex/create-mutation.md +405 -0
  29. package/.claude/skills/convex/create-query.md +52 -0
  30. package/.claude/skills/convex/read-schema.md +373 -0
  31. package/.claude/skills/convex/test-function.md +50 -0
  32. package/.claude/skills/deployment/check-deployment-health.md +20 -0
  33. package/.claude/skills/deployment/create-release.md +21 -0
  34. package/.claude/skills/deployment/deploy-cloudflare.md +31 -0
  35. package/.claude/skills/deployment/deploy-convex.md +30 -0
  36. package/.claude/skills/deployment/sync-repositories.md +19 -0
  37. package/.claude/skills/design/check-accessibility.md +21 -0
  38. package/.claude/skills/design/create-component-spec.md +27 -0
  39. package/.claude/skills/design/generate-design-tokens.md +24 -0
  40. package/.claude/skills/design/generate-wireframe.md +30 -0
  41. package/.claude/skills/documentation/create-migration-guide.md +20 -0
  42. package/.claude/skills/documentation/generate-api-docs.md +27 -0
  43. package/.claude/skills/documentation/generate-readme.md +22 -0
  44. package/.claude/skills/documentation/update-knowledge.md +20 -0
  45. package/.claude/skills/integration/connect-external-system.md +21 -0
  46. package/.claude/skills/integration/implement-a2a.md +20 -0
  47. package/.claude/skills/integration/implement-acp.md +20 -0
  48. package/.claude/skills/integration/verify-integration.md +20 -0
  49. package/.claude/skills/ontology/README.md +255 -0
  50. package/.claude/skills/ontology/check-dimension.md +307 -0
  51. package/.claude/skills/ontology/generate-entity-type.md +339 -0
  52. package/.claude/skills/ontology/validate-schema.md +229 -0
  53. package/.claude/skills/ontology/verify-relationships.md +310 -0
  54. package/.claude/skills/problem-solving/analyze-test-failure.md +21 -0
  55. package/.claude/skills/problem-solving/identify-root-cause.md +20 -0
  56. package/.claude/skills/problem-solving/propose-solution.md +29 -0
  57. package/.claude/skills/problem-solving/verify-fix.md +21 -0
  58. package/.claude/skills/sales/generate-demo-script.md +21 -0
  59. package/.claude/skills/sales/qualify-lead.md +30 -0
  60. package/.claude/skills/sales/track-trial.md +20 -0
  61. package/.claude/skills/sales/verify-kyc.md +20 -0
  62. package/.claude/skills/testing/analyze-coverage.md +24 -0
  63. package/.claude/skills/testing/generate-tests.md +24 -0
  64. package/.claude/skills/testing/run-tests.md +27 -0
  65. package/.claude/skills/testing/validate-e2e.md +25 -0
  66. package/.mcp.json +30 -3
  67. package/dist/commands/init.d.ts.map +1 -1
  68. package/dist/commands/init.js +13 -6
  69. package/dist/commands/init.js.map +1 -1
  70. package/dist/utils/launch-claude.d.ts +3 -2
  71. package/dist/utils/launch-claude.d.ts.map +1 -1
  72. package/dist/utils/launch-claude.js +64 -29
  73. package/dist/utils/launch-claude.js.map +1 -1
  74. package/folders.yaml +1 -1
  75. package/one/.obsidian/workspace.json +22 -22
  76. package/one/events/CREATE-WEBSITE.md +442 -0
  77. package/one/events/CUSTOM-DOMAIN.md +357 -0
  78. package/one/events/DEPLOYMENT copy.md +426 -0
  79. package/one/events/ECOMMERCE-BEFORE-AFTER.md +251 -0
  80. package/one/events/ECOMMERCE-ENHANCEMENTS.md +576 -0
  81. package/one/events/ECOMMERCE-HIGH-CONVERTING-ELEMENTS.md +421 -0
  82. package/one/events/ECOMMERCE-REFACTOR-SUMMARY.md +196 -0
  83. package/one/events/ECOMMERCE-SETUP-SUMMARY.md +396 -0
  84. package/one/events/INSTALLATION_FOLDERS.md +516 -0
  85. package/one/events/INSTALLATION_FOLDERS_FILES.md +205 -0
  86. package/one/events/INSTALLATION_FOLDERS_SUMMARY.md +419 -0
  87. package/one/events/LICENSE.md +89 -0
  88. package/one/events/MCP-CONFIGURATION.md +336 -0
  89. package/one/events/MCP-SETUP-COMPLETE.md +205 -0
  90. package/one/events/NODE-UPGRADE.md +111 -0
  91. package/one/events/PACKAGE-STRUCTURE.md +310 -0
  92. package/one/events/PLAYBOOK-SETUP-SUMMARY.md +331 -0
  93. package/one/events/PROMPT_FIX_FRONTEND_ONLY.md +567 -0
  94. package/one/events/SIMPLE_FIX_FRONTEND_ONLY.md +262 -0
  95. package/one/events/STRIPE-INTEGRATION.md +414 -0
  96. package/one/events/STRIPE-SETUP-GUIDE.md +462 -0
  97. package/one/events/TRANSPARENCY-FIXES.md +275 -0
  98. package/package.json +4 -2
@@ -0,0 +1,339 @@
1
+ # Generate Entity Type from Description
2
+
3
+ **Category:** ontology
4
+ **Version:** 1.0.0
5
+ **Used By:** agent-backend, agent-builder, agent-director
6
+
7
+ ## Purpose
8
+
9
+ Generates a complete TypeScript type definition and Convex schema entry for a new entity type based on a Plain English description, ensuring compliance with the ONE Ontology.
10
+
11
+ ## Inputs
12
+
13
+ - **entityDescription** (string): Plain English description of the entity
14
+ - **entityName** (string): Singular name for the entity type (e.g., "blog_post", "product", "landing_page")
15
+ - **groupId** (boolean, optional): Whether this entity is scoped to groups. Default: true
16
+ - **additionalFields** (object, optional): Extra fields beyond standard ones
17
+
18
+ ## Outputs
19
+
20
+ - **typeDefinition** (string): TypeScript type for the entity
21
+ - **schemaEntry** (string): Convex schema table definition
22
+ - **exampleData** (object): Sample entity instance
23
+ - **relatedTypes** (array): Suggested connection types for this entity
24
+ - **suggestedIndexes** (array): Recommended database indexes
25
+
26
+ ## Prerequisites
27
+
28
+ - Entity name follows naming convention (lowercase, underscores)
29
+ - Entity doesn't conflict with existing types
30
+ - ONE ontology schema structure understood
31
+
32
+ ## Steps
33
+
34
+ 1. **Analyze Entity Description**
35
+ - Extract key properties from description
36
+ - Identify property types (string, number, boolean, object, array)
37
+ - Determine if properties are required or optional
38
+ - Identify relationships to other entities
39
+
40
+ 2. **Generate Standard Fields**
41
+ - Add `_id: Id<"things">` - Convex document ID
42
+ - Add `groupId: Id<"groups">` - Multi-tenant scope (if groupId=true)
43
+ - Add `type: string` - Entity type discriminator (value = entityName)
44
+ - Add `name: string` - Human-readable name
45
+ - Add `status: enum` - Lifecycle status (draft, active, published, archived)
46
+ - Add `createdAt: number` - Creation timestamp
47
+ - Add `updatedAt: number` - Last update timestamp
48
+
49
+ 3. **Generate Custom Properties**
50
+ - Create `properties` object for entity-specific fields
51
+ - Make properties flexible (v.any() or specific object schema)
52
+ - Document each property with JSDoc comments
53
+ - Set sensible defaults where applicable
54
+
55
+ 4. **Create TypeScript Type**
56
+ - Generate interface extending base Thing type
57
+ - Include all standard and custom fields
58
+ - Add type guards for discriminated union
59
+ - Export type for use in queries/mutations
60
+
61
+ 5. **Create Convex Schema Entry**
62
+ - Generate defineTable with all fields
63
+ - Use Convex validators (v.string(), v.number(), etc.)
64
+ - Add required indexes (by_group, by_type, by_group_and_type)
65
+ - Add custom indexes based on common query patterns
66
+
67
+ 6. **Generate Example Data**
68
+ - Create realistic sample instance
69
+ - Show all fields populated
70
+ - Include nested properties
71
+ - Demonstrate valid status values
72
+
73
+ 7. **Suggest Related Connection Types**
74
+ - Analyze relationships mentioned in description
75
+ - Suggest connection types (owns, authored, contains, etc.)
76
+ - Provide directionality (source → target)
77
+ - Include metadata suggestions
78
+
79
+ 8. **Recommend Indexes**
80
+ - by_group - Filter by group
81
+ - by_type - Filter by entity type
82
+ - by_group_and_type - Compound index for scoped queries
83
+ - by_status - Filter by lifecycle status
84
+ - Custom indexes based on query patterns
85
+
86
+ ## Examples
87
+
88
+ ### Example 1: Blog Post Entity
89
+
90
+ **Input:**
91
+ ```
92
+ entityDescription: "A blog post written by an author, with title, content, publish date, tags, and featured image"
93
+ entityName: "blog_post"
94
+ groupId: true
95
+ additionalFields: {}
96
+ ```
97
+
98
+ **Output:**
99
+
100
+ **typeDefinition:**
101
+ ```typescript
102
+ /**
103
+ * Blog Post Entity
104
+ * A blog post written by an author with rich content and metadata
105
+ */
106
+ export interface BlogPost extends Thing {
107
+ _id: Id<"things">;
108
+ groupId: Id<"groups">;
109
+ type: "blog_post";
110
+ name: string; // Post title
111
+ status: "draft" | "active" | "published" | "archived";
112
+ properties: {
113
+ content: string; // Markdown or HTML content
114
+ excerpt?: string; // Short summary
115
+ publishDate?: number; // Timestamp when published
116
+ tags: string[]; // Categorization tags
117
+ featuredImage?: string; // URL to hero image
118
+ authorId: Id<"things">; // Reference to creator entity
119
+ slug: string; // URL-friendly identifier
120
+ seoTitle?: string; // SEO-optimized title
121
+ seoDescription?: string; // Meta description
122
+ readTime?: number; // Estimated read time in minutes
123
+ };
124
+ createdAt: number;
125
+ updatedAt: number;
126
+ }
127
+ ```
128
+
129
+ **schemaEntry:**
130
+ ```typescript
131
+ blog_posts: defineTable({
132
+ groupId: v.id("groups"),
133
+ type: v.literal("blog_post"),
134
+ name: v.string(), // Post title
135
+ status: v.union(
136
+ v.literal("draft"),
137
+ v.literal("active"),
138
+ v.literal("published"),
139
+ v.literal("archived")
140
+ ),
141
+ properties: v.object({
142
+ content: v.string(),
143
+ excerpt: v.optional(v.string()),
144
+ publishDate: v.optional(v.number()),
145
+ tags: v.array(v.string()),
146
+ featuredImage: v.optional(v.string()),
147
+ authorId: v.id("things"),
148
+ slug: v.string(),
149
+ seoTitle: v.optional(v.string()),
150
+ seoDescription: v.optional(v.string()),
151
+ readTime: v.optional(v.number()),
152
+ }),
153
+ createdAt: v.number(),
154
+ updatedAt: v.number(),
155
+ })
156
+ .index("by_group", ["groupId"])
157
+ .index("by_type", ["type"])
158
+ .index("by_group_and_type", ["groupId", "type"])
159
+ .index("by_status", ["status"])
160
+ .index("by_slug", ["groupId", "properties.slug"])
161
+ .index("by_publish_date", ["groupId", "properties.publishDate"]),
162
+ ```
163
+
164
+ **exampleData:**
165
+ ```json
166
+ {
167
+ "_id": "jd7xk9m2n5p8q1r4",
168
+ "groupId": "kg3xl8n1m4o7p0q3",
169
+ "type": "blog_post",
170
+ "name": "Getting Started with ONE Platform",
171
+ "status": "published",
172
+ "properties": {
173
+ "content": "# Welcome to ONE\n\nThis is your first blog post...",
174
+ "excerpt": "Learn how to build websites with Plain English",
175
+ "publishDate": 1697673600000,
176
+ "tags": ["tutorial", "getting-started", "astro"],
177
+ "featuredImage": "https://cdn.example.com/images/hero.jpg",
178
+ "authorId": "lh4ym9n2o5p8q1r4",
179
+ "slug": "getting-started-with-one-platform",
180
+ "seoTitle": "Getting Started with ONE Platform | Complete Guide",
181
+ "seoDescription": "A comprehensive guide to building your first website with ONE Platform",
182
+ "readTime": 5
183
+ },
184
+ "createdAt": 1697659200000,
185
+ "updatedAt": 1697673600000
186
+ }
187
+ ```
188
+
189
+ **relatedTypes:**
190
+ ```json
191
+ [
192
+ {
193
+ "connectionType": "authored",
194
+ "source": "creator (author)",
195
+ "target": "blog_post",
196
+ "metadata": { "role": "author" }
197
+ },
198
+ {
199
+ "connectionType": "tagged_with",
200
+ "source": "blog_post",
201
+ "target": "tag",
202
+ "metadata": { "category": "string" }
203
+ },
204
+ {
205
+ "connectionType": "part_of",
206
+ "source": "blog_post",
207
+ "target": "blog_collection",
208
+ "metadata": { "order": "number" }
209
+ }
210
+ ]
211
+ ```
212
+
213
+ **suggestedIndexes:**
214
+ ```json
215
+ [
216
+ "by_group - Filter posts by organization",
217
+ "by_type - Filter all blog posts",
218
+ "by_group_and_type - Scoped blog post queries",
219
+ "by_status - Filter by draft/published status",
220
+ "by_slug - Fast lookup by URL slug",
221
+ "by_publish_date - Sort posts chronologically"
222
+ ]
223
+ ```
224
+
225
+ ### Example 2: Product Entity
226
+
227
+ **Input:**
228
+ ```
229
+ entityDescription: "An e-commerce product with name, price, description, images, inventory count, and SKU"
230
+ entityName: "product"
231
+ groupId: true
232
+ ```
233
+
234
+ **Output:**
235
+
236
+ **typeDefinition:**
237
+ ```typescript
238
+ /**
239
+ * Product Entity
240
+ * E-commerce product with pricing and inventory
241
+ */
242
+ export interface Product extends Thing {
243
+ _id: Id<"things">;
244
+ groupId: Id<"groups">;
245
+ type: "product";
246
+ name: string; // Product name
247
+ status: "draft" | "active" | "published" | "archived";
248
+ properties: {
249
+ description: string;
250
+ price: number; // Price in cents
251
+ currency: string; // ISO currency code (USD, EUR, etc.)
252
+ images: string[]; // Array of image URLs
253
+ inventory: number; // Stock count
254
+ sku: string; // Stock Keeping Unit
255
+ category?: string;
256
+ weight?: number; // Weight in grams
257
+ dimensions?: {
258
+ length: number;
259
+ width: number;
260
+ height: number;
261
+ };
262
+ featured: boolean;
263
+ };
264
+ createdAt: number;
265
+ updatedAt: number;
266
+ }
267
+ ```
268
+
269
+ **exampleData:**
270
+ ```json
271
+ {
272
+ "_id": "pr4duct123xyz",
273
+ "groupId": "st0re456abc",
274
+ "type": "product",
275
+ "name": "Premium Wireless Headphones",
276
+ "status": "published",
277
+ "properties": {
278
+ "description": "High-quality wireless headphones with noise cancellation",
279
+ "price": 29999,
280
+ "currency": "USD",
281
+ "images": [
282
+ "https://cdn.example.com/products/headphones-1.jpg",
283
+ "https://cdn.example.com/products/headphones-2.jpg"
284
+ ],
285
+ "inventory": 47,
286
+ "sku": "WH-PREM-001",
287
+ "category": "Electronics",
288
+ "weight": 250,
289
+ "dimensions": {
290
+ "length": 20,
291
+ "width": 18,
292
+ "height": 8
293
+ },
294
+ "featured": true
295
+ },
296
+ "createdAt": 1697659200000,
297
+ "updatedAt": 1697745600000
298
+ }
299
+ ```
300
+
301
+ ## Error Handling
302
+
303
+ - **Invalid Entity Name:** Must be lowercase with underscores only
304
+ - **Conflicting Type:** Check if entity type already exists in schema
305
+ - **Invalid Property Types:** Validate property type specifications
306
+ - **Missing Required Fields:** Ensure all standard fields included
307
+
308
+ ## Dependencies
309
+
310
+ - **Tools:** Write (to generate files)
311
+ - **Skills:** `validate-schema.md` (to verify generated schema)
312
+ - **Docs:** `one/knowledge/ontology.md` for entity type conventions
313
+
314
+ ## Tests
315
+
316
+ 1. **Test Basic Entity:** Generate simple entity with minimal properties
317
+ 2. **Test Complex Entity:** Generate entity with nested objects and arrays
318
+ 3. **Test Without GroupId:** Generate global entity (groupId=false)
319
+ 4. **Test Validation:** Ensure generated schema passes validation
320
+ 5. **Test Type Safety:** Verify TypeScript types compile correctly
321
+ 6. **Test Index Generation:** Verify recommended indexes are optimal
322
+
323
+ ## Performance
324
+
325
+ - **Generation Time:** < 100ms for typical entity
326
+ - **No External Calls:** Pure code generation
327
+ - **Caching:** Not applicable (always fresh generation)
328
+
329
+ ## Lessons Learned
330
+
331
+ - **Properties Flexibility:** Use `v.any()` for properties unless schema is fully known
332
+ - **Always Index by Group:** Multi-tenancy requires group-based filtering
333
+ - **Compound Indexes:** by_group_and_type is essential for performance
334
+ - **Slug Fields:** Most content entities benefit from URL-friendly slugs
335
+ - **Timestamps:** Always use Unix timestamps (number) for consistency
336
+
337
+ ## Version History
338
+
339
+ - **1.0.0** (2025-10-18): Initial implementation with full type generation
@@ -0,0 +1,229 @@
1
+ # Validate Schema Against 6-Dimension Ontology
2
+
3
+ **Category:** ontology
4
+ **Version:** 1.0.0
5
+ **Used By:** agent-backend, agent-quality, agent-director, agent-builder
6
+
7
+ ## Purpose
8
+
9
+ Validates a Convex schema definition against the ONE Platform 6-dimension ontology to ensure all tables, fields, and relationships comply with the canonical data model.
10
+
11
+ ## Inputs
12
+
13
+ - **schemaPath** (string): Path to Convex schema file (e.g., `backend/convex/schema.ts`)
14
+ - **strictMode** (boolean, optional): If true, fails on warnings. Default: false
15
+
16
+ ## Outputs
17
+
18
+ - **isValid** (boolean): True if schema passes validation
19
+ - **errors** (array): Critical issues that must be fixed
20
+ - **warnings** (array): Non-critical issues to consider
21
+ - **recommendations** (array): Suggested improvements
22
+ - **dimensionCoverage** (object): Which dimensions are represented
23
+
24
+ ## Prerequisites
25
+
26
+ - Schema file exists at specified path
27
+ - Schema follows Convex v1.0+ format
28
+ - ONE ontology documentation available at `one/knowledge/ontology.md`
29
+
30
+ ## Steps
31
+
32
+ 1. **Read Schema File**
33
+ - Use Read tool to load schema from `schemaPath`
34
+ - Parse TypeScript schema definition
35
+ - Extract table definitions
36
+
37
+ 2. **Check Required Tables**
38
+ - Verify `groups` table exists
39
+ - Verify `things` table exists (or legacy `entities`)
40
+ - Verify `connections` table exists
41
+ - Verify `events` table exists
42
+ - Verify `knowledge` table exists
43
+ - Add error for each missing required table
44
+
45
+ 3. **Validate groups Table**
46
+ - Check fields: `_id`, `name`, `type`, `parentGroupId`, `properties`, `status`, `createdAt`, `updatedAt`
47
+ - Verify `type` field has enum: friend_circle, business, community, dao, government, organization
48
+ - Verify `parentGroupId` is optional and references `groups._id`
49
+ - Check indexes: by_type, by_parent
50
+
51
+ 4. **Validate things/entities Table**
52
+ - Check fields: `_id`, `groupId`, `type`, `name`, `properties`, `status`, `createdAt`, `updatedAt`
53
+ - Verify `groupId` references `groups._id`
54
+ - Verify `type` field exists (should be one of 66+ entity types)
55
+ - Verify `status` field has enum: draft, active, published, archived
56
+ - Check indexes: by_group, by_type, by_group_and_type
57
+ - Verify `properties` field is flexible (v.any() or object)
58
+
59
+ 5. **Validate connections Table**
60
+ - Check fields: `_id`, `groupId`, `sourceId`, `targetId`, `type`, `metadata`, `validFrom`, `validTo`, `createdAt`, `updatedAt`
61
+ - Verify `groupId` references `groups._id`
62
+ - Verify `sourceId` and `targetId` reference things/entities
63
+ - Verify `type` field exists (should be one of 25+ connection types)
64
+ - Check indexes: by_group, by_source, by_target, by_type
65
+ - Verify bidirectional capability
66
+
67
+ 6. **Validate events Table**
68
+ - Check fields: `_id`, `groupId`, `type`, `actorId`, `targetId`, `timestamp`, `metadata`, `createdAt`
69
+ - Verify `groupId` references `groups._id`
70
+ - Verify `actorId` references person (thing with type=creator)
71
+ - Verify `type` field exists (should be one of 67+ event types)
72
+ - Check indexes: by_group, by_type, by_actor, by_timestamp
73
+ - Verify events are immutable (no `updatedAt` field)
74
+
75
+ 7. **Validate knowledge Table**
76
+ - Check fields: `_id`, `groupId`, `entityId`, `label`, `embedding`, `metadata`, `createdAt`, `updatedAt`
77
+ - Verify `groupId` references `groups._id`
78
+ - Verify `entityId` references things/entities
79
+ - Verify `embedding` field for vector storage
80
+ - Check indexes: by_group, by_entity, by_label
81
+
82
+ 8. **Check Cross-Table Relationships**
83
+ - Verify all `groupId` fields use same ID type
84
+ - Verify foreign key references are consistent
85
+ - Check that indexes support common queries
86
+
87
+ 9. **Validate Against Ontology Rules**
88
+ - Every table must have `groupId` (except groups itself)
89
+ - All timestamps should be numbers (Date.now())
90
+ - All IDs should use Convex Id type
91
+ - Properties/metadata should be flexible objects
92
+
93
+ 10. **Generate Report**
94
+ - Compile all errors, warnings, recommendations
95
+ - Calculate dimension coverage percentage
96
+ - Return validation results
97
+
98
+ ## Examples
99
+
100
+ ### Example 1: Valid Schema
101
+
102
+ **Input:**
103
+ ```typescript
104
+ schemaPath: "backend/convex/schema.ts"
105
+ strictMode: false
106
+ ```
107
+
108
+ **Schema Content:**
109
+ ```typescript
110
+ export default defineSchema({
111
+ groups: defineTable({
112
+ name: v.string(),
113
+ type: v.union(v.literal("friend_circle"), v.literal("business"), ...),
114
+ parentGroupId: v.optional(v.id("groups")),
115
+ properties: v.any(),
116
+ status: v.union(v.literal("draft"), v.literal("active"), ...),
117
+ createdAt: v.number(),
118
+ updatedAt: v.number(),
119
+ }).index("by_type", ["type"]),
120
+
121
+ things: defineTable({
122
+ groupId: v.id("groups"),
123
+ type: v.string(),
124
+ name: v.string(),
125
+ properties: v.any(),
126
+ status: v.union(v.literal("draft"), ...),
127
+ createdAt: v.number(),
128
+ updatedAt: v.number(),
129
+ }).index("by_group", ["groupId"]).index("by_type", ["type"]),
130
+
131
+ // ... other tables
132
+ });
133
+ ```
134
+
135
+ **Output:**
136
+ ```json
137
+ {
138
+ "isValid": true,
139
+ "errors": [],
140
+ "warnings": [],
141
+ "recommendations": [
142
+ "Consider adding composite index on things: by_group_and_type"
143
+ ],
144
+ "dimensionCoverage": {
145
+ "groups": true,
146
+ "people": true,
147
+ "things": true,
148
+ "connections": true,
149
+ "events": true,
150
+ "knowledge": true,
151
+ "percentage": 100
152
+ }
153
+ }
154
+ ```
155
+
156
+ ### Example 2: Missing Required Table
157
+
158
+ **Input:**
159
+ ```typescript
160
+ schemaPath: "backend/convex/schema.ts"
161
+ strictMode: true
162
+ ```
163
+
164
+ **Output:**
165
+ ```json
166
+ {
167
+ "isValid": false,
168
+ "errors": [
169
+ "Missing required table: events",
170
+ "Missing required table: knowledge"
171
+ ],
172
+ "warnings": [
173
+ "connections table missing index: by_source"
174
+ ],
175
+ "recommendations": [
176
+ "Add events table to track all actions",
177
+ "Add knowledge table for semantic search"
178
+ ],
179
+ "dimensionCoverage": {
180
+ "groups": true,
181
+ "people": true,
182
+ "things": true,
183
+ "connections": true,
184
+ "events": false,
185
+ "knowledge": false,
186
+ "percentage": 66.7
187
+ }
188
+ }
189
+ ```
190
+
191
+ ## Error Handling
192
+
193
+ - **File Not Found:** Return error with clear message about schema path
194
+ - **Parse Error:** Return error with line number and syntax issue
195
+ - **Invalid Format:** Return error explaining expected Convex schema format
196
+ - **Missing Dimensions:** List all missing tables/fields with remediation steps
197
+
198
+ ## Dependencies
199
+
200
+ - **Tools:** Read, Grep (for searching schema patterns)
201
+ - **Skills:** None (foundational skill)
202
+ - **Docs:** `one/knowledge/ontology.md` for canonical dimension definitions
203
+
204
+ ## Tests
205
+
206
+ 1. **Test Valid Schema:** Verify schema with all 6 dimensions passes
207
+ 2. **Test Missing Table:** Verify error when required table missing
208
+ 3. **Test Missing Field:** Verify error when required field missing
209
+ 4. **Test Wrong Type:** Verify error when field has wrong type
210
+ 5. **Test Missing Index:** Verify warning when recommended index missing
211
+ 6. **Test Legacy Schema:** Verify compatibility with entities → things migration
212
+ 7. **Test Strict Mode:** Verify strict mode fails on warnings
213
+
214
+ ## Performance
215
+
216
+ - **Typical Runtime:** < 1 second for standard schema
217
+ - **Caching:** Cache schema AST after first parse
218
+ - **Optimization:** Skip validation if schema hash unchanged
219
+
220
+ ## Lessons Learned
221
+
222
+ - **Keep it Fast:** Schema validation runs frequently, optimize for speed
223
+ - **Clear Messages:** Error messages must point to exact line/field
224
+ - **Flexible Format:** Support both old (entities) and new (things) table names during migration
225
+ - **Progressive Enhancement:** Allow warnings without blocking, but flag them clearly
226
+
227
+ ## Version History
228
+
229
+ - **1.0.0** (2025-10-18): Initial implementation with 6-dimension support