@srobroek/pi-design 0.0.0 → 0.11.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 (59) hide show
  1. package/CHANGELOG.md +174 -0
  2. package/LICENSE +202 -0
  3. package/README.md +438 -2
  4. package/_kit/prereqs.json +41 -0
  5. package/_kit/prereqs.ts +374 -0
  6. package/agents/a11y-auditor.md +107 -0
  7. package/agents/council-user.md +25 -0
  8. package/agents/council-ux.md +25 -0
  9. package/agents/design-critic.md +80 -0
  10. package/agents/ui-implementer.md +75 -0
  11. package/agents/ui-ux-specialist.md +133 -0
  12. package/commands/council-product.md +26 -0
  13. package/commands/design-review.md +17 -0
  14. package/extensions/design.js +438 -0
  15. package/formulas/design-surface.formula.toml +344 -0
  16. package/formulas/design-system.formula.toml +509 -0
  17. package/formulas/design-touch.formula.toml +188 -0
  18. package/formulas/mol-design-a11y.formula.toml +128 -0
  19. package/formulas/mol-design-component.formula.toml +122 -0
  20. package/formulas/mol-design-iterate.formula.toml +187 -0
  21. package/formulas/mol-design-motion.formula.toml +138 -0
  22. package/formulas/mol-design-responsive.formula.toml +135 -0
  23. package/formulas/mol-design-tokens.formula.toml +165 -0
  24. package/mcp-servers.ts +49 -0
  25. package/package.json +61 -4
  26. package/skills/accessibility-audit/SKILL.md +92 -0
  27. package/skills/accessibility-audit/references/upstream.md +78 -0
  28. package/skills/design-component-truth/SKILL.md +41 -0
  29. package/skills/design-evidence/SKILL.md +21 -0
  30. package/skills/design-guide/SKILL.md +26 -0
  31. package/skills/design-md/LICENSE +21 -0
  32. package/skills/design-md/NOTICE +31 -0
  33. package/skills/design-md/SKILL.md +79 -0
  34. package/skills/design-md/references/create-design-md.md +254 -0
  35. package/skills/design-md/references/upstream.md +60 -0
  36. package/skills/design-no-slop/SKILL.md +32 -0
  37. package/skills/design-prototype/SKILL.md +84 -0
  38. package/skills/design-prototype/references/in-app-variants.md +47 -0
  39. package/skills/design-prototype/references/upstream.md +43 -0
  40. package/skills/design-system-audit/SKILL.md +62 -0
  41. package/skills/design-system-audit/references/token-carriers.md +106 -0
  42. package/skills/design-system-audit/references/token-pipeline.md +115 -0
  43. package/skills/design-system-audit/references/upstream.md +52 -0
  44. package/skills/design-token-discipline/SKILL.md +24 -0
  45. package/skills/design-upstream-preflight/SKILL.md +60 -0
  46. package/skills/motion-design/SKILL.md +60 -0
  47. package/skills/ui-microcopy/LICENSE +212 -0
  48. package/skills/ui-microcopy/NOTICE +28 -0
  49. package/skills/ui-microcopy/SKILL.md +50 -0
  50. package/skills/ui-microcopy/references/copy-guidance.md +86 -0
  51. package/skills/ui-microcopy/references/upstream.md +11 -0
  52. package/skills/ui-review/SKILL.md +92 -0
  53. package/skills/ui-review/references/probes.md +446 -0
  54. package/skills/ui-review/references/storybook.md +217 -0
  55. package/skills/ui-review/references/tools.md +269 -0
  56. package/skills/ui-review/references/viewport-checks.md +184 -0
  57. package/skills/wireloom/LICENSE +21 -0
  58. package/skills/wireloom/NOTICE +30 -0
  59. package/skills/wireloom/SKILL.md +95 -0
@@ -0,0 +1,344 @@
1
+ # design-surface -- the middle design tier: a whole surface, built bottom-up under
2
+ # Component Driven staging.
3
+ #
4
+ # Install: run the design_setup tool, which copies every design formula into
5
+ # <repo>/.beads/formulas/, or copy this file there (or into ~/.beads/formulas/).
6
+ # Pour one molecule per surface:
7
+ # bd mol pour design-surface --var surface=<route> --var scope=<paths>
8
+ #
9
+ # 15 steps, 3 human gates. No `mol-` prefix: by convention `mol-` marks a
10
+ # formula meant for `bd mol bond`, and this tier is poured, not bonded.
11
+ #
12
+ # PRECONDITION: the skills and agents named here ship in the design plugin
13
+ # (srobroek.design). Install it first, or every step names a capability that does not exist.
14
+ #
15
+ # This tier carries the retired mol-design-node forward and adds what that file
16
+ # lacked: the three interrogation gates, Component Driven staging, and an optional
17
+ # fix round. The six phases are unchanged -- GROUND, SPECIFY, BUILD, VERIFY,
18
+ # CRITIQUE, RECONCILE -- and BUILD is now four staged steps rather than one.
19
+ #
20
+ # BUILD IS BOTTOM-UP, PER https://www.componentdriven.org/ : one component at a
21
+ # time in isolation with its states, then composition, then pages with mock data
22
+ # for hard-to-reach states, then integration with real data. Page-first
23
+ # development is the named anti-pattern. Verification follows the same order,
24
+ # because a component-level failure is smaller to locate than a page-level one.
25
+ #
26
+ # Runtime decisions remain in the DAG; only requested documentation is selected at pour.
27
+ formula = "design-surface"
28
+ description = "Six-phase design surface {{surface}} inside {{scope}}: ground and grill, specify, build bottom-up, verify, parallel critique and a11y, reconcile, human approval"
29
+ type = "workflow"
30
+
31
+ [vars.surface]
32
+ required = true
33
+ description = "route or URL the agent drives during VERIFY"
34
+
35
+ [vars.scope]
36
+ required = true
37
+ description = "paths the work may touch"
38
+
39
+ [vars.platform]
40
+ default = "web"
41
+ description = "web uses the browser tools; any other value uses a desktop accessibility inspector for native desktop"
42
+
43
+ [vars.want_design_md]
44
+ default = "false"
45
+ description = "true when this surface must write or update repo-root DESIGN.md"
46
+
47
+
48
+ [[steps]]
49
+ id = "ground-system"
50
+ title = "GROUND existing tokens, primitives, and the stack"
51
+ type = "task"
52
+ priority = 1
53
+ labels = ["design", "phase:ground"]
54
+ description = """
55
+ Run the design-system-audit skill on {{scope}}. Read the token files, the scales,
56
+ the primitives, and 5-10 existing components. Record the discovered registry on
57
+ this bead so later steps cite it instead of guessing. Verdict PRESENT, PARTIAL,
58
+ or ABSENT. The system decision step evaluates that verdict before any new token
59
+ is authored. Never invent a token a search could find.
60
+
61
+ Detect the stack from evidence, never from a default: package.json dependencies,
62
+ pubspec.yaml, a *.xcodeproj or Package.swift, composer.json, or app.json plus a
63
+ react-native dependency. Record which marker was found. When nothing is
64
+ detectable, ask at the INTENT gate rather than assuming: a hardcoded default
65
+ silently misroutes every later recommendation. Platform is {{platform}}.
66
+
67
+ Apply the design-upstream-preflight skill here, at GROUND, for every row an ENABLED
68
+ step of this molecule reaches, and record on this bead each install, its path,
69
+ every prerequisite still missing, and every MCP server that did not connect. A
70
+ row that failed to install STOPS the step that needs it, so an unrecorded gap
71
+ strands this molecule there.
72
+ """
73
+
74
+ [steps.metadata]
75
+ skill_hints = "design-system-audit"
76
+
77
+ [[steps]]
78
+ id = "grill-intent"
79
+ title = "INTENT gate: grill the user about {{surface}}"
80
+ type = "task"
81
+ needs = ["ground-system"]
82
+ labels = ["design", "phase:gate"]
83
+ description = """
84
+ Interrogate the user before specifying anything. Number each question, give a
85
+ recommended answer with it, ask the whole current frontier as one batch, then
86
+ wait. A question that depends on another still-open question belongs to a later
87
+ round.
88
+
89
+ Establish, and record every answer on this bead: product type (SaaS,
90
+ e-commerce, portfolio, dashboard, tool, productivity, or hybrid); target audience
91
+ and usage context; style keywords; the stack GROUND detected, confirmed rather
92
+ than assumed; the scope edges inside {{scope}}; the observable state that counts
93
+ as done; and three 1-10 dials -- variance (centred and minimal through bold and
94
+ asymmetric), motion (subtle micro-interactions through complex choreography), and
95
+ density (spacious through dense dashboard).
96
+
97
+ Never ask what a tool could answer or what the request already specifies.
98
+ Unresolved intent stays blocked without explicit approval, including unattended runs.
99
+ Only bd gate resolve closes the gate.
100
+ """
101
+
102
+ [steps.gate]
103
+ type = "human"
104
+ timeout = "72h"
105
+
106
+ [[steps]]
107
+ id = "grill-system"
108
+ title = "SYSTEM gate: approve establishing a scale or token"
109
+ type = "task"
110
+ needs = ["ground-system"]
111
+ labels = ["design", "phase:gate"]
112
+ description = """
113
+ Read GROUND's verdict. PRESENT with no new scale or token: record N/A with the
114
+ registry evidence and resolve this gate without inventing a decision.
115
+ ABSENT, PARTIAL, or a proposed new scale/token: obtain explicit user approval
116
+ and record the convention to follow before authoring it.
117
+
118
+ Approved and small: continue here. Approved and large: bond mol-design-tokens
119
+ onto this step, or obtain approval to switch to design-system. Without approval,
120
+ leave this step unresolved, including unattended runs. Existing approval covering
121
+ the exact change is sufficient; recommended answers are not consent.
122
+ Only bd gate resolve closes the gate.
123
+ """
124
+
125
+ [steps.gate]
126
+ type = "human"
127
+ timeout = "72h"
128
+
129
+ [[steps]]
130
+ id = "write-design-md"
131
+ title = "write or update DESIGN.md"
132
+ type = "task"
133
+ needs = ["ground-system"]
134
+ condition = "{{want_design_md}}"
135
+ labels = ["design", "phase:specify"]
136
+ description = """
137
+ Run the design-md skill. Write repo-root DESIGN.md from the GROUND registry:
138
+ frontmatter tokens (colors, typography, spacing, radii, elevation, optional
139
+ motion) then Scope and Intent through Known Gaps. Every {group.token} must
140
+ resolve. Unknowns go under Known Gaps. TODO or TO_FILL is invalid. Gate the
141
+ result with: npx --yes @google/design.md lint "$(git rev-parse --show-toplevel)/DESIGN.md"
142
+ """
143
+
144
+ [steps.metadata]
145
+ skill_hints = "design-md"
146
+
147
+ [[steps]]
148
+ id = "specify-intent"
149
+ title = "SPECIFY intent and constraints for {{surface}}"
150
+ type = "task"
151
+ needs = ["ground-system", "grill-intent", "grill-system", "write-design-md"]
152
+ labels = ["design", "phase:specify"]
153
+ description = """
154
+ State intent and constraints for {{surface}} inside {{scope}}, from the INTENT
155
+ answers rather than from taste. Name the component inventory this surface needs
156
+ and which of those already exist. If DESIGN.md exists, cite its tokens;
157
+ otherwise cite the GROUND registry. Do not invent tokens.
158
+
159
+ The system decision always precedes this step; write-design-md is optional.
160
+ """
161
+
162
+ [[steps]]
163
+ id = "build-components"
164
+ title = "BUILD stage 1: one component at a time, in isolation"
165
+ type = "task"
166
+ needs = ["specify-intent"]
167
+ labels = ["design", "phase:build"]
168
+ description = """
169
+ Component Driven stage one. Build each component from the SPECIFY inventory on
170
+ its own, in isolation, starting small. Enumerate default, hover, focus-visible,
171
+ active, disabled, loading, empty, error, selected. Implement and verify every
172
+ applicable state; record N/A with a component-specific reason for the others.
173
+
174
+ Every colour comes from a token and every spacing value from the scale. Verify
175
+ each component property against manifests/components.json or the component
176
+ source before using it, including plausible-sounding ones such as shadow or
177
+ size; a story name does not reflect a property name. Rename with an LSP rename, never
178
+ text substitution. Use the ui-microcopy skill for copy and the motion-design skill for
179
+ motion. Bond mol-design-component onto this step for any primitive that needs its
180
+ own bead.
181
+ """
182
+
183
+ [[steps]]
184
+ id = "build-composition"
185
+ title = "BUILD stage 2: compose the components"
186
+ type = "task"
187
+ needs = ["build-components"]
188
+ labels = ["design", "phase:build"]
189
+ description = """
190
+ Component Driven stage two. Compose the stage-one components into larger
191
+ components, increasing complexity gradually. Compose only what stage one already
192
+ covers; a composition built on an unfinished primitive relocates the failure
193
+ upward, which is the cost this staging exists to avoid. Reuse before adding: a
194
+ second variant of an existing composition beats a new one.
195
+ """
196
+
197
+ [[steps]]
198
+ id = "build-pages"
199
+ title = "BUILD stage 3: assemble pages with mock data"
200
+ type = "task"
201
+ needs = ["build-composition"]
202
+ labels = ["design", "phase:build"]
203
+ description = """
204
+ Component Driven stage three. Assemble {{surface}} from the composite
205
+ components, using mock data to simulate the hard-to-reach states and the edge
206
+ cases: empty collections, long strings, missing images, permission-denied,
207
+ partial failure, and the loading and error states real data will not reproduce
208
+ on demand. Mock data is what makes those states reachable at all, so do not
209
+ defer them to integration.
210
+ """
211
+
212
+ [[steps]]
213
+ id = "integrate-data"
214
+ title = "BUILD stage 4: integrate real data and logic"
215
+ type = "task"
216
+ needs = ["build-pages"]
217
+ labels = ["design", "phase:build"]
218
+ description = """
219
+ Component Driven stage four. Connect data and business logic so {{surface}}
220
+ meets the real backend. Every state the mock data reached must still be
221
+ reachable with real data, or the state has been lost rather than integrated.
222
+ Record which states are now driven by real responses and which remain
223
+ mock-only.
224
+ """
225
+
226
+ [[steps]]
227
+ id = "verify-surface"
228
+ title = "VERIFY {{surface}}, component level before page level"
229
+ type = "task"
230
+ needs = ["integrate-data"]
231
+ labels = ["design", "phase:verify"]
232
+ description = """
233
+ Run the ui-review skill against {{surface}}. Drive the real surface: the browser
234
+ tools when {{platform}} is web, a desktop accessibility inspector otherwise. Evidence order is fixed: ARIA snapshot
235
+ first, computed styles second, screenshot last. Widths 1440, 768, 375.
236
+
237
+ Verify at component level BEFORE page level, because a component-level failure
238
+ is smaller and more precise to locate than a page-level one. Walk the stage-one
239
+ components in isolation first, then the compositions, then {{surface}} itself.
240
+ Every claim carries a named citation; an unwitnessed state is not verified.
241
+
242
+ Then run the design_impeccable_scan tool on "{{surface}}" (it asks before it runs
243
+ npx --yes impeccable detect --json) and record its JSON on this bead. CRITIQUE
244
+ needs it, and design-critic has no shell to run it.
245
+ """
246
+
247
+ [steps.metadata]
248
+ skill_hints = "ui-review"
249
+
250
+ [[steps]]
251
+ id = "critique-visual"
252
+ title = "CRITIQUE visual and UX"
253
+ type = "task"
254
+ needs = ["verify-surface"]
255
+ labels = ["design", "phase:critique"]
256
+ description = """
257
+ Spawn design-critic (read-only) in the SAME parallel batch as
258
+ audit-accessibility, never after it. Run the ui-review skill as critique on
259
+ {{surface}}. Brief it with the impeccable detect JSON that verify-surface
260
+ recorded, as a COARSE corroborating signal only: its findings carry "line": 0, so
261
+ they are not located evidence and never substitute for driving the surface. The
262
+ critic corroborates each entry by driving {{surface}} and cites that location.
263
+ Verdict PASS, MINOR, or MAJOR with named evidence. Do not edit files, and do not
264
+ question the user: the lead owns the conversation. A self-review by whoever wrote
265
+ the UI shares its blind spots, which is why this is a child rather than a
266
+ self-check.
267
+ """
268
+
269
+ [steps.metadata]
270
+ skill_hints = "ui-review"
271
+ execution_agent_type = "design-critic"
272
+ execution_mode = "subagent"
273
+
274
+ [[steps]]
275
+ id = "audit-accessibility"
276
+ title = "AUDIT WCAG 2.2 AA"
277
+ type = "task"
278
+ needs = ["verify-surface"]
279
+ labels = ["design", "phase:critique"]
280
+ description = """
281
+ Spawn a11y-auditor (read-only) in the SAME parallel batch as critique-visual,
282
+ never after it. Run the accessibility-audit skill on {{surface}}. Verdict PASS,
283
+ MINOR, or MAJOR, where MAJOR means an A or AA criterion fails, and every finding
284
+ carries its WCAG 2.2 criterion number, the measured value, the required value,
285
+ and the selector. Do not edit files, and do not question the user. A MAJOR
286
+ verdict bonds mol-design-a11y onto this step.
287
+ """
288
+
289
+ [steps.metadata]
290
+ skill_hints = "accessibility-audit"
291
+ execution_agent_type = "a11y-auditor"
292
+ execution_mode = "subagent"
293
+
294
+ [[steps]]
295
+ id = "reconcile-findings"
296
+ title = "RECONCILE critique and a11y findings"
297
+ type = "task"
298
+ needs = ["critique-visual", "audit-accessibility"]
299
+ labels = ["design", "phase:reconcile"]
300
+ description = """
301
+ Reconcile both verdicts yourself. Fix every MAJOR finding and every agreed MINOR
302
+ inside {{scope}}. Re-verify only the changed assertion, never the whole walk, and
303
+ leave a citation per re-run. Do not accept a child verdict you cannot reproduce:
304
+ report it as unreproduced rather than dropping it silently. Record findings on
305
+ this step and resolve them before continuing.
306
+ """
307
+
308
+ [[steps]]
309
+ id = "fix-round"
310
+ title = "one more fix pass on {{surface}}"
311
+ type = "task"
312
+ needs = ["reconcile-findings"]
313
+ labels = ["design", "phase:reconcile"]
314
+ description = """
315
+ Read the reconciled findings at runtime. None remain: record N/A with the
316
+ reconciled evidence and close this step. Otherwise perform the pass below.
317
+ A deliberate second pass over what RECONCILE left, when that is cheaper than
318
+ another molecule. Fix inside {{scope}} only, re-verify only the changed
319
+ assertion, and record what changed since the previous round along with the round
320
+ number. Anything still unresolved after this pass is an intent problem, not a
321
+ fix problem: bond mol-design-iterate rather than adding a third pass here.
322
+ """
323
+
324
+ [[steps]]
325
+ id = "visual-approval"
326
+ title = "ACCEPT gate: human visual approval for {{surface}}"
327
+ type = "task"
328
+ needs = ["reconcile-findings", "fix-round"]
329
+ labels = ["design", "phase:gate"]
330
+ description = """
331
+ Present the VERIFY evidence and both child verdicts for {{surface}}, then grill
332
+ the user: is the reconciled result accepted, or is another iteration wanted.
333
+ Number each question and give a recommended answer with it. Report the iteration
334
+ number and what changed since the previous round.
335
+
336
+ If no human is available, record the evidence and unanswered approval request,
337
+ then leave this step unresolved. Do not treat recommendations as acceptance.
338
+ Only bd gate resolve closes the gate. Another round bonds mol-design-iterate
339
+ onto this step.
340
+ """
341
+
342
+ [steps.gate]
343
+ type = "human"
344
+ timeout = "72h"