@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,138 @@
1
+ # mol-design-motion -- a motion and reduced-motion pass, bonded onto the step whose
2
+ # review found the problem.
3
+ #
4
+ # Bond it onto that verify or critique step, so the first child is ready
5
+ # immediately:
6
+ # bd mol bond mol-design-motion <target-id> --var surface=<route> --var node=<node-id>
7
+ #
8
+ # 4 steps, no human gate. The `mol-` prefix marks a formula meant for `bd mol
9
+ # bond`; formulas resolve by filename stem.
10
+ #
11
+ # PRECONDITION: the skills named here ship in the design plugin (srobroek.design). The
12
+ # scoring step needs npx --yes and a Chromium install on first run.
13
+ #
14
+ # THE THRESHOLD IS FIXED AT 200ms, EVERY TRANSFORM, AND EVERY REPEAT. A
15
+ # prefers-reduced-motion branch is required for every transition over 200ms, for
16
+ # every transform animation regardless of duration, and for every repeating
17
+ # animation regardless of duration or property, because a short transform still
18
+ # moves content across the viewport and a short loop never stops. That is this
19
+ # package's motion policy; the matching WCAG criterion, 2.3.3 Animation from
20
+ # Interactions, is AAA. Duration alone is the wrong test, which is why all three
21
+ # conditions are named.
22
+ #
23
+ # Bond joins root-to-root as a sibling subtree and cannot rewire an inherited
24
+ # step's `needs`, so the bonding side owns the join edge and this file declares no
25
+ # `needs` pointing outside itself, which is also what lets it cook standalone.
26
+ formula = "mol-design-motion"
27
+ description = "Motion and reduced-motion pass on {{surface}} for node {{node}}: inventory every transition and animation, branch every one over 200ms, every transform, and every repeat, verify both media states, score deterministically"
28
+ type = "workflow"
29
+
30
+ [vars.surface]
31
+ required = true
32
+ description = "route or URL the agent drives in both motion preference states"
33
+
34
+ [vars.node]
35
+ required = true
36
+ description = "id of the design node bead whose review found the motion problem"
37
+
38
+ [[steps]]
39
+ id = "inventory-motion"
40
+ title = "INVENTORY every transition and animation on {{surface}}"
41
+ type = "task"
42
+ labels = ["design", "design:subprocess", "sub:motion"]
43
+ description = """
44
+ Enumerate every piece of motion on {{surface}}: CSS transitions, CSS animations,
45
+ scroll-driven and view-transition effects, and anything a JS animation library
46
+ drives. Use the ui-review skill's computed styles for the measurement, because a
47
+ screenshot cannot report a duration, and read the source for library-driven motion
48
+ that computed styles do not expose.
49
+
50
+ Record per entry: the selector, the animated property, the measured duration in ms,
51
+ the easing, the iteration count, and whether the animated property is a transform.
52
+ Then mark each entry REQUIRES BRANCH or EXEMPT against three conditions: duration
53
+ over 200ms; the property is a transform, at any duration; or the animation repeats,
54
+ meaning an iteration count above 1 or infinite, at any duration and on any
55
+ property. The conditions are independent, so a 120ms transform and a 100ms
56
+ infinite opacity pulse are both REQUIRES BRANCH. An auto-starting loop that runs
57
+ over five seconds beside other content is also a 2.2.2 Pause, Stop, Hide (Level A)
58
+ question: record it for the accessibility-audit skill.
59
+
60
+ Also record whether the duration is a raw ms literal or a motion token, because a
61
+ literal here is a token-system finding as well as a motion one.
62
+ """
63
+
64
+ [steps.metadata]
65
+ skill_hints = "ui-review, motion-design"
66
+
67
+ [[steps]]
68
+ id = "branch-reduced-motion"
69
+ title = "BRANCH every REQUIRES BRANCH entry on prefers-reduced-motion"
70
+ type = "task"
71
+ needs = ["inventory-motion"]
72
+ labels = ["design", "design:subprocess", "sub:motion"]
73
+ description = """
74
+ Run the motion-design skill. Add a prefers-reduced-motion branch for every entry
75
+ INVENTORY marked REQUIRES BRANCH, inside the scope node {{node}} declared. The
76
+ reduced branch removes the movement and keeps the meaning: cross-fade or
77
+ instant-change instead of translate, scale, or parallax, and keep any state change
78
+ the motion was communicating.
79
+
80
+ Never delete motion outright to satisfy the branch, and never reduce the default
81
+ path instead of branching it: both change the report without giving the
82
+ non-reduced user the designed experience. A repeating animation is REQUIRES BRANCH
83
+ by INVENTORY, so none stays unbranched. Every duration comes from a motion token,
84
+ not a ms literal; a literal INVENTORY found is migrated here or reported as a token
85
+ gap.
86
+
87
+ Record per entry: the file changed, the reduced behaviour, and the token the
88
+ duration now reads from.
89
+ """
90
+
91
+ [steps.metadata]
92
+ skill_hints = "motion-design"
93
+
94
+ [[steps]]
95
+ id = "verify-motion"
96
+ title = "VERIFY {{surface}} in both motion preference states"
97
+ type = "task"
98
+ needs = ["branch-reduced-motion"]
99
+ labels = ["design", "design:subprocess", "sub:motion"]
100
+ description = """
101
+ Run the ui-review skill against {{surface}} twice: once with prefers-reduced-motion
102
+ no-preference and once with reduce, emulated in Chromium, for example with
103
+ Playwright's page.emulateMedia({ reducedMotion: "reduce" }). Emulating the media feature is the whole test, so assert which state each
104
+ measurement was taken in; a single-state run cannot detect a missing branch.
105
+
106
+ Evidence order is fixed: ARIA snapshot first, computed styles second, screenshot
107
+ last. Per branched entry assert the reduced state removes the movement, and assert
108
+ the state change the motion communicated still happens. Per EXEMPT entry re-measure
109
+ it and confirm it is still at or under 200ms, still not a transform, and still not
110
+ repeating: an exemption is a measurement, not a label. Confirm no branch changed
111
+ the non-reduced path.
112
+ """
113
+
114
+ [steps.metadata]
115
+ skill_hints = "ui-review"
116
+
117
+ [[steps]]
118
+ id = "score-motion"
119
+ title = "SCORE the motion pass deterministically"
120
+ type = "task"
121
+ needs = ["verify-motion"]
122
+ labels = ["design", "design:subprocess", "sub:motion"]
123
+ description = """
124
+ Add a deterministic pass over the agent's own reading, because a judgement about
125
+ motion quality is exactly the kind of claim that needs an independent located
126
+ finding:
127
+ npx --yes playwright install chromium
128
+ npx --yes motionlint audit "{{surface}}" --json audit.json --ci
129
+ It needs the Chromium install on first run and a reachable URL, so where
130
+ {{surface}} is not reachable as a URL, record the step as not run rather than
131
+ reporting a score it did not produce.
132
+
133
+ Report the entry table with its final state: selector, property, duration,
134
+ transform yes or no, branched or EXEMPT with the reason, and the token the duration
135
+ reads from. Then report the motionlint findings against it, and reconcile any
136
+ disagreement rather than picking the friendlier number. Surviving failures bond
137
+ another mol-design-motion rather than reopening this one.
138
+ """
@@ -0,0 +1,135 @@
1
+ # mol-design-responsive -- a reflow and target-size pass, bonded onto the step whose
2
+ # verification found the problem.
3
+ #
4
+ # Bond it onto that verify or critique step, so the first child is ready
5
+ # immediately:
6
+ # bd mol bond mol-design-responsive <target-id> --var surface=<route> --var node=<node-id>
7
+ #
8
+ # 4 steps, no human gate. The `mol-` prefix marks a formula meant for `bd mol
9
+ # bond`; formulas resolve by filename stem.
10
+ #
11
+ # PRECONDITION: the skills named here ship in the design plugin (srobroek.design).
12
+ #
13
+ # THE FOURTH WIDTH IS NOT DECORATIVE. The design widths are 1440, 768, and 375, and
14
+ # a surface can pass all three and still fail WCAG 2.2 SC 1.4.10 Reflow, which is
15
+ # specified at 320 CSS px. 375 is a phone; 320 is the conformance requirement. Both
16
+ # are measured here.
17
+ #
18
+ # Bond joins root-to-root as a sibling subtree and cannot rewire an inherited
19
+ # step's `needs`, so the bonding side owns the join edge and this file declares no
20
+ # `needs` pointing outside itself, which is also what lets it cook standalone.
21
+ formula = "mol-design-responsive"
22
+ description = "Reflow and target-size pass on {{surface}} for node {{node}}: measure 1440, 768, 375 and 320 CSS px for SC 1.4.10, measure the 24 by 24 CSS px minimum for SC 2.5.8, fix, re-measure"
23
+ type = "workflow"
24
+
25
+ [vars.surface]
26
+ required = true
27
+ description = "route or URL the agent drives at each width"
28
+
29
+ [vars.node]
30
+ required = true
31
+ description = "id of the design node bead whose verification found the reflow or target-size problem"
32
+
33
+ [[steps]]
34
+ id = "measure-reflow"
35
+ title = "MEASURE reflow at 1440, 768, 375, and 320 CSS px"
36
+ type = "task"
37
+ labels = ["design", "design:subprocess", "sub:responsive"]
38
+ description = """
39
+ Run the ui-review skill against {{surface}} at four widths: the three design widths
40
+ 1440, 768, and 375, plus 320 CSS px, which is what WCAG 2.2 SC 1.4.10 Reflow is
41
+ specified at. Evidence order is fixed: ARIA snapshot first, computed styles
42
+ second, screenshot last.
43
+
44
+ At 320 CSS px assert the conformance requirement itself: content reflows into one
45
+ column with no loss of information or functionality, and no two-dimensional
46
+ scrolling. Two-dimensional scrolling means scrolling in the block direction AND
47
+ the inline direction to read one piece of content; the exception is content whose
48
+ usage genuinely requires it, such as a data table, a map, or a diagram, and that
49
+ exception is claimed per element with its reason rather than assumed.
50
+
51
+ Record per width and per failing element: the selector, the measured overflow or
52
+ clipped dimension in CSS px, and what became unreachable. Vertical scrolling alone
53
+ is not a failure. Check the usual causes: a fixed pixel width, a min-width, a
54
+ non-wrapping flex row, an unconstrained image, and a table that cannot collapse.
55
+ """
56
+
57
+ [steps.metadata]
58
+ skill_hints = "ui-review"
59
+
60
+ [[steps]]
61
+ id = "measure-target-size"
62
+ title = "MEASURE target size against the 24 by 24 CSS px minimum"
63
+ type = "task"
64
+ labels = ["design", "design:subprocess", "sub:responsive"]
65
+ description = """
66
+ Measure every pointer target on {{surface}} against WCAG 2.2 SC 2.5.8 Target Size
67
+ (Minimum): 24 by 24 CSS px, at every width from MEASURE reflow, since a target can
68
+ meet it at 1440 and shrink below it at 375. Use the ui-review skill's computed styles
69
+ for the measurement; a screenshot cannot give a CSS px box.
70
+
71
+ Record per target: the selector or accessible name, the measured width and height
72
+ of its effective hit area in CSS px, and the required 24. The hit area is the
73
+ region that receives the pointer event, not the visible icon: padding, a
74
+ pseudo-element, or an invisible extension of the control itself counts, and the
75
+ WCAG Understanding document for 2.5.8 endorses enlarging the active area without
76
+ enlarging the visible one. Measure it with the target probe in
77
+ the ui-review skill's references/probes.md. Then apply the exceptions deliberately
78
+ rather than by default, and claim each with its reason: spacing, where a 24 CSS px
79
+ diameter circle centred on each undersized target's bounding box intersects no
80
+ other target and no other undersized target's circle; inline targets inside a
81
+ sentence; a target whose size is set by the user agent and not modified; an
82
+ equivalent control elsewhere on the same page that does meet the minimum; and a
83
+ presentation that is essential or legally required. Also record targets that pass
84
+ 2.5.8 but sit under 44 by 44 CSS px, as a note rather than a failure: 2.5.5 Target
85
+ Size (Enhanced) is AAA and is not what this pass gates on.
86
+ """
87
+
88
+ [steps.metadata]
89
+ skill_hints = "ui-review"
90
+
91
+ [[steps]]
92
+ id = "fix-reflow-and-targets"
93
+ title = "FIX the reflow and target-size failures"
94
+ type = "task"
95
+ needs = ["measure-reflow", "measure-target-size"]
96
+ labels = ["design", "design:subprocess", "sub:responsive"]
97
+ description = """
98
+ Fix every failure both measurement steps recorded, inside the scope node {{node}}
99
+ declared. Fix at the level the cause lives: a fixed width in a primitive is fixed
100
+ in the primitive, not overridden per page, and a target that is too small because
101
+ of a spacing token is fixed in the token source and rebuilt.
102
+
103
+ Never fix reflow by hiding content at narrow widths, and never fix a target by
104
+ removing it: both satisfy the measurement while removing the functionality the
105
+ criterion exists to protect. An enlarged hit area is a valid fix when the
106
+ enlarged region belongs to the control and receives its pointer events. It
107
+ fails when it overlaps another target, because then it steals that target's
108
+ events. Record per fix: the criterion number, the file changed, and the value
109
+ the fix is expected to measure.
110
+ """
111
+
112
+ [[steps]]
113
+ id = "reverify-widths"
114
+ title = "RE-MEASURE only the elements that changed"
115
+ type = "task"
116
+ needs = ["fix-reflow-and-targets"]
117
+ labels = ["design", "design:subprocess", "sub:responsive"]
118
+ description = """
119
+ Run the ui-review skill against {{surface}} restricted to the elements FIX touched,
120
+ at 1440, 768, 375, and 320 CSS px. Never re-walk the whole surface: node {{node}}
121
+ already carries the evidence for everything untouched.
122
+
123
+ Re-measure in CSS px and record the new value against the required value per
124
+ element: 320 for reflow, 24 by 24 for target size. A fix asserted without a
125
+ measurement is not verified. Check what a fix can break: making a row wrap at 320
126
+ can push a target under 24 CSS px at 375, and growing a target can create the
127
+ overlap that voids another target's spacing exception, so re-measure both criteria
128
+ for every element either fix touched. Report elements now passing, elements still
129
+ failing with their measured values, and every exception claimed with its reason.
130
+ Surviving failures bond another mol-design-responsive rather than reopening this
131
+ one.
132
+ """
133
+
134
+ [steps.metadata]
135
+ skill_hints = "ui-review"
@@ -0,0 +1,165 @@
1
+ # mol-design-tokens -- establish or migrate a token system, bonded off an ABSENT or
2
+ # PARTIAL verdict from the design-system-audit skill.
3
+ #
4
+ # Bond it onto the step that returned that verdict, normally a GROUND or SYSTEM
5
+ # gate step, so the first child is ready immediately:
6
+ # bd mol bond mol-design-tokens <target-id> --var surface=<route> --var node=<node-id>
7
+ #
8
+ # 5 steps, 1 human gate. The `mol-` prefix marks a formula meant for `bd mol
9
+ # bond`; formulas resolve by filename stem.
10
+ #
11
+ # PRECONDITION: the skills named here ship in the design plugin (srobroek.design). The
12
+ # CLI steps need npx --yes and network access on first run.
13
+ #
14
+ # THE HUMAN GATE IS NOT OPTIONAL HERE. Introducing a scale sets the vocabulary
15
+ # every later component is forced to speak, and the agent cannot un-introduce one
16
+ # later without a migration. That makes it a system decision the agent must not
17
+ # take alone, which is why approve-scale sits between the inventory and the first
18
+ # authored token rather than after the build.
19
+ #
20
+ # WHEN TO POUR design-system INSTEAD: this molecule establishes tokens for work
21
+ # already under way. A project whose whole task is the system wants the
22
+ # design-system tier, which carries the theme and density matrix, the primitive
23
+ # inventory, and the documentation pass this molecule deliberately omits.
24
+ #
25
+ # Bond joins root-to-root as a sibling subtree and cannot rewire an inherited
26
+ # step's `needs`, so the bonding side owns the join edge and this file declares no
27
+ # `needs` pointing outside itself, which is also what lets it cook standalone.
28
+ formula = "mol-design-tokens"
29
+ description = "Establish or migrate the token system for node {{node}}: inventory the gap, get the scales approved, author in the project's carrier, gate and build with its builder, migrate the literals"
30
+ type = "workflow"
31
+
32
+ [vars.surface]
33
+ required = true
34
+ description = "route or URL used to confirm the migrated tokens resolve at runtime"
35
+
36
+ [vars.node]
37
+ required = true
38
+ description = "id of the design node bead whose audit returned ABSENT or PARTIAL"
39
+
40
+ [[steps]]
41
+ id = "inventory-token-gap"
42
+ title = "INVENTORY what exists and what is missing"
43
+ type = "task"
44
+ labels = ["design", "design:subprocess", "sub:tokens"]
45
+ description = """
46
+ Read the ABSENT or PARTIAL verdict on node {{node}} and turn it into a gap list.
47
+ Run the design-system-audit skill again if the verdict predates the current tree.
48
+ Record four lists: token carriers that already exist and are load-bearing;
49
+ carriers that exist but are bypassed by raw literals; axes with nothing at all
50
+ behind them; and the build that already turns the carriers into artifacts (Style
51
+ Dictionary, Terrazzo, a Tailwind config, a CSS custom-property file, or none),
52
+ with the command that runs it and the directory it runs from.
53
+
54
+ Scan for the literals that will need migrating: raw hex and other colour
55
+ literals, raw millisecond durations, and hardcoded spacing values, each with its
56
+ file and line. PARTIAL is the common case and it constrains everything downstream:
57
+ an existing scale is extended, never replaced, unless the user says otherwise at
58
+ the gate.
59
+ """
60
+
61
+ [steps.metadata]
62
+ skill_hints = "design-system-audit"
63
+
64
+ [[steps]]
65
+ id = "approve-scale"
66
+ title = "SYSTEM gate: approve the scales before any token is authored"
67
+ type = "task"
68
+ needs = ["inventory-token-gap"]
69
+ labels = ["design", "design:subprocess", "sub:tokens", "phase:gate"]
70
+ description = """
71
+ Present the gap list and ask the user to approve each axis this molecule would
72
+ introduce: the colour ramp shape, the type scale and its ratio, the spacing scale
73
+ and its base, the radius set, the elevation set, the motion durations, and whether
74
+ a fluid type scale is wanted at all. Number each question and give a recommended
75
+ answer with it, then wait.
76
+
77
+ State plainly which existing conventions would be extended and which would be
78
+ replaced, because replacement is the expensive answer and the user is the one who
79
+ gets to choose it. Introducing a scale is a system decision the agent must not
80
+ take alone: that is why this gate precedes authoring rather than following the
81
+ build.
82
+
83
+ Without explicit approval for new or replaced scales, record the unanswered
84
+ questions and leave this step unresolved, including unattended runs.
85
+ Only bd gate resolve closes the gate.
86
+ """
87
+
88
+ [steps.gate]
89
+ type = "human"
90
+ timeout = "72h"
91
+
92
+ [[steps]]
93
+ id = "author-token-tiers"
94
+ title = "AUTHOR the approved tokens in the project's carrier"
95
+ type = "task"
96
+ needs = ["inventory-token-gap", "approve-scale"]
97
+ labels = ["design", "design:subprocess", "sub:tokens"]
98
+ description = """
99
+ Author only the approved axes, in the carrier INVENTORY found and in its existing
100
+ tier layout. Extend that carrier; never replace it unless the gate approved the
101
+ replacement. Preserve the alias graph: semantic tokens reference raw tokens rather
102
+ than repeating their values.
103
+
104
+ Only when no carrier exists, or the gate approved replacing it, author layered
105
+ DTCG JSON under a tokens/ directory: foundation tier for raw values, semantic tier
106
+ for intent-named aliases, component tier for component-scoped tokens, plus a file
107
+ per theme and per density the project needs. Author colours in the intended colour
108
+ space and never pre-convert to sRGB, for example
109
+ {"$type":"color","$value":{"colorSpace":"oklch","components":[0.62,0.16,250],"alpha":1}}.
110
+ Pin the source format to DTCG Format Module 2025.10, which is a Final Community
111
+ Group Report and W3C Candidate Recommendation: it is stable enough to build on and
112
+ it is not a W3C Standard, so do not call it one.
113
+
114
+ Record on this bead the absolute path of the token source you wrote. inventory-token-gap
115
+ is named unconditionally alongside the gate so this step keeps its parent edge.
116
+ """
117
+
118
+ [[steps]]
119
+ id = "build-and-check-tokens"
120
+ title = "GATE the schema, build the artifacts, gate the contrast"
121
+ type = "task"
122
+ needs = ["author-token-tiers"]
123
+ labels = ["design", "design:subprocess", "sub:tokens"]
124
+ description = """
125
+ Three gates in this order, each on a separate thing.
126
+
127
+ 1. Schema, for DTCG JSON only. Set TOKENS_DIR to the path author-token-tiers
128
+ recorded, because a bare `find tokens` searches the session cwd:
129
+ find "${TOKENS_DIR:?}" -type f -name '*.json' -print0 | xargs -0 npx --yes --package=@design-token-kit/cli dtokens check --scope schema
130
+ It exits 2 on findings; fix the source, never the checker. Record N/A for a
131
+ carrier that is not DTCG.
132
+ 2. Build with the builder INVENTORY recorded, using its command from its
133
+ directory. Only for a new DTCG pipeline the gate approved, with no builder
134
+ present, run npx --yes --package=@terrazzo/cli tz build. Never add a second
135
+ builder beside an existing one: two engines means two artifact authorities.
136
+ 3. Contrast over every generated foreground and background pair in every theme:
137
+ 4.5:1 for body text, and 3:1 for UI boundaries and large text. Run the
138
+ project's contrast script when it has one. Otherwise measure the rendered pairs
139
+ with the contrast probe in the ui-review skill's references/probes.md, theme by
140
+ theme. Record each measured ratio against its required ratio.
141
+
142
+ Never hand-edit a generated artifact.
143
+ """
144
+
145
+ [[steps]]
146
+ id = "adopt-tokens"
147
+ title = "MIGRATE the literals in scope onto the tokens"
148
+ type = "task"
149
+ needs = ["build-and-check-tokens"]
150
+ labels = ["design", "design:subprocess", "sub:tokens"]
151
+ description = """
152
+ Replace the literals INVENTORY found with token references, inside the scope node
153
+ {{node}} declared and no wider. Rename with an LSP rename, never text substitution. A
154
+ literal with no token to migrate onto is reported, not invented: that is a new
155
+ axis and it needs the gate.
156
+
157
+ Confirm the result on the real surface, because generated CSS can be correct and
158
+ still not apply: run the ui-review skill against {{surface}} and assert with
159
+ computed styles that every var(--token) resolves and that the theme selector wins
160
+ the cascade. Report the migrated count, the surviving literal count with file and
161
+ line, and every unresolved custom property.
162
+ """
163
+
164
+ [steps.metadata]
165
+ skill_hints = "ui-review"
package/mcp-servers.ts ADDED
@@ -0,0 +1,49 @@
1
+ // Generated by harness-kit. Do not edit.
2
+ const servers = {
3
+ "accessibility-scanner": {
4
+ "command": "npx",
5
+ "args": [
6
+ "-y",
7
+ "accessibility-scanner-mcp@0.3.1"
8
+ ],
9
+ "cwd": "${HOME}",
10
+ "env": {
11
+ "npm_config_registry": "https://registry.npmjs.org/"
12
+ }
13
+ },
14
+ "wire-dsl": {
15
+ "command": "npx",
16
+ "args": [
17
+ "-y",
18
+ "@wire-dsl/mcp-server@0.1.3"
19
+ ],
20
+ "cwd": "${HOME}",
21
+ "env": {
22
+ "npm_config_registry": "https://registry.npmjs.org/"
23
+ }
24
+ }
25
+ } as const
26
+ const requiredEnvironment: Record<string, readonly string[]> = {}
27
+ const optionalHeaders = {} as const
28
+
29
+ const expand = (value: unknown): unknown => {
30
+ if (typeof value === "string") return value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (match, key: string) => process.env[key] ?? match)
31
+ if (Array.isArray(value)) return value.map(expand)
32
+ if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, nested]) => [key, expand(nested)]))
33
+ return value
34
+ }
35
+
36
+ export default function registerMcpServers(pi: { registerMcpServer(name: string, config: Record<string, unknown>): unknown }): void {
37
+ for (const [name, config] of Object.entries(servers)) {
38
+ const keys = requiredEnvironment[name as keyof typeof requiredEnvironment] ?? []
39
+ if (keys.some((key) => !process.env[key])) continue
40
+ const resolved = expand(config) as Record<string, unknown>
41
+ const headers = { ...(resolved.headers as Record<string, string> | undefined) }
42
+ for (const [header, variable] of Object.entries(optionalHeaders[name as keyof typeof optionalHeaders] ?? {})) {
43
+ const value = process.env[variable as string]
44
+ if (value) headers[header] = value
45
+ }
46
+ const registration = Object.keys(headers).length > 0 ? { ...resolved, headers } : resolved
47
+ pi.registerMcpServer(name, registration)
48
+ }
49
+ }
package/package.json CHANGED
@@ -1,8 +1,65 @@
1
1
  {
2
2
  "name": "@srobroek/pi-design",
3
- "version": "0.0.0",
4
- "description": "Placeholder that reserves the name for CI publishing. Install a later version.",
3
+ "version": "0.11.1",
4
+ "description": "UI and UX design skills: design-system audit, DESIGN.md, rendered-surface review, accessibility audit, motion, microcopy, prototypes, and wireframes.",
5
+ "keywords": [
6
+ "pi-package"
7
+ ],
5
8
  "license": "Apache-2.0",
6
- "repository": { "type": "git", "url": "git+https://github.com/srobroek/harness-plugins.git" },
7
- "files": ["README.md"]
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/srobroek/harness-plugins.git",
12
+ "directory": "plugins/design/pi"
13
+ },
14
+ "files": [
15
+ "CHANGELOG.md",
16
+ "LICENSE",
17
+ "README.md",
18
+ "_kit",
19
+ "agents",
20
+ "commands",
21
+ "extensions",
22
+ "formulas",
23
+ "mcp-servers.ts",
24
+ "skills"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public",
28
+ "provenance": true
29
+ },
30
+ "peerDependencies": {
31
+ "@srobroek/pi-debate": "*",
32
+ "pi-subagents": "*",
33
+ "pi-web-access": "*",
34
+ "typebox": "*"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "@srobroek/pi-debate": {
38
+ "optional": true
39
+ },
40
+ "pi-subagents": {
41
+ "optional": true
42
+ },
43
+ "pi-web-access": {
44
+ "optional": true
45
+ }
46
+ },
47
+ "pi": {
48
+ "extensions": [
49
+ "./extensions/design.js",
50
+ "./mcp-servers.ts",
51
+ "./_kit/prereqs.ts"
52
+ ],
53
+ "skills": [
54
+ "./skills"
55
+ ],
56
+ "prompts": [
57
+ "./commands"
58
+ ],
59
+ "subagents": {
60
+ "agents": [
61
+ "./agents"
62
+ ]
63
+ }
64
+ }
8
65
  }
@@ -0,0 +1,92 @@
1
+ ---
2
+ name: accessibility-audit
3
+ description: Audits a surface against WCAG 2.2 AA with measured values; triggers on is this accessible, check accessibility or WCAG.
4
+ metadata:
5
+ opencode/autoinvoke: false
6
+ ---
7
+
8
+ # Accessibility Audit
9
+
10
+ Phase CRITIQUE. Measure against WCAG 2.2 level AA and report values, not opinions.
11
+
12
+ TRIGGER
13
+ + "is this accessible", "check accessibility", "WCAG", "screen reader"
14
+ - general visual or UX quality -> `ui-review`
15
+ - error and empty-state wording -> `ui-microcopy`
16
+
17
+ ## Workflow
18
+
19
+ 1. Report MCP status before routing: say whether `accessibility-scanner` is connected and identify the server-reported axe-core engine and ruleset versions. Never infer those versions from this skill or its package declaration. -> the status and chosen route are named in the report header.
20
+ - PRIMARY measurement, any web surface when the server is configured: use the
21
+ `accessibility-scanner` MCP server at a pinned version as the design plugin README
22
+ shows. Call its `scan_accessibility` tool with `{"url": "..."}`. It scrolls before
23
+ scanning so lazy content is covered, resolves contrast over gradients, and returns a
24
+ selector, a criterion, and a fix link. It drives a locally installed Google Chrome,
25
+ or the browser `CHROME_PATH` names: with neither, the scan tests nothing, and that is
26
+ an environment blocker to report, never a pass. If the server does not report its
27
+ engine or ruleset, record them as unknown and do not claim WCAG 2.2 coverage.
28
+ - When the MCP server is absent or disabled, use the browser accessibility tree and
29
+ rendered surface to measure the criteria directly. State that the automated scanner
30
+ did not run; do not claim automated axe coverage. If no reachable rendered surface is
31
+ available, inspect the source and report every criterion as UNTESTED unless independently
32
+ exercised on a reachable surface. Source-only evidence cannot produce a PASS.
33
+ - web surface, for the criteria coverage and the audit's substance: upstream skill
34
+ `accessibility`.
35
+ - native surface: no upstream skill is routed. Measure through a desktop accessibility
36
+ inspector and the OS accessibility tree with the `ui-review` skill, and report platform
37
+ guidance as untested.
38
+ - FALLBACK, and only for a multi-URL CI gate:
39
+ `npx --yes --package=@axe-core/cli axe "<url>" --stdout --exit`. It accepts more than one
40
+ quoted URL, JSON node targets, `--include` and `--exclude`, and exits non-zero,
41
+ which the MCP scanner cannot do because it takes one page. Two caveats bind it:
42
+ it drives a real Chrome through ChromeDriver, so run
43
+ `npx --yes browser-driver-manager install chrome`, then `eval "$(npx --yes
44
+ browser-driver-manager which)"`, and pass `--chrome-path "$CHROME_TEST_PATH"` with
45
+ `--chromedriver-path "$CHROMEDRIVER_TEST_PATH"`. Installing alone is not enough: it
46
+ downloads the pair and puts neither on axe's path. Measured without them, it exits 2 on
47
+ "This version of
48
+ ChromeDriver only supports Chrome version 152. Current browser version is
49
+ 151.0.7922.174", having tested nothing at all.
50
+ And because that environment failure also exits non-zero, a non-zero exit does NOT by
51
+ itself mean an accessibility violation. Read the JSON and judge the findings; the exit
52
+ code alone distinguishes nothing.
53
+ Quote every substituted URL: a query string carries `&` and `?`, which an unquoted
54
+ argument hands to the shell. The bin is `axe`, not the package name, so pass `--package`.
55
+ 2. Apply the `design-upstream-preflight` skill for the routed skill BEFORE loading it: the
56
+ `accessibility` row on a web surface. -> installed, and loaded by name or, when
57
+ installed this session and not yet listed, from its install path. Install refused or failed: do NOT
58
+ improvise. A thin substitute audit is worse than none, because its
59
+ verdict reads exactly like the real one. Report the gap. The `accessibility-scanner` MCP
60
+ server above needs no skill install, only its config entry and Chrome, and when connected it is the primary
61
+ measurement route, so measurement continues without the upstream. The upstream's
62
+ criteria coverage does not: do not improvise it.
63
+ Bound that continuation: both no-install routes are WEB-ONLY and cover only a runnable
64
+ URL. Neither substitutes for source review, for a manual keyboard walkthrough, or for
65
+ native-platform guidance.
66
+ 3. Measure on the live surface with the `ui-review` skill: an ARIA snapshot for roles and
67
+ accessible names, page-side JavaScript for computed colors and target boxes, and `Tab`
68
+ key presses for focus order and traps. -> every finding carries a measured value and a required value.
69
+
70
+ Route provenance, licences, and the axe CLI caveats in full:
71
+ `references/upstream.md`.
72
+
73
+ ## Rules
74
+
75
+ MUST Report the measured value AND the required value on every finding.
76
+ MUST Give both color values and the computed ratio on a contrast finding. A contrast claim
77
+ missing any of the three is not reported at all.
78
+ MUST Trust the rendered accessible name over the name inferred from markup.
79
+ MUST Report a criterion you could not exercise as untested, naming the blocker.
80
+ MUST Read the axe CLI's JSON before calling a non-zero exit a violation. An environment
81
+ failure exits non-zero too: measured, a ChromeDriver and Chrome mismatch exits 2 having
82
+ tested nothing, which reads exactly like a failing gate.
83
+ DEFAULT Collapse one root cause across many elements into one finding with a count.
84
+ NOT Pass a surface on markup alone, or cite a criterion number you did not test.
85
+ NOT Use the axe CLI for interactive investigation, or the MCP scanner as an exit gate.
86
+
87
+ OUTPUT
88
+ L1 VERDICT: PASS | MINOR | MAJOR -- route used, one sentence why. MAJOR when any A or AA
89
+ criterion fails; MINOR when only AAA, policy, or best-practice findings remain.
90
+ Findings -- criterion number and level, location, measured value, required value, fix.
91
+ Untested -- criteria not exercised, with the blocker.
92
+ CAP 120w clean · 280w with findings