@almadar/skills 1.3.0 → 1.4.1

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/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import { generateBehaviorsDocs, getAllBehaviors, generateModulesDocs, getAllStdO
4
4
  import { OPERATORS, UI_SLOTS, PATTERN_TYPES, ViewTypeSchema } from '@almadar/core/types';
5
5
  import { getPatternPropsCompact, getPatternActionsRef, getAllPatternTypes } from '@almadar/patterns';
6
6
  import { BINDING_DOCS, CORE_BINDINGS } from '@almadar/core';
7
+ import { generateDomainLanguageReference } from '@almadar/core/domain-language';
7
8
 
8
9
  // src/generators/utils.ts
9
10
  function formatFrontmatter(fm) {
@@ -354,22 +355,68 @@ Field types MUST be one of: \`string\`, \`number\`, \`boolean\`, \`date\`, \`tim
354
355
  { "name": "author", "type": "relation", "relation": { "entity": "User", "cardinality": "one" } }
355
356
  \`\`\`
356
357
 
357
- ### 6. Modal State Machine Pattern
358
+ ### 6. Modal/Drawer Exit Transitions (CRITICAL \u2014 MOST COMMON ERROR)
358
359
 
359
- When a transition opens a modal/drawer, the target state MUST have CLOSE and CANCEL transitions:
360
+ **EVERY state that renders to \`"modal"\` or \`"drawer"\` MUST have CANCEL and CLOSE transitions.**
361
+ Without these, the validator rejects the schema with \`CIRCUIT_NO_OVERLAY_EXIT\`.
360
362
 
361
363
  \`\`\`json
364
+ // Opening the modal: Browsing \u2192 Creating
362
365
  { "from": "Browsing", "to": "Creating", "event": "CREATE",
363
- "effects": [["render-ui", "modal", { "type": "form-section", "cancelEvent": "CANCEL", ... }]] },
366
+ "effects": [["render-ui", "modal", { "type": "form-section", "entity": "Task", "submitEvent": "SAVE", "cancelEvent": "CANCEL" }]] },
367
+
368
+ // REQUIRED: CANCEL exit (form cancel button)
364
369
  { "from": "Creating", "to": "Browsing", "event": "CANCEL",
365
370
  "effects": [["render-ui", "modal", null]] },
371
+
372
+ // REQUIRED: CLOSE exit (click outside / press Escape)
366
373
  { "from": "Creating", "to": "Browsing", "event": "CLOSE",
367
374
  "effects": [["render-ui", "modal", null]] },
375
+
376
+ // SAVE also dismisses modal
368
377
  { "from": "Creating", "to": "Browsing", "event": "SAVE",
369
- "effects": [["persist", "create", "Entity", "@payload.data"], ["render-ui", "modal", null], ["emit", "INIT"]] }
378
+ "effects": [["persist", "create", "Task", "@payload.data"], ["render-ui", "modal", null], ["emit", "INIT"]] }
379
+ \`\`\`
380
+
381
+ **Checklist for EVERY modal/drawer state:**
382
+ - [ ] Has \`CANCEL\` transition \u2192 previous state with \`["render-ui", "modal", null]\`
383
+ - [ ] Has \`CLOSE\` transition \u2192 previous state with \`["render-ui", "modal", null]\`
384
+ - [ ] Has \`SAVE\` (or other action) transition that also dismisses with \`["render-ui", "modal", null]\`
385
+
386
+ **This applies to ALL states**: Creating, Editing, Viewing, Deleting \u2014 any state that renders to modal/drawer.
387
+
388
+ ### 7. Valid Slots ONLY
389
+
390
+ render-ui slots MUST be one of: \`"main"\`, \`"modal"\`, \`"drawer"\`, \`"sidebar"\`
391
+
392
+ \`\`\`json
393
+ // WRONG - invented slots:
394
+ ["render-ui", "modal-close", null]
395
+ ["render-ui", "notification", { ... }]
396
+ ["render-ui", "confirm-modal", { ... }]
397
+
398
+ // CORRECT:
399
+ ["render-ui", "modal", null]
400
+ ["render-ui", "main", { ... }]
370
401
  \`\`\`
371
402
 
372
- **CLOSE** = user clicks outside modal/presses Escape. **CANCEL** = form cancel button. Both needed.
403
+ ### 8. Every render-ui Pattern MUST Have "type"
404
+
405
+ Every pattern object in render-ui MUST include a \`"type"\` field. This applies to the top-level pattern AND every child in a stack.
406
+
407
+ \`\`\`json
408
+ // WRONG - missing type:
409
+ ["render-ui", "main", { "entity": "Product", "columns": ["name"] }]
410
+
411
+ // CORRECT:
412
+ ["render-ui", "main", { "type": "entity-table", "entity": "Product", "columns": ["name"] }]
413
+
414
+ // WRONG - child missing type:
415
+ { "type": "stack", "children": [{ "text": "Hello" }] }
416
+
417
+ // CORRECT:
418
+ { "type": "stack", "children": [{ "type": "typography", "text": "Hello" }] }
419
+ \`\`\`
373
420
  `;
374
421
  }
375
422
  function getEdgeCaseErrors() {
@@ -390,12 +437,15 @@ WRONG: Two traits both render to "main" on page load
390
437
  CORRECT: ONE trait owns each slot
391
438
  \`\`\`
392
439
 
393
- ### 9. Missing submitEvent in form-section
440
+ ### 9. Missing submitEvent / Wrong Action Pattern in form-section
394
441
  \`\`\`
395
442
  WRONG: { "type": "form-section", "entity": "Task" }
396
443
  ALSO WRONG: { "type": "form-section", "entity": "Task", "onSubmit": "SAVE" }
444
+ ALSO WRONG: { "type": "form-section", "actions": [{"label": "Save", "event": "SAVE"}] }
397
445
  CORRECT: { "type": "form-section", "entity": "Task", "submitEvent": "SAVE", "cancelEvent": "CANCEL" }
398
446
  \`\`\`
447
+ **form-section does NOT use \`actions\` array** \u2014 it uses \`submitEvent\` and \`cancelEvent\` strings.
448
+ The \`actions\` prop is for \`page-header\`, \`entity-detail\`, NOT for forms.
399
449
 
400
450
  ### 10. Duplicate Transitions (Same from+event)
401
451
  \`\`\`
@@ -527,10 +577,11 @@ function getDecompositionSection() {
527
577
  | game | none | none | none | none |
528
578
  | form | wizard | drawer | page | confirm |
529
579
 
530
- ### Step 3: Choose Traits
531
- - Business: EntityManagement (handles CRUD via render-ui)
580
+ ### Step 3: Choose Traits (UNIQUE NAMES REQUIRED)
581
+ - Business: \`{Entity}Management\` naming \u2014 e.g., \`ProductManagement\`, \`OrderManagement\`, \`CustomerManagement\`
532
582
  - Game: Physics2D, Health, Score, Collision
533
583
  - Form: Wizard (multi-step) or FormSubmission (single)
584
+ - **NEVER reuse the same trait name across orbitals. Each trait name MUST be globally unique.**
534
585
 
535
586
  ### Step 4: Define State Machine
536
587
  \`\`\`
@@ -628,10 +679,11 @@ function getDecompositionCompact() {
628
679
  | game | none | none | none | none |
629
680
  | form | wizard | drawer | page | confirm |
630
681
 
631
- ### Step 3: Choose Traits
632
- - Business: EntityManagement (handles CRUD via render-ui)
682
+ ### Step 3: Choose Traits (UNIQUE NAMES REQUIRED)
683
+ - Business: \`{Entity}Management\` naming \u2014 e.g., \`ProductManagement\`, \`OrderManagement\`, \`CustomerManagement\`
633
684
  - Game: Physics2D, Health, Score, Collision
634
685
  - Form: Wizard (multi-step) or FormSubmission (single)
686
+ - **NEVER reuse the same trait name across orbitals. Each trait name MUST be globally unique.**
635
687
 
636
688
  ### Step 4: Define State Machine
637
689
  \`\`\`
@@ -808,10 +860,20 @@ function getBindingsGuide() {
808
860
  "",
809
861
  "| \u274C Invalid | \u2705 Correct |",
810
862
  "|------------|------------|",
811
- '| `@count` | Use `stats` pattern or static text (e.g., `"Total Tasks"`) |',
812
- "| `@count:status=pending` | Use filtered entity-table or static labels |",
863
+ '| `@count(tasks)` | Use static text `"Total Tasks"` or add a `taskCount` field to entity |',
864
+ "| `@find(orders, id=@payload.id)` | Use `@payload.data` \u2014 the runtime resolves entities |",
865
+ "| `@categories.find(c => c.id === @payload.id)` | Use `@payload.data` \u2014 no JavaScript in bindings |",
866
+ "| `@sum(orders, totalAmount)` | Add a `totalAmount` field to the entity |",
867
+ '| `@formatDate(@entity.createdAt, "MMM dd")` | Use `@entity.createdAt` \u2014 formatting is UI-side |',
868
+ "| `@length(items)` | Use `@entity.itemCount` \u2014 add the field to entity |",
869
+ "| `@filter(...)` | No function-call syntax exists in bindings |",
870
+ "| `@inc(@payload.delta)` | Use `@payload.data` or `@entity.field` |",
871
+ "| `@count` | Use static text or add a count field to entity |",
813
872
  "| `@entity.task.title` | `@entity.title` (entity type is implicit) |",
814
873
  "| `@payload.field` in `set` effect | `@entity.field` (set modifies entity only) |",
874
+ "| `@entity` (bare, no path) | `@entity.data` or `@entity.fieldName` \u2014 path required |",
875
+ "",
876
+ "**ABSOLUTE RULE**: Bindings are ONLY `@root.path` (e.g., `@entity.name`). NO function calls, NO JavaScript expressions, NO query syntax. If you need computed values, add a field to the entity.",
815
877
  ""
816
878
  );
817
879
  return lines.join("\n");
@@ -1893,7 +1955,7 @@ For schemas exceeding 40KB, use the **chunking tools** instead of direct editing
1893
1955
  | \`extract_chunk\` | Extract orbital/trait to \`.chunks/chunk-{id}.json\` |
1894
1956
  | \`apply_chunk\` | Merge edited chunk back into schema |
1895
1957
 
1896
- **Note**: These tools work with both \`schema.json\` and \`schema.orb\` files. Changes are auto-persisted.
1958
+ **Note**: These tools work with \`schema.orb\` files. Changes are auto-persisted.
1897
1959
 
1898
1960
  ### Chunking Workflow
1899
1961
 
@@ -2368,7 +2430,7 @@ function getCompletionRulesSection() {
2368
2430
  4. Do NOT "verify" or "confirm"
2369
2431
  5. Do NOT validate again
2370
2432
 
2371
- The validated schema.json IS your only deliverable.`;
2433
+ The validated schema.orb IS your only deliverable.`;
2372
2434
  }
2373
2435
 
2374
2436
  // src/prompts/skill-sections/game-guidance.ts
@@ -2914,6 +2976,21 @@ function getToolWorkflowSection() {
2914
2976
  Break requirements into OrbitalUnits (pure reasoning, no tools).
2915
2977
 
2916
2978
  ### Phase 2: GENERATE
2979
+
2980
+ **Option A: Orchestrated Generation (RECOMMENDED for 3+ orbitals)**
2981
+ Use \`generate_schema_orchestrated\` for automatic complexity-based routing:
2982
+
2983
+ \`\`\`
2984
+ generate_schema_orchestrated({ prompt: "Full app description with all entities and features" })
2985
+ \`\`\`
2986
+
2987
+ This tool automatically:
2988
+ - Decomposes your requirements
2989
+ - Routes simple/medium (1-3 orbitals) to fast single-provider
2990
+ - Routes complex (4+ orbitals) to parallel multi-provider
2991
+ - Returns a complete schema with all orbitals
2992
+
2993
+ **Option B: Per-Orbital Generation (for simple cases or fine-grained control)**
2917
2994
  Call \`generate_orbital\` for each orbital:
2918
2995
 
2919
2996
  \`\`\`
@@ -2924,8 +3001,16 @@ generate_orbital({ orbital: {...}, orbitalIndex: 1, totalOrbitals: N })
2924
3001
 
2925
3002
  Each orbital is written to \`.orbitals/<name>.json\` with ALL effects (render-ui, persist, emit, set, etc.).
2926
3003
 
2927
- ### Phase 3: VALIDATE (CRITICAL)
2928
- After generating ALL orbitals, validate BEFORE calling finish_task:
3004
+ ### Phase 3: COMBINE
3005
+ Call \`finish_task\` to auto-combine orbitals into schema.orb:
3006
+
3007
+ \`\`\`
3008
+ finish_task({ appName: "App" })
3009
+ # Reads .orbitals/*.json \u2192 schema.orb \u2192 orbital validate
3010
+ \`\`\`
3011
+
3012
+ ### Phase 4: VALIDATE (CRITICAL)
3013
+ After combining, validate the schema:
2929
3014
 
2930
3015
  \`\`\`
2931
3016
  validate_schema()
@@ -2938,21 +3023,13 @@ validate_schema()
2938
3023
 
2939
3024
  **Common errors to fix:**
2940
3025
  - ORB_E_MISSING_NAME \u2192 Add entity name
2941
- - ORB_E_NO_FIELDS \u2192 Add entity fields
3026
+ - ORB_E_NO_FIELDS \u2192 Add entity fields
2942
3027
  - Missing entity field \u2192 Add entity object with name and fields
2943
3028
 
2944
3029
  **CRITICAL: Check EACH orbital file in .orbitals/ directory:**
2945
3030
  Use Read tool to check each orbital file has entity field.
2946
3031
 
2947
- ### Phase 4: COMBINE
2948
- Call \`finish_task\` to auto-combine:
2949
-
2950
- \`\`\`
2951
- finish_task({ appName: "App" })
2952
- # Reads .orbitals/*.json \u2192 schema.json \u2192 orbital validate
2953
- \`\`\`
2954
-
2955
- ### Phase 4: VERIFY COMPOSITION QUALITY
3032
+ ### Phase 5: VERIFY COMPOSITION QUALITY
2956
3033
 
2957
3034
  Before calling \`finish_task\`, verify each INIT transition:
2958
3035
 
@@ -3243,7 +3320,16 @@ Every orbital MUST have this exact structure:
3243
3320
  - \u274C WRONG: Missing entity field at orbital level
3244
3321
  - \u274C WRONG: Only linkedEntity in trait, no orbital.entity
3245
3322
  - \u274C WRONG: Empty fields array
3323
+ - \u274C WRONG: Using \`@count(tasks)\`, \`@find(...)\`, \`@sum(...)\` \u2014 NO function-call bindings exist
3324
+ - \u274C WRONG: Using \`actions\` array on form-section \u2014 use \`submitEvent\`/\`cancelEvent\` strings
3325
+ - \u274C WRONG: Modal state without CANCEL/CLOSE transitions
3326
+ - \u274C WRONG: Bare \`@entity\` without a field path \u2014 use \`@entity.fieldName\`
3327
+ - \u274C WRONG: \`@Product.name\`, \`@Order.status\`, \`@Customer.email\` \u2014 NEVER use entity TYPE as binding root
3328
+ - \u274C WRONG: \`@count(orders)\`, \`@sum(orders, total)\`, \`@avg(...)\` \u2014 NO aggregate functions exist
3246
3329
  - \u2705 CORRECT: Full entity object with name, collection, persistence, fields
3330
+ - \u2705 CORRECT: \`@entity.name\`, \`@entity.status\`, \`@entity.email\` \u2014 ALWAYS use \`@entity\` as the root
3331
+ - \u2705 CORRECT: Only valid binding roots: \`@entity\`, \`@payload\`, \`@state\`, \`@now\`, \`@config\`
3332
+ - \u2705 CORRECT: Every state rendering to modal/drawer has CANCEL + CLOSE transitions back
3247
3333
 
3248
3334
  ## Field Types
3249
3335
 
@@ -3263,10 +3349,21 @@ Every orbital MUST have this exact structure:
3263
3349
  - INIT effect: render-ui with stack containing header, metrics, entity-table
3264
3350
 
3265
3351
  **Transitions:**
3266
- - Browsing \u2192 Creating: on CREATE
3267
- - Creating \u2192 Browsing: on SAVE or CANCEL
3268
- - Browsing \u2192 Editing: on EDIT
3269
- - Editing \u2192 Browsing: on SAVE or CANCEL
3352
+ - Browsing \u2192 Creating: on CREATE (render modal with form-section using submitEvent/cancelEvent)
3353
+ - Creating \u2192 Browsing: on SAVE (persist + dismiss modal + emit INIT)
3354
+ - Creating \u2192 Browsing: on CANCEL (dismiss modal: ["render-ui", "modal", null])
3355
+ - Creating \u2192 Browsing: on CLOSE (dismiss modal: ["render-ui", "modal", null])
3356
+ - Browsing \u2192 Editing: on EDIT (render modal with form-section)
3357
+ - Editing \u2192 Browsing: on SAVE, CANCEL, CLOSE (same pattern as Creating)
3358
+
3359
+ **CRITICAL: Every state that renders to "modal" or "drawer" MUST have CANCEL and CLOSE transitions.**
3360
+
3361
+ ## form-section Props (NOT actions)
3362
+
3363
+ form-section uses \`submitEvent\`/\`cancelEvent\`, NOT \`actions\` array:
3364
+ \`\`\`json
3365
+ { "type": "form-section", "entity": "Task", "fields": ["title", "status"], "submitEvent": "SAVE", "cancelEvent": "CANCEL" }
3366
+ \`\`\`
3270
3367
 
3271
3368
  ## Effects Reference
3272
3369
 
@@ -3274,11 +3371,32 @@ Every orbital MUST have this exact structure:
3274
3371
  |--------|--------|---------|
3275
3372
  | render-ui | ["render-ui", "main", { ... }] | Render UI pattern |
3276
3373
  | render-ui | ["render-ui", "modal", { ... }] | Render modal |
3374
+ | render-ui | ["render-ui", "modal", null] | Dismiss modal |
3277
3375
  | persist | ["persist", "create", "Entity", "@payload.data"] | Save to DB |
3278
3376
  | set | ["set", "@entity.field", value] | Update field |
3279
3377
  | emit | ["emit", "EVENT", payload] | Emit event |
3280
3378
  | navigate | ["navigate", "/path"] | Navigate |
3281
3379
 
3380
+ ## Valid Slots (ONLY these exist)
3381
+
3382
+ \`"main"\`, \`"modal"\`, \`"drawer"\`, \`"sidebar"\`
3383
+
3384
+ NEVER use: \`"modal-close"\`, \`"notification"\`, \`"confirm-modal"\`, \`"header"\`, \`"footer"\`
3385
+
3386
+ ## Pattern Type Required
3387
+
3388
+ EVERY pattern object in render-ui MUST have a \`"type"\` field. This includes the top-level pattern AND every child in a stack's children array.
3389
+
3390
+ ## FINAL CHECKLIST (read before generating)
3391
+
3392
+ 1. **NO aggregate bindings**: \`@count(...)\`, \`@sum(...)\`, \`@avg(...)\` DO NOT EXIST. Use static text or add a count field to the entity instead.
3393
+ 2. **form-section uses submitEvent/cancelEvent**: \`{ "type": "form-section", "entity": "X", "submitEvent": "SAVE", "cancelEvent": "CANCEL" }\`. NEVER put \`"actions"\` array on form-section \u2014 \`actions\` is for page-header and entity-detail only.
3394
+ 3. **Arrays not objects**: \`fields\`, \`states\`, \`events\`, \`transitions\`, \`children\` MUST be arrays \`[]\`, NEVER objects \`{}\`.
3395
+ 4. **Every render-ui child needs "type"**: \`{ "type": "typography", "text": "..." }\` not \`{ "text": "..." }\`
3396
+ 5. **Valid slots only**: \`"main"\`, \`"modal"\`, \`"drawer"\`, \`"sidebar"\` \u2014 nothing else.
3397
+ 6. **Binding roots**: ONLY \`@entity.field\`, \`@payload.field\`, \`@state\`, \`@now\`, \`@config\`. NEVER \`@Order.field\` or \`@count()\`.
3398
+ 7. **Trait naming**: Name the trait \`{Entity}Interaction\` (e.g., \`CustomerInteraction\`, \`OrderInteraction\`). The page ref MUST match: \`"traits": [{ "ref": "CustomerInteraction" }]\`.
3399
+
3282
3400
  ## Output Requirements
3283
3401
 
3284
3402
  Return ONLY valid JSON. No markdown, no explanations.
@@ -3291,7 +3409,7 @@ function generateKflowOrbitalsSkill(compact = false) {
3291
3409
  const frontmatter = {
3292
3410
  name: "kflow-orbitals",
3293
3411
  description: "Generate KFlow schemas using the Orbitals composition model. Decomposes applications into atomic Orbital Units (Entity x Traits x Patterns) with structural caching for efficiency.",
3294
- allowedTools: ["Read", "Write", "Edit", "generate_orbital", "finish_task", "query_schema_structure", "extract_chunk", "apply_chunk"],
3412
+ allowedTools: ["Read", "Write", "Edit", "generate_orbital", "generate_schema_orchestrated", "finish_task", "query_schema_structure", "extract_chunk", "apply_chunk"],
3295
3413
  version: "5.0.0"
3296
3414
  // v5.0: atomic composition (removed design_transition, single-pass design)
3297
3415
  };
@@ -3387,14 +3505,14 @@ ${getCompletionRulesSection()}
3387
3505
 
3388
3506
  \`\`\`
3389
3507
  \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
3390
- \u2502 ALWAYS write to: schema.json \u2502
3508
+ \u2502 ALWAYS write to: schema.orb \u2502
3391
3509
  \u2502 \u2502
3392
3510
  \u2502 NEVER use other file names like: \u2502
3393
- \u2502 - schema_with_fixes.json \u274C \u2502
3394
- \u2502 - new_schema.json \u274C \u2502
3395
- \u2502 - updated_schema.json \u274C \u2502
3511
+ \u2502 - schema_with_fixes.orb \u274C \u2502
3512
+ \u2502 - new_schema.orb \u274C \u2502
3513
+ \u2502 - updated_schema.orb \u274C \u2502
3396
3514
  \u2502 \u2502
3397
- \u2502 The persistence system ONLY reads from schema.json \u2502
3515
+ \u2502 The persistence system ONLY reads from schema.orb \u2502
3398
3516
  \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
3399
3517
  \`\`\`
3400
3518
  `;
@@ -3413,7 +3531,7 @@ function generateKflowOrbitalFixingSkill() {
3413
3531
  const frontmatter = {
3414
3532
  name: metadata.name,
3415
3533
  description: metadata.description,
3416
- allowedTools: ["Read", "Edit", "Bash", "query_schema_structure", "extract_chunk", "apply_chunk"],
3534
+ allowedTools: ["Read", "Edit", "Bash", "fix_schema_orchestrated", "query_schema_structure", "extract_chunk", "apply_chunk"],
3417
3535
  version: metadata.version
3418
3536
  };
3419
3537
  const content = generateLeanFixingSkill({
@@ -3427,36 +3545,6 @@ function generateKflowOrbitalFixingSkill() {
3427
3545
  content
3428
3546
  };
3429
3547
  }
3430
-
3431
- // src/generators/domain-language.ts
3432
- var ODL_SYNTAX_REFERENCE = `
3433
- ## Domain Language Syntax
3434
-
3435
- Entity: \`A [Name] is a [persistent] entity that: - has [field] as [type]\`
3436
- Page: \`[PageName] at /[path]: - shows [Entity] using [Behavior]\`
3437
- `;
3438
- var ODL_EXAMPLES = `
3439
- ## Examples
3440
-
3441
- \`\`\`
3442
- A Task is a persistent entity that:
3443
- - has title as text (required)
3444
- - has status as enum [pending, active, done]
3445
-
3446
- TasksPage at /tasks:
3447
- - shows Task using List behavior
3448
- \`\`\`
3449
- `;
3450
- var ODL_PATTERNS = `
3451
- ## Patterns
3452
-
3453
- Use patterns like entity-table, form-section in domain language.
3454
- `;
3455
- var ODL_TO_SCHEMA_MAPPING = `
3456
- ## Mapping
3457
-
3458
- Domain language converts to OrbitalSchema JSON via compiler.
3459
- `;
3460
3548
  function generateDomainLanguageSkill() {
3461
3549
  const frontmatter = {
3462
3550
  name: "domain-language",
@@ -3490,21 +3578,9 @@ Create human-readable summaries of existing domain language definitions.
3490
3578
 
3491
3579
  Make targeted edits to existing domain language text.
3492
3580
 
3493
- ## Domain Language Syntax Reference
3581
+ ## Domain Language Reference
3494
3582
 
3495
- ${ODL_SYNTAX_REFERENCE}
3496
-
3497
- ## Patterns Reference
3498
-
3499
- ${ODL_PATTERNS}
3500
-
3501
- ## Full Examples
3502
-
3503
- ${ODL_EXAMPLES}
3504
-
3505
- ## Mapping to Schema
3506
-
3507
- ${ODL_TO_SCHEMA_MAPPING}
3583
+ ${generateDomainLanguageReference()}
3508
3584
 
3509
3585
  ## Generation Workflow
3510
3586
 
@@ -3665,7 +3741,7 @@ var LEAN_DECOMPOSITION_PROTOCOL = `
3665
3741
  3. Create pages for each entity (list, create, edit)
3666
3742
  4. Apply std behaviors (List, Detail, Form)
3667
3743
  `;
3668
- var ODL_SYNTAX_REFERENCE2 = `
3744
+ var ODL_SYNTAX_REFERENCE = `
3669
3745
  ## Domain Language Syntax
3670
3746
 
3671
3747
  **Entity**:
@@ -3709,13 +3785,13 @@ var LEAN_COMMON_ERRORS = `
3709
3785
  - Don't create separate create/edit/view pages
3710
3786
  - Use std behaviors
3711
3787
  `;
3712
- var ODL_PATTERNS2 = `
3788
+ var ODL_PATTERNS = `
3713
3789
  ## Patterns
3714
3790
 
3715
3791
  Entity patterns: entity-table, entity-list, entity-cards
3716
3792
  Form patterns: form-section
3717
3793
  `;
3718
- var ODL_TO_SCHEMA_MAPPING2 = `
3794
+ var ODL_TO_SCHEMA_MAPPING = `
3719
3795
  ## Mapping
3720
3796
 
3721
3797
  Domain language is converted to OrbitalSchema JSON by the compiler.
@@ -3758,7 +3834,7 @@ ${LEAN_OUTPUT_FORMAT}
3758
3834
 
3759
3835
  ---
3760
3836
 
3761
- ${ODL_SYNTAX_REFERENCE2}
3837
+ ${ODL_SYNTAX_REFERENCE}
3762
3838
 
3763
3839
  ---
3764
3840
 
@@ -3774,11 +3850,11 @@ ${LEAN_COMMON_ERRORS}
3774
3850
 
3775
3851
  ---
3776
3852
 
3777
- ${ODL_PATTERNS2}
3853
+ ${ODL_PATTERNS}
3778
3854
 
3779
3855
  ---
3780
3856
 
3781
- ${ODL_TO_SCHEMA_MAPPING2}
3857
+ ${ODL_TO_SCHEMA_MAPPING}
3782
3858
 
3783
3859
  ---
3784
3860
 
@@ -3991,7 +4067,7 @@ var LEAN_VALIDATION_RULES2 = `
3991
4067
  - Page paths must be unique
3992
4068
  - Behaviors must be from std library
3993
4069
  `;
3994
- var ODL_SYNTAX_REFERENCE3 = `
4070
+ var ODL_SYNTAX_REFERENCE2 = `
3995
4071
  ## Domain Language Syntax
3996
4072
 
3997
4073
  See kflow-lean-orbitals skill for full syntax reference.
@@ -4001,7 +4077,7 @@ var LEAN_EFFECT_GUARD_SYNTAX2 = `
4001
4077
 
4002
4078
  Use S-expressions in domain language for guards and effects.
4003
4079
  `;
4004
- var ODL_TO_SCHEMA_MAPPING3 = `
4080
+ var ODL_TO_SCHEMA_MAPPING2 = `
4005
4081
  ## Schema Mapping
4006
4082
 
4007
4083
  Domain language maps to OrbitalSchema JSON structure.
@@ -4157,7 +4233,7 @@ A Task is a persistent entity that:
4157
4233
 
4158
4234
  ---
4159
4235
 
4160
- ${ODL_SYNTAX_REFERENCE3}
4236
+ ${ODL_SYNTAX_REFERENCE2}
4161
4237
 
4162
4238
  ---
4163
4239
 
@@ -4169,7 +4245,7 @@ ${LEAN_VALIDATION_RULES2}
4169
4245
 
4170
4246
  ---
4171
4247
 
4172
- ${ODL_TO_SCHEMA_MAPPING3}
4248
+ ${ODL_TO_SCHEMA_MAPPING2}
4173
4249
 
4174
4250
  ---
4175
4251