@adia-ai/adia-ui-factory 0.2.4 → 0.8.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.
Files changed (145) hide show
  1. package/.claude-plugin/plugin.json +6 -8
  2. package/.mcp.json +1 -1
  3. package/CHANGELOG.md +40 -67
  4. package/README.md +32 -53
  5. package/agents/app-architect.md +28 -0
  6. package/agents/routing-corpus.json +202 -0
  7. package/agents/screen-composer.md +27 -0
  8. package/bin/adia-info +235 -0
  9. package/bin/adia-lint +17 -2
  10. package/commands/adia-genui.md +5 -8
  11. package/commands/adia-migrate.md +5 -6
  12. package/commands/adia-orient.md +5 -10
  13. package/commands/adia-scaffold.md +7 -13
  14. package/commands/adia-verify.md +5 -6
  15. package/package.json +5 -6
  16. package/references/a2ui-mcp-tools.md +11 -8
  17. package/references/authoring-components.md +25 -1
  18. package/references/component-model.md +52 -4
  19. package/references/contracts/a2ui-mcp-surface.md +35 -0
  20. package/references/contracts/migration-guide-format.md +34 -0
  21. package/references/data-and-hydration.md +8 -5
  22. package/references/genui-a2ui.md +12 -6
  23. package/references/llm.md +22 -39
  24. package/references/migration.md +110 -36
  25. package/references/project-shapes.md +11 -13
  26. package/references/shell-admin.md +5 -2
  27. package/references/shell-chat.md +5 -3
  28. package/references/shell-editor.md +1 -1
  29. package/references/shell-embed.md +40 -26
  30. package/references/shell-simple.md +5 -2
  31. package/references/spa-architecture.md +28 -73
  32. package/references/ssr-integration.md +1 -1
  33. package/references/verification.md +8 -12
  34. package/skills/adia-compose/SKILL.md +121 -0
  35. package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/Guidelines.md +3 -3
  36. package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/components.md +1 -1
  37. package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/styles.md +1 -1
  38. package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/tokens.md +3 -3
  39. package/skills/{adia-ui-kit → adia-compose}/assets/templates/FEEDBACK.template.md +7 -7
  40. package/skills/{adia-ui-kit → adia-compose}/assets/templates/RESPONSE.template.md +6 -7
  41. package/skills/adia-compose/references/composition-traps.md +58 -0
  42. package/skills/adia-compose/references/feedback-discipline.md +20 -0
  43. package/skills/adia-compose/references/spec-to-ui-reasoning.md +158 -0
  44. package/skills/adia-data/SKILL.md +78 -0
  45. package/skills/adia-genui/SKILL.md +83 -0
  46. package/skills/adia-host/SKILL.md +119 -0
  47. package/skills/adia-llm/SKILL.md +36 -0
  48. package/skills/adia-migrate/SKILL.md +95 -0
  49. package/skills/adia-orient/SKILL.md +135 -0
  50. package/skills/adia-project/SKILL.md +83 -0
  51. package/skills/adia-shells/SKILL.md +74 -0
  52. package/skills/adia-verify/SKILL.md +43 -0
  53. package/skills/adia-verify/references/verification.md +42 -0
  54. package/commands/adia-compose.md +0 -10
  55. package/commands/adia-wire.md +0 -13
  56. package/skills/adia-ui-compose/SKILL.md +0 -57
  57. package/skills/adia-ui-data/SKILL.md +0 -62
  58. package/skills/adia-ui-factory/SKILL.md +0 -113
  59. package/skills/adia-ui-genui/SKILL.md +0 -74
  60. package/skills/adia-ui-kit/CHANGELOG.md +0 -41
  61. package/skills/adia-ui-kit/SKILL.md +0 -442
  62. package/skills/adia-ui-kit/assets/team-scaffold/archive-README.md +0 -30
  63. package/skills/adia-ui-kit/assets/team-scaffold/drafts-README.md +0 -57
  64. package/skills/adia-ui-kit/assets/team-scaffold/inbox-README.md +0 -76
  65. package/skills/adia-ui-kit/assets/team-scaffold/outbox-README.md +0 -46
  66. package/skills/adia-ui-kit/assets/team-scaffold/team-root.README.md +0 -51
  67. package/skills/adia-ui-kit/assets/team-scaffold/tickets-README.md +0 -208
  68. package/skills/adia-ui-kit/assets/team-scaffold/tickets-REGISTRY.md +0 -81
  69. package/skills/adia-ui-kit/assets/templates/AGENTS.template.md +0 -128
  70. package/skills/adia-ui-kit/assets/templates/CLAUDE.template.md +0 -1
  71. package/skills/adia-ui-kit/assets/templates/figma-make-guidelines.md +0 -90
  72. package/skills/adia-ui-kit/evals/adversarial-content-trust.json +0 -83
  73. package/skills/adia-ui-kit/evals/evals.json +0 -55
  74. package/skills/adia-ui-kit/evals/routing-corpus.json +0 -121
  75. package/skills/adia-ui-kit/evals/teach-routing-cases.json +0 -92
  76. package/skills/adia-ui-kit/references/capabilities.md +0 -245
  77. package/skills/adia-ui-kit/references/catalog-lookup.md +0 -186
  78. package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v1.md +0 -8
  79. package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v2.md +0 -3585
  80. package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v3.md +0 -1899
  81. package/skills/adia-ui-kit/references/common-gotchas-consumer.md +0 -522
  82. package/skills/adia-ui-kit/references/component-literacy.md +0 -291
  83. package/skills/adia-ui-kit/references/composition.md +0 -245
  84. package/skills/adia-ui-kit/references/correction-loop.md +0 -462
  85. package/skills/adia-ui-kit/references/css-policy.md +0 -343
  86. package/skills/adia-ui-kit/references/decision-model.md +0 -158
  87. package/skills/adia-ui-kit/references/diagnostic-output.md +0 -57
  88. package/skills/adia-ui-kit/references/docs-catalog.md +0 -239
  89. package/skills/adia-ui-kit/references/exclusions.md +0 -225
  90. package/skills/adia-ui-kit/references/feedback-authoring.md +0 -466
  91. package/skills/adia-ui-kit/references/figma-make.md +0 -244
  92. package/skills/adia-ui-kit/references/flows-auth.md +0 -307
  93. package/skills/adia-ui-kit/references/flows-content.md +0 -206
  94. package/skills/adia-ui-kit/references/flows-data.md +0 -348
  95. package/skills/adia-ui-kit/references/flows-interaction.md +0 -181
  96. package/skills/adia-ui-kit/references/flows-shells.md +0 -336
  97. package/skills/adia-ui-kit/references/gap-detection.md +0 -266
  98. package/skills/adia-ui-kit/references/harness.md +0 -284
  99. package/skills/adia-ui-kit/references/loading-protocol.md +0 -406
  100. package/skills/adia-ui-kit/references/local-link.md +0 -198
  101. package/skills/adia-ui-kit/references/mcp.md +0 -401
  102. package/skills/adia-ui-kit/references/migration.md +0 -116
  103. package/skills/adia-ui-kit/references/mission.md +0 -194
  104. package/skills/adia-ui-kit/references/mode-routing.md +0 -298
  105. package/skills/adia-ui-kit/references/patterns-agent.md +0 -223
  106. package/skills/adia-ui-kit/references/patterns-data.md +0 -1065
  107. package/skills/adia-ui-kit/references/patterns-forms.md +0 -223
  108. package/skills/adia-ui-kit/references/patterns-layout.md +0 -326
  109. package/skills/adia-ui-kit/references/patterns-recipes.md +0 -1416
  110. package/skills/adia-ui-kit/references/patterns-shells.md +0 -1097
  111. package/skills/adia-ui-kit/references/patterns-traits.md +0 -259
  112. package/skills/adia-ui-kit/references/patterns-wiring.md +0 -339
  113. package/skills/adia-ui-kit/references/pev-rationale.md +0 -137
  114. package/skills/adia-ui-kit/references/reasoning-gate.md +0 -146
  115. package/skills/adia-ui-kit/references/reasoning-methodologies.md +0 -112
  116. package/skills/adia-ui-kit/references/recon.md +0 -192
  117. package/skills/adia-ui-kit/references/rendering-model.md +0 -431
  118. package/skills/adia-ui-kit/references/response-authoring.md +0 -398
  119. package/skills/adia-ui-kit/references/session-log-schema.md +0 -203
  120. package/skills/adia-ui-kit/references/session-log-template.md +0 -118
  121. package/skills/adia-ui-kit/references/setup.md +0 -652
  122. package/skills/adia-ui-kit/references/skill-hygiene.md +0 -135
  123. package/skills/adia-ui-kit/references/spec-to-ui-reasoning.md +0 -394
  124. package/skills/adia-ui-kit/references/state.md +0 -229
  125. package/skills/adia-ui-kit/references/teach-protocol.md +0 -421
  126. package/skills/adia-ui-kit/references/theme.md +0 -142
  127. package/skills/adia-ui-kit/references/version-check.md +0 -69
  128. package/skills/adia-ui-kit/scripts/audit-decision-trace.mjs +0 -198
  129. package/skills/adia-ui-kit/scripts/audit-kit-roster.mjs +0 -366
  130. package/skills/adia-ui-kit/scripts/changelog-archive.mjs +0 -126
  131. package/skills/adia-ui-kit/scripts/check-adia-versions.py +0 -404
  132. package/skills/adia-ui-kit/scripts/run-skill-evals.mjs +0 -358
  133. package/skills/adia-ui-kit/scripts/validate-session-log.mjs +0 -242
  134. package/skills/adia-ui-kit/skill.json +0 -102
  135. package/skills/adia-ui-llm/SKILL.md +0 -51
  136. package/skills/adia-ui-migrate/SKILL.md +0 -64
  137. package/skills/adia-ui-migration/CHANGELOG.md +0 -47
  138. package/skills/adia-ui-migration/SKILL.md +0 -381
  139. package/skills/adia-ui-migration/skill.json +0 -29
  140. package/skills/adia-ui-project/SKILL.md +0 -77
  141. package/skills/adia-ui-shells/SKILL.md +0 -62
  142. package/skills/adia-ui-spa/SKILL.md +0 -52
  143. package/skills/adia-ui-ssr/SKILL.md +0 -52
  144. package/skills/adia-ui-verify/SKILL.md +0 -44
  145. /package/skills/{adia-ui-kit → adia-compose}/assets/templates/FEEDBACK-OMISSIONS-DEFENSE.template.md +0 -0
@@ -1,229 +0,0 @@
1
- ---
2
- name: state
3
- load-when: Authoring state management — signals, controllers, BaseController extension, optimistic updates, undo/redo. Covers the state-as-attribute contract + the controller delegation pattern
4
- load-size-tokens: ~2,000
5
- required-for:
6
- - composition with interactive state
7
- - controller authoring
8
- - data-stream binding
9
- ---
10
-
11
- # §State — Signals, controllers, undo/redo
12
-
13
- AdiaUI components reactively re-render when their JS properties change.
14
- The signal-backed property system is the substrate everything else builds on.
15
-
16
- ### Three layers
17
-
18
- | Layer | Use for | API |
19
- |---|---|---|
20
- | **Signals** | Local reactive state — counters, form values, toggles | `signal()`, `computed()`, `effect()` |
21
- | **Controllers** | Domain state — tasks list, document tree, selection | `extends BaseController` |
22
- | **Component props** | Auto-bound to signals via `static properties` | `el.foo = value` (re-renders) |
23
-
24
- ### Signals (local state)
25
-
26
- Three primitives from `@adia-ai/web-components/core/signals`:
27
-
28
- ```js
29
- import { signal, computed, effect, batch } from '@adia-ai/web-components/core/signals';
30
-
31
- // Mutable signal
32
- const count = signal(0);
33
- count.value = 5; // re-fires subscribers
34
- count.peek(); // read without subscribing
35
-
36
- // Derived signal (re-computes when deps change)
37
- const doubled = computed(() => count.value * 2);
38
-
39
- // Side effect (auto-tracks deps)
40
- const dispose = effect(() => {
41
- console.log('count:', count.value);
42
- });
43
- dispose(); // cleanup
44
-
45
- // Batch multiple writes into one notification
46
- batch(() => {
47
- count.value = 10;
48
- count.value = 20; // only one re-render
49
- });
50
- ```
51
-
52
- **Wiring to components:**
53
-
54
- ```js
55
- const slider = document.querySelector('slider-ui');
56
- const speed = signal(50);
57
-
58
- // One-way: signal → component
59
- effect(() => { slider.value = speed.value; });
60
-
61
- // Two-way: component → signal
62
- slider.addEventListener('change', e => { speed.value = e.detail.value; });
63
- ```
64
-
65
- > ⚠️ **Update components in place — never re-render by replacing `innerHTML`.**
66
- > The wiring above mutates a JS property (`slider.value = …`) on an element
67
- > that already exists. Do **not** instead rebuild the subtree on every signal
68
- > change with `container.innerHTML = …` — that destroys and recreates every
69
- > `*-ui` element, and each fresh `connectedCallback` starts with no prior
70
- > state, so CSS transitions have nothing to animate from: `segmented-ui`'s
71
- > indicator pill never slides, `chart-ui` loses its data-change animation,
72
- > `button-ui` its press / hover transitions.
73
- >
74
- > **Rule:** create components once; update them via property mutation
75
- > (`el.value = x`, `el.data = arr`, `el.text = s`). `innerHTML` is for the
76
- > initial scaffold and for static / empty / error overlays only — never for
77
- > a reactive re-render of transitioning primitives.
78
- >
79
- > **Never set `.innerHTML` on a UIElement component host itself** — not just
80
- > on a plain container. `drawer.innerHTML = …` / `card.innerHTML = …` wipes
81
- > the element's own stamped internal parts (`drawer-ui`'s `<dialog>`, card
82
- > chrome, …). The component re-stamps on its next render, but a reference it
83
- > captured in `connected()` is left pointing at detached DOM — `drawer-ui`
84
- > silently stops opening, with no console error. For a dynamic drawer: keep
85
- > `<header>`/`<section>`/`<footer>` as persistent children and mutate the
86
- > content of a plain inner element, never the `<drawer-ui>` host.
87
-
88
- ### Controllers (domain state with optimistic + undo)
89
-
90
- For non-trivial apps, extend `BaseController` from
91
- `@adia-ai/web-components/core/controller`:
92
-
93
- ```js
94
- import { BaseController } from '@adia-ai/web-components/core/controller';
95
- import { signal, batch } from '@adia-ai/web-components/core/signals';
96
-
97
- const tasksSignal = signal([]);
98
-
99
- export class TaskController extends BaseController {
100
- static schema = {
101
- name: 'task',
102
- state: { tasks: 'array', undoStack: 'array', redoStack: 'array' },
103
- commands: ['create', 'update', 'delete', 'undo', 'redo'],
104
- attributes: ['data-task-count'],
105
- };
106
-
107
- #undoStack = [];
108
- #redoStack = [];
109
-
110
- // Required: snapshot for sync re-renders
111
- getState() {
112
- return {
113
- tasks: tasksSignal.value,
114
- undoStack: this.#undoStack.map(e => ({ id: e.id, label: e.label })),
115
- redoStack: this.#redoStack.map(e => ({ id: e.id, label: e.label })),
116
- };
117
- }
118
-
119
- // Reflect summary attributes back to host (for CSS targeting)
120
- reflect() {
121
- if (!this.host) return;
122
- this.host.setAttribute('data-task-count', String(tasksSignal.value.length));
123
- }
124
-
125
- // Commands (invoked from UI)
126
- create(task) {
127
- const prev = tasksSignal.value;
128
- tasksSignal.value = [...prev, task];
129
- this.#undoStack.push({ id: task.id, label: 'create task', undo: () => {
130
- tasksSignal.value = prev;
131
- }});
132
- this.#redoStack = [];
133
- this.notify();
134
- }
135
-
136
- undo() {
137
- const entry = this.#undoStack.pop();
138
- if (!entry) return;
139
- entry.undo();
140
- this.#redoStack.push(entry);
141
- this.notify();
142
- }
143
- }
144
- ```
145
-
146
- **Hooking into a component:**
147
-
148
- ```js
149
- // In your shell setup
150
- const controller = new TaskController();
151
- const taskList = document.querySelector('#task-list');
152
- controller.connect(taskList);
153
-
154
- // Re-render when state changes
155
- controller.subscribe(() => {
156
- const { tasks } = controller.getState();
157
- taskList.data = tasks;
158
- });
159
-
160
- // Commands invoked from UI
161
- document.querySelector('#new-task-btn').addEventListener('press', () => {
162
- controller.create({ id: crypto.randomUUID(), title: 'New task' });
163
- });
164
- ```
165
-
166
- ### Optimistic updates pattern
167
-
168
- The controller writes the optimistic state first, then awaits the server
169
- and rolls back on failure:
170
-
171
- ```js
172
- async create(task) {
173
- const prev = tasksSignal.value;
174
- // 1. Optimistic write — UI updates immediately
175
- tasksSignal.value = [...prev, { ...task, pending: true }];
176
- this.notify();
177
- try {
178
- // 2. Server confirms
179
- const saved = await this.#service.create(task);
180
- tasksSignal.value = tasksSignal.value.map(t =>
181
- t.id === task.id ? { ...saved, pending: false } : t
182
- );
183
- } catch (err) {
184
- // 3. Rollback on failure
185
- tasksSignal.value = prev;
186
- throw new ServiceError('create-failed', { task, cause: err });
187
- } finally {
188
- this.notify();
189
- }
190
- }
191
- ```
192
-
193
- ### Form submission
194
-
195
- Two patterns depending on whether you need a JS controller:
196
-
197
- **Pattern A — native form submit (no JS):**
198
-
199
- ```html
200
- <form action="/api/users" method="POST">
201
- <col-ui gap="3">
202
- <field-ui label="Name"><input-ui name="name" required></input-ui></field-ui>
203
- <field-ui label="Email"><input-ui name="email" type="email" required></input-ui></field-ui>
204
- <button-ui text="Submit" variant="primary" type="submit"></button-ui>
205
- </col-ui>
206
- </form>
207
- ```
208
-
209
- AdiaUI form participants (`input-ui`, `select-ui`, `textarea-ui`, `check-ui`,
210
- etc.) use `ElementInternals` form participation — they submit like native
211
- HTML inputs. The `name` attribute is what shows up in the form data.
212
-
213
- **Pattern B — JS handler with validation:**
214
-
215
- ```js
216
- const form = document.querySelector('form');
217
- form.addEventListener('submit', async (e) => {
218
- e.preventDefault();
219
- const data = Object.fromEntries(new FormData(form));
220
- try {
221
- await controller.submit(data);
222
- toastUI.show({ variant: 'success', text: 'Saved' });
223
- } catch (err) {
224
- toastUI.show({ variant: 'danger', text: err.message });
225
- }
226
- });
227
- ```
228
-
229
- ---
@@ -1,421 +0,0 @@
1
- # Reference: Teach Protocol — Absorbing new knowledge into the adia-ui-kit skill
2
-
3
- **Authored:** 2026-05-22 (§409 follow-up to the §404 SoT-yaml sweep + §408 catalog-renderer bug).
4
- **Why authored:** The skill has §SkillHygiene (audit) and a CHANGELOG cadence (cut/ship), but no explicit *teach* procedure. Operator + sibling-agent requests of the shape "make sure adia-ui-kit is aware of [x, y, z]" / "train the skill on [a, b, c]" need a deterministic landing path so the next person who needs to add knowledge knows where it goes — not just where they *think* it should go.
5
-
6
- **Ecosystem context:** This reference is the canonical instance of a generalizable **extensibility** pattern documented at `.agents/skills/VISION-extensibility.md`. The vision separates universal components (the trigger cluster, the 7 anti-patterns, the 5-step landing procedure, the citation-vs-knowledge principle, the negative case G) from skill-specific components (the decision tree's branches A-G, the worked examples). When editing this file, preserve the universal sections verbatim where possible — they're shared infrastructure. When porting §Teach to sibling roll-ups (`adia-ui-release`, `adia-ui-authoring`), this file is the template; copy the universal parts, replace the decision tree + worked examples with the sibling's topology.
7
-
8
- **Used by:** `adia-ui-kit` skill, when an agent receives one of these triggers (the SKILL.md §Teach section, when added, names the trigger phrases and routes here for the procedural detail):
9
-
10
- - "make sure `adia-ui-kit` skill is aware of [x]"
11
- - "train/update `adia-ui-kit` on [y, z]"
12
- - "the skill should know about [the new pattern from §397]"
13
- - "[FEEDBACK-NN was resolved with this fix] — make sure the skill reflects it"
14
- - "absorb this lesson into adia-ui-kit"
15
- - "teach the skill about [the new component / pattern / discipline]"
16
-
17
- **Companion:** `feedback-authoring.md` (when the new knowledge originated from a FEEDBACK ticket loop) and the §SkillHygiene section of `SKILL.md` (run hygiene audit after any §Teach landing).
18
-
19
- **Anti-companion:** `.claude/docs/journal/YYYY/MM/<date>.md` (arc-specific stories belong in the journal, not the skill — see decision tree below).
20
-
21
- ---
22
-
23
- ## When to Use
24
-
25
- Trigger phrases (from the §Teach section in SKILL.md):
26
-
27
- - "make sure `adia-ui-kit` knows about X"
28
- - "train the skill on X"
29
- - "teach the skill about Y"
30
- - "the skill should be aware of Z"
31
- - "absorb [pattern/lesson/feedback] into adia-ui-kit"
32
- - "update the skill to reflect [the new ADR / the resolved FEEDBACK-NN / the new primitive]"
33
-
34
- This protocol applies when **another agent in the codebase** (substrate author, kanban worker, peer skill author) hands you new knowledge to integrate. It does NOT apply when:
35
-
36
- - You're authoring fresh content from scratch (use §Mission's Author posture instead)
37
- - You're fixing a wrong claim in the skill (use §CorrectionLoop instead)
38
- - You're running cleanup / archive sweeps (use §SkillHygiene's hygiene-cut shape)
39
-
40
- The procedure below is **the binding** for skill-teach requests. Follow it in order. Each step has a stop-condition; do not skip ahead.
41
-
42
- ---
43
-
44
- ## Core Principles
45
-
46
- 1. **The skill is a citation layer, not a knowledge layer.** Per-component facts (slots, props, decision rules, keywords, synonyms) live in **yaml SoT** at `packages/web-components/components/*.yaml`. The skill cites tags + recipe patterns, never duplicates yaml prose.
47
- 2. **Reference files are the cold-start budget's safety valve.** New content > ~50 LOC of procedural detail belongs in `references/<topic>.md` and is cited from SKILL.md, not inlined. This protects the eight hygiene axes (especially axis 1 token economy + axis 8 cold-start path weight).
48
- 3. **Triggers without binding sections are waste.** Adding keywords to `trigger:` without a corresponding §-section in SKILL.md (or a referenced file) consumes activation budget for no payoff. Always pair the two.
49
- 4. **Capability menu items must reach an actual section.** A menu item that points nowhere is worse than no menu item — the cold-start surface is the agent's mental model; lies cost more than gaps.
50
- 5. **Version bumps are PATCH for citations, MINOR for new procedural sections, MAJOR for renames/removals.** Most §Teach landings are MINOR (a new section + reference file). Never bundle MINOR adds with PATCH polish in one cut.
51
- 6. **Hygiene audit is the receipt.** A §Teach landing isn't done until `node scripts/skills/audit-skill-hygiene.mjs adia-ui-kit` runs clean (or you've explicitly noted the new thresholds you accept).
52
-
53
- ---
54
-
55
- ## The Decision Tree — where does new knowledge land?
56
-
57
- Run this **before** any patch. The wrong landing target wastes effort and creates drift.
58
-
59
- **v3.1.0+ mechanized**: the decision tree is now `scripts/teach-route.mjs`. Given a knowledge-payload description, the script returns a deterministic landing target (file path or "journal-only"). Run it before authoring any teach-landing patch:
60
-
61
- ```bash
62
- node scripts/teach-route.mjs --payload="new slot on button-ui for trailing icons"
63
- # → landing: packages/web-components/components/button/button.yaml
64
- # → branch: A (per-component-contract)
65
- # → confidence: high
66
-
67
- # Pipe from stdin:
68
- echo "add a recipe for composing an editor-shell inside an admin-page-body" \
69
- | node scripts/teach-route.mjs
70
- # → landing: references/patterns-shells.md
71
- # → branch: B (recipe)
72
- ```
73
-
74
- If the script's confidence is **low**, re-read the prose tree below and classify by hand — the keyword vocabulary missed the payload's shape and you should consider adding the payload to `../evals/teach-routing-cases.json` so future runs catch it. If the script's confidence is **high** or **medium**, trust the landing.
75
-
76
- Behavioral eval suite: `node scripts/teach-route.mjs --eval=evals/teach-routing-cases.json` runs all canonical cases and reports pass/fail. v3.1.0 baseline: 9/9 (100%).
77
-
78
- ### The 7 branches (mechanized in `teach-route.mjs`)
79
-
80
- ```
81
- Is the new fact a PER-COMPONENT contract (slot, prop, decision rule,
82
- keyword, synonym, a2ui.rule)?
83
- → YES (branch A): belongs in YAML SoT, not in the skill.
84
- Open the component's `.yaml` file at
85
- `packages/web-components/components/<name>/<name>.yaml`
86
- (or `packages/web-modules/.../<name>.yaml`).
87
- Add to the appropriate field; run `npm run build:components`
88
- to regenerate sidecars + catalog. Skill cites by tag — it
89
- doesn't need to change.
90
- STOP HERE. Do not edit the skill.
91
- (See Worked Example A below.)
92
- → NO: continue.
93
-
94
- Is it a RECIPE — a cross-component composition pattern with code?
95
- → YES (branch B): lands in `references/patterns-<domain>.md`.
96
- Choose domain by the recipe's center of gravity:
97
- - shell composition / nesting → `patterns-shells.md`
98
- - form layouts / input bindings → `patterns-forms.md`
99
- - data tables / charts / wiring → `patterns-data.md`
100
- - layout primitives (row/col/stack) → `patterns-layout.md`
101
- - agent-UI surfaces (chat/feedback/trace) → `patterns-agent.md`
102
- - event wiring / controllers / signals → `patterns-wiring.md`
103
- - traits and behavioral primitives → `patterns-traits.md`
104
- If the recipe spans 3+ domains, prefer `patterns-recipes.md`
105
- (the cross-cutting bundle).
106
- Add cross-link from SKILL.md §Patterns table.
107
- (See Worked Example B below.)
108
-
109
- Is it a FLOW — an end-to-end multi-page user journey?
110
- → YES (branch C): lands in `references/flows-<domain>.md`. Existing flows:
111
- - flows-auth.md, flows-content.md, flows-data.md,
112
- flows-interaction.md, flows-shells.md
113
- Create a new `flows-<X>.md` if no existing file fits.
114
- Cross-link from SKILL.md §Flows table.
115
- (See Worked Example C below.)
116
-
117
- Is it a DISCIPLINE / POSTURE / METHODOLOGY shift?
118
- → YES (branch D): lands INLINE in SKILL.md. These ARE the procedural spine:
119
- §Mission, §ReasoningMethodologies, §CorrectionLoop, §LoadingProtocol,
120
- §SkillHygiene, §FeedbackDiscipline.
121
- They're allowed to grow because they shape every other section.
122
- Run §SkillHygiene audit + `check:skills:seed-size` after to confirm
123
- cold-start budget held.
124
- (See Worked Example D below.)
125
-
126
- Is it a TOOLING addition — a new script / CLI / verification command?
127
- → YES (branch E): lands in `scripts/` (under SKILL.md's `scripts/` directory or
128
- the repo's `scripts/audit/` etc.). Cross-link from the
129
- §SkillHygiene "harness manifest" table in SKILL.md.
130
- (See Worked Example E below.)
131
-
132
- Is it a FEEDBACK RESOLUTION (upstream ticket landed, skill should reflect)?
133
- → YES (branch F): TWO landings usually needed.
134
- 1. The fix itself (yaml / code) — that's in the substrate, not
135
- the skill.
136
- 2. The CORRECTION (what the skill said before that turned out
137
- to be wrong) — this is §CorrectionLoop territory. Patch the
138
- skill text where the bug-shape was misdiagnosed; add the
139
- new pattern to the bug-shape taxonomy.
140
- (See Worked Example F below.)
141
-
142
- Is it a one-off ARC STORY, LESSON LEARNED, OR HISTORICAL CONTEXT?
143
- → NO landing in the skill (branch G — the NEGATIVE case).
144
- It belongs in `.claude/docs/journal/YYYY/MM/<date>.md` where future
145
- archeology will find it (per AGENTS.md's journal discipline).
146
- Skipping the skill here is a feature, not a gap.
147
- (See Worked Example G — the negative case.)
148
- ```
149
-
150
- When the script and the prose disagree, the script wins for tractability — but ALSO update the prose tree above + the corpus to bring them back in sync (the script is the SoT for routing; prose is for human review).
151
-
152
- ---
153
-
154
- ## The Five-Step Landing Procedure
155
-
156
- After the decision tree picks a target, follow these steps in order:
157
-
158
- ### Step 1 — Audit before patching
159
-
160
- Before writing anything:
161
-
162
- 1. **Read the target file in full.** Don't skim. The skill's reference files have established voice + section ordering; patches must match.
163
- 2. **`git status` + `git log -5`** on the working tree. Confirm no peer activity in `.agents/skills/` (peer agents may be authoring sibling skills like `adia-ui-release/`). If peer is dirty here, halt + coordinate.
164
- 3. **Grep for existing coverage.** Run `grep -rn "<keyword>" .agents/skills/adia-ui-kit/` to confirm the new knowledge isn't already partly covered. If it IS, the landing is a *patch + augment*, not a *new section* — different shape (Step 2 changes).
165
- 4. **Confirm the landing-target choice.** Re-read the Decision Tree above against your specific case. Two minutes of "is this really a recipe or is it actually a flow?" prevents two hours of misplaced content.
166
-
167
- ### Step 2 — Author the patch
168
-
169
- Two shapes depending on Step 1's grep:
170
-
171
- **Shape A — NEW section / file (no existing coverage)**
172
-
173
- If the target is a new reference file:
174
- - Create `references/<topic>.md` with the canonical header block (provenance, why-authored, used-by, companion, anti-companion, separator, "## When to Use" with trigger phrases, "## Core Principles", then content).
175
- - Reference the new file from the SKILL.md `### The reference manifest` table with a one-line "when to load" + "v<current-version>" tag.
176
-
177
- If the target is a new section inside SKILL.md:
178
- - Place it adjacent to its closest siblings (e.g. a new methodology section goes near §ReasoningMethodologies, a new posture goes near §Mission).
179
- - Use the H2 form `## §Name — Short description`. Add corresponding entry to the capability menu (§"What this skill can do") and the binding table.
180
-
181
- **Shape B — AUGMENT existing section (grep found partial coverage)**
182
-
183
- - Read the entire existing section first, including any cross-references to other files.
184
- - Author the augment as a sub-section (H3) or inline paragraph at the *semantically correct place*, not the end.
185
- - If the augment changes the meaning of nearby paragraphs, edit those too — don't leave stale claims standing.
186
-
187
- ### Step 3 — Wire the activation surface
188
-
189
- For ANY §Teach landing that should be discoverable:
190
-
191
- 1. **Add trigger keywords to `trigger:` in the frontmatter.** Pick 3-7 phrases an agent or user would naturally say. Be specific (not "design") but not over-specific (not the exact tag name unless that's the user vocabulary).
192
- 2. **Add a capability menu entry** in §"What this skill can do (capability surface)" — under the appropriate H3 grouping ("Author", "Consultant", "Correction", etc.).
193
- 3. **Add a binding-procedure line** in §"LLM procedure (binding — follow this on every request)" if the new section needs explicit step-listing. Most don't (default LLM behavior is "scan capability menu → match → jump"). Bind only when the section must run in a specific phase (e.g. before §0 reasoning gate).
194
-
195
- If the landing is a reference file, the SKILL.md edits are minimal — just the manifest table row + a capability menu entry if it warrants one.
196
-
197
- ### Step 4 — Version + CHANGELOG
198
-
199
- Cut the new content as a release:
200
-
201
- - **PATCH (vN.M.x+1)** — citation strengthening, typo fixes, augmenting an existing section with one paragraph.
202
- - **MINOR (vN.M+1.0)** — new reference file, new H2 section in SKILL.md, new capability-menu item with binding.
203
- - **MAJOR (vN+1.0.0)** — renames, removals, restructuring (don't bundle with adds).
204
-
205
- Update `skill.json` version + `CHANGELOG.md` entry. The entry must name:
206
- - What was added (one-line summary)
207
- - Where it lives (file path + section anchor)
208
- - What triggers it (1-3 phrases from the trigger keywords)
209
- - What it replaces / supersedes (if anything; usually nothing for adds)
210
-
211
- ### Step 5 — Verify with `audit:skill-hygiene`
212
-
213
- Run the hygiene audit:
214
-
215
- ```bash
216
- node scripts/skills/audit-skill-hygiene.mjs adia-ui-kit
217
- ```
218
-
219
- Check the eight axes. The §Teach landing should NOT regress:
220
- - **Axis 1 (token economy)** — if SKILL.md grew, did the reference-file extraction protect the cold-start? If not, you inlined too much.
221
- - **Axis 7 (capability menu drift)** — if you added a section, did you add the menu entry? Drift > 5 means lies in the menu.
222
- - **Axis 8 (cold-start path weight)** — if the new section is in the first 5 H2s, did you push the cold-start over the 30K threshold?
223
-
224
- If any axis regresses, **fix it in the same cut**, not the next one. Hygiene-debt compounds.
225
-
226
- ---
227
-
228
- ## Worked Examples
229
-
230
- ### Example A — New primitive's a2ui.rule (yaml SoT, NOT skill)
231
-
232
- **Request:** "make sure adia-ui-kit knows about the new `<calendar-picker-ui>` form-associated date input — it shouldn't be used for date ranges."
233
-
234
- **Decision tree:** Per-component contract (decision rule vs sibling primitive). → **YAML SoT, not skill.**
235
-
236
- **Action:**
237
- ```bash
238
- # Open the yaml
239
- $EDITOR packages/web-components/components/calendar-picker/calendar-picker.yaml
240
-
241
- # Add to a2ui.rules:
242
- # - rule: "Use for single-date input. For date ranges compose two pickers or use a dedicated range component."
243
- # reason: "Single-value scope."
244
-
245
- # Regenerate sidecars + catalog
246
- npm run build:components
247
-
248
- # Verify
249
- npm run check:yaml-rules-coverage # ≥1 rule per component
250
- npm run check:corpus-rules-format # no malformed bullets
251
- ```
252
-
253
- **No skill edits required.** The skill cites `<calendar-picker-ui>` by tag in its capability surface; the new rule flows into LLM context via the catalog automatically.
254
-
255
- **Pitfall to avoid:** "While I'm in the skill, let me also add a paragraph about calendar-picker in §Forms." NO. That paragraph would duplicate the yaml SoT and drift on the next yaml change. Skill cites the tag; doesn't describe its contract.
256
-
257
- ### Example B — New recipe (cross-component composition pattern)
258
-
259
- **Request:** "train adia-ui-kit on the editor inspector pane pattern — a right-pane inside `<editor-shell>` that hosts `<tabs-ui>` + `<inspector-ui>` for live A2UI doc state inspection."
260
-
261
- **Decision tree:** Recipe — cross-component composition pattern. → **`patterns-recipes.md`** (or `patterns-shells.md` if editor-cluster-specific).
262
-
263
- **Action:**
264
- 1. Open `patterns-recipes.md`.
265
- 2. Add a new H2 section "## Editor inspector pane" with: triggers, when to use, composition (HTML + A2UI JSON), token contract, anti-patterns.
266
- 3. Cross-link from SKILL.md §Patterns table (one row: pattern name, file, when-to-load).
267
- 4. Bump version PATCH (vN.M.x+1) since reference-file augment, not new section.
268
-
269
- **Real-session reference:** §404 (2026-05-22) — the editor inspector pane + editor sub-views recipes were added to `patterns-recipes.md` in adia-ui-kit v2.20.9 as part of the SoT-yaml sweep cleanup.
270
-
271
- ### Example C — New flow (end-to-end user journey)
272
-
273
- **Request:** "teach the skill about the new agent onboarding wizard flow — 3 pages (welcome → persona pick → tool consent) using `<simple-shell>` + `<stepper-ui>`."
274
-
275
- **Decision tree:** Flow — multi-page user journey. → **`flows-auth.md`** or new `flows-onboarding.md`.
276
-
277
- **Action:**
278
- 1. Decide: does this fit existing `flows-auth.md` (which covers registration wizards)? If yes, augment. If the onboarding wizard has distinct lifecycle hooks (telemetry, persona persistence) that don't fit auth, create `flows-onboarding.md`.
279
- 2. Author the flow as a Markdown article: brief, page-by-page composition, A2UI JSON wiring, telemetry hooks, anti-patterns.
280
- 3. Cross-link from SKILL.md §Flows table.
281
- 4. MINOR bump if new file (vN.M+1.0); PATCH if augmenting existing flows-auth.md.
282
-
283
- ### Example D — New methodology / posture (inline in SKILL.md)
284
-
285
- **Request:** "absorb the §405 lesson into adia-ui-kit — never audit YAML with regex, always use a real parser."
286
-
287
- **Decision tree:** Discipline / methodology shift. → **inline in SKILL.md**, near §ReasoningMethodologies.
288
-
289
- **Action:**
290
- 1. Open `.agents/skills/adia-ui-kit/SKILL.md`.
291
- 2. Add to §ReasoningMethodologies as a new numbered rung: "### 7. Parse, don't regex — YAML / JSON / code requires its own parser. Sniff tests on YAML source text via regex produce ghost counts (§404 lesson: 32 false-positive empty descriptions; real parser found 0)."
292
- 3. Cross-link from §CorrectionLoop (Phase 3 bug-shape taxonomy: "regex-based audit miscount").
293
- 4. MINOR bump for the rung add. Run `audit:skill-hygiene` — confirm cold-start budget held (axis 8).
294
-
295
- **Why inline, not reference file:** Methodology / posture sections shape every other section. They're the procedural spine; they're allowed to grow. Reference-extracting them would mean agents miss them on cold-start.
296
-
297
- ### Example E — New tooling script
298
-
299
- **Request:** "make sure the skill knows about the new `audit-yaml-rules-coverage` gate."
300
-
301
- **Decision tree:** Tooling addition. → **Cross-link from SKILL.md's harness manifest table** + brief mention in §SkillHygiene.
302
-
303
- **Action:**
304
- 1. Confirm the script exists (`scripts/audit/audit-yaml-rules-coverage.mjs` was added in §409).
305
- 2. Open SKILL.md, find the harness-manifest table in §SkillHygiene or §LoadingProtocol.
306
- 3. Add a row: script path + when-to-run + what-it-catches.
307
- 4. PATCH bump.
308
-
309
- **Pitfall to avoid:** Inlining the script's full documentation in SKILL.md. The script's own `--help` flag + the docstring at the top of the `.mjs` file are the SoT. The skill cites; it doesn't duplicate.
310
-
311
- ### Example F — Feedback resolution + skill correction
312
-
313
- **Request:** "FEEDBACK-37 was retracted (the slot-contract diagnostic for admin-topbar was misdiagnosed) — make sure the skill reflects this."
314
-
315
- **Decision tree:** Feedback resolution. → **TWO landings:**
316
-
317
- 1. **The substrate fix** (yaml change retiring the false slot-contract claim) — already shipped, not skill territory.
318
- 2. **The skill correction** — patch whatever section was citing the misdiagnosed pattern. This is §CorrectionLoop territory.
319
-
320
- **Action:**
321
- 1. `grep -rn "FEEDBACK-37" .agents/skills/adia-ui-kit/` — find every citation.
322
- 2. Read the original misdiagnosis (in the FEEDBACK-37 ticket file under `.agents/team/tickets/archive/`).
323
- 3. Patch the skill section that adopted the false pattern. Add a bug-shape entry to §CorrectionLoop's Phase 3 taxonomy ("light-DOM slot misdiagnosis — FB-37 lesson: slot= on AdiaUI primitives is DECORATIVE metadata, not projection directives").
324
- 4. Bump PATCH for the correction (it's a fix, not a new feature).
325
-
326
- **Real-session reference:** §399 (2026-05-21) — the FB-37 retraction lesson landed in adia-ui-kit v2.19.x as a bug-shape taxonomy entry. Future cold-starts of the skill warn agents not to repeat the misdiagnosis.
327
-
328
- ### Example G — One-off arc story (the NEGATIVE case)
329
-
330
- **Request:** "the skill should remember how we shipped Arc D today — the catalog-renderer bug, the dict-stringification, the 12-day silence."
331
-
332
- **Decision tree:** One-off arc story / historical context. → **`.claude/docs/journal/YYYY/MM/<date>.md`, NOT the skill.**
333
-
334
- **Action:**
335
- 1. The journal entry already exists (§408 in `.claude/docs/journal/2026/05/2026-05-22.md`).
336
- 2. **Do nothing in the skill.** The skill is procedural ("what to do"), not historical ("what happened"). Future archeology grep'ing for "catalog-renderer" or "[object Object]" finds the journal entry; that's where it belongs.
337
- 3. The structural lesson (axis 1 of the audit-corpus-rules-format gate) is already captured procedurally by Example E above.
338
-
339
- **Pitfall to avoid:** "But the skill should know about every important arc!" NO. The skill teaches the agent **what to do**; the journal records **what happened**. Conflating them bloats the skill and rots the journal.
340
-
341
- ---
342
-
343
- ## Anti-patterns (the §Teach landing failure modes)
344
-
345
- These are the shapes of bad §Teach landings observed during this skill's evolution. Each one was a real near-miss or fix.
346
-
347
- ### Anti-pattern 1 — "Append-only" landing
348
-
349
- Adding new content to the end of an existing section without integrating it. Symptom: section grows monotonically; new paragraphs don't connect to the surrounding voice; cross-references go stale.
350
-
351
- **Fix:** When augmenting a section, find the *semantically correct insertion point*, not the end. If the new content doesn't fit any insertion point, you may be in the wrong section.
352
-
353
- ### Anti-pattern 2 — Duplicating yaml SoT
354
-
355
- Adding a per-component contract (slot, prop, decision rule) to the skill instead of (or in addition to) the yaml. Symptom: the skill paragraph and the yaml `description` say the same thing in different words.
356
-
357
- **Fix:** When you catch yourself writing "the `<X-ui>` component does Y", check — is this really in the yaml already? If yes, delete what you were writing and cite the yaml. The skill cites tags; doesn't describe them.
358
-
359
- ### Anti-pattern 3 — Trigger keywords without binding
360
-
361
- Adding phrases to `trigger:` for a section that doesn't exist yet, or that exists but has no procedural binding. Symptom: agent activates the skill on the keyword, then has no procedure to follow.
362
-
363
- **Fix:** Pair the keyword add with the section authoring in the SAME cut. Never bump the version with orphan triggers.
364
-
365
- ### Anti-pattern 4 — Capability menu lies
366
-
367
- Adding a menu item that points to a section that doesn't exist, or to a stub. Symptom: agent reads the menu, picks the item, jumps to the section, finds nothing actionable, falls back to general knowledge.
368
-
369
- **Fix:** Capability-menu entries are the cold-start surface — they're load-bearing. Treat each new entry as a contract that the underlying section MUST deliver. If you're not ready to write the section, don't add the menu item yet.
370
-
371
- ### Anti-pattern 5 — Bundling MINOR + PATCH in one cut
372
-
373
- Shipping a new section (MINOR) alongside three citation-strengthening edits (PATCH) in a single `vN.M+1.0` cut. Symptom: the CHANGELOG entry is unclear; consumers can't tell what the new behavior is.
374
-
375
- **Fix:** Cut the MINOR first (with just the new section). Cut the PATCH after (with the polish). Each cut has a clean intent.
376
-
377
- ### Anti-pattern 6 — Hygiene-debt deferral
378
-
379
- Landing a new section, observing that `audit:skill-hygiene` shows a threshold regression, and deferring the fix to "next cut." Symptom: the next cut has a different focus; the hygiene-debt is forgotten; six cuts later the skill is 30% over the token-economy threshold.
380
-
381
- **Fix:** Fix axis regressions IN THE SAME CUT as the §Teach landing. Hygiene-debt compounds — it never gets easier to address later.
382
-
383
- ### Anti-pattern 7 — Treating §Teach as one-way
384
-
385
- Receiving a §Teach request and landing the content without asking "should this be in adia-ui-kit, or in adia-ui-migration / adia-ui-training / a new sibling skill?" Symptom: adia-ui-kit absorbs content that semantically belongs in a sibling skill, blowing past the cold-start budget while leaving the sibling thin.
386
-
387
- **Fix:** The §LoadingProtocol's peer-skill manifest table is the routing layer. Before landing in adia-ui-kit, ask: is there a sibling skill for this domain? If yes, route there. If no, defend the inclusion in the CHANGELOG entry.
388
-
389
- ---
390
-
391
- ## Cross-references
392
-
393
- - **§Mission** (SKILL.md) — defines the three postures (Author / Consultant / Correction). §Teach is a fourth posture, narrower than Author (which is forward-generation from scratch).
394
- - **§SkillHygiene** (SKILL.md) — the audit gate that catches §Teach landing regressions. Always run after.
395
- - **§LoadingProtocol** (SKILL.md) — defines the reference-file extraction discipline. §Teach respects it by routing content > ~50 LOC to `references/`.
396
- - **`feedback-authoring.md`** — companion when §Teach is triggered by a FEEDBACK resolution (Example F).
397
- - **AGENTS.md** (repo root) — defines the journal discipline that §Teach defers to for arc stories (Example G).
398
- - **`scripts/skills/audit-skill-hygiene.mjs`** — the eight-axis audit; run after any §Teach landing.
399
- - **`scripts/audit/audit-yaml-rules-coverage.mjs`** + siblings (§409) — the regression gates that catch yaml-SoT drift when §Teach lands in yaml instead of the skill (Example A).
400
-
401
- ---
402
-
403
- ## Worked Decision Examples — Quick-Reference Card
404
-
405
- When in doubt, the table below routes by request shape.
406
-
407
- | Request shape | Landing target | Version bump | Audit gate |
408
- |---|---|---|---|
409
- | "new primitive does X" | yaml SoT only (no skill change) | yaml change only | `check:yaml-rules-coverage` |
410
- | "new keyword for `<tag>`" | yaml SoT only | yaml change only | `check:yaml-rules-coverage` |
411
- | "new composition recipe" | `references/patterns-<domain>.md` | PATCH | `audit:skill-hygiene` |
412
- | "new end-to-end flow" | `references/flows-<domain>.md` | MINOR if new file else PATCH | `audit:skill-hygiene` |
413
- | "new methodology / posture" | inline in SKILL.md (near §Mission / §ReasoningMethodologies) | MINOR | `audit:skill-hygiene` |
414
- | "new audit / verification script" | cross-link from SKILL.md harness manifest | PATCH | `audit:skill-hygiene` |
415
- | "FEEDBACK-NN resolved + skill reflected" | patch the misdiagnosed section + bug-shape taxonomy entry | PATCH | manual review |
416
- | "arc story / lesson learned" | `.claude/docs/journal/YYYY/MM/<date>.md` (NOT skill) | n/a | journal-date sanity hook |
417
- | "absorb sibling-skill knowledge" | route to peer skill OR defend inclusion in CHANGELOG | varies | `audit:skill-hygiene` + peer review |
418
-
419
- ---
420
-
421
- **Version of this reference file:** v1.0 — initial authoring (2026-05-22, journal §409 follow-up). Future revisions: when new landing-target patterns emerge (e.g. a §Teach landing for the `adia-ui-training` sibling skill that doesn't fit any of the seven existing decision-tree branches), augment this file's decision tree + worked examples in the same arc as the landing.