@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,84 @@
1
+ ---
2
+ name: design-prototype
3
+ description: Routes a wireframe, mockup, prototype or deck request to the right producer; triggers on wireframe this or prototype.
4
+ metadata:
5
+ opencode/autoinvoke: false
6
+ ---
7
+
8
+ # Design Prototype
9
+
10
+ Phase SPECIFY. Produce a throwaway artifact that answers a layout or flow question
11
+ before anything real is built.
12
+
13
+ TRIGGER
14
+ + "wireframe this", "make a prototype", "show me a mockup"
15
+ + "what should this look like" asked before any implementation exists
16
+ - implementing a real surface against the system -> `ui-ux-specialist`
17
+ - verifying a surface that already renders -> `ui-review`
18
+ - whether a state model or logic holds up -> `prototype-logic` (quality plugin)
19
+ - recording the durable visual system -> `design-md`
20
+
21
+ ## Workflow
22
+ 1. Pick the route from the fidelity table below, then resolve it by KIND, because the rows
23
+ are not all skills.
24
+ - An UPSTREAM SKILL row: apply the `design-upstream-preflight` skill for that row BEFORE
25
+ loading it. -> installed, and loaded by name or, when installed this session and not
26
+ yet listed, from its install path. Install refused or failed: STOP and report the gap. Do NOT
27
+ take a different row instead: each row answers a different question, and a
28
+ substituted fidelity reads like the real one.
29
+ - An MCP SERVER row: check whether the tool is in your available tools. If the tool is absent, report the missing server and its config entry (see the design plugin README) or the harness MCP reconnect command (in OpenCode, `/mcps`); do not claim to have produced that route's artifact. Choose another route only if its fidelity matches the request, and report that choice.
30
+ - A HARNESS TOOL row, such as image generation: check the tool is present, and STOP and
31
+ say so if it is not, rather than substituting a different fidelity.
32
+ -> the chosen route and its kind are both named before any file is written.
33
+ 2. Produce exactly one artifact on that route. -> the artifact opens or renders, and its
34
+ path is reported.
35
+ 3. SERVE it whenever it is interactive, rather than handing over a file path. A clickable
36
+ prototype judged by reading its source is not judged at all.
37
+ -> a background shell process running `python3 -m http.server "<port>" --bind 127.0.0.1`
38
+ with its working directory set to the artifact's directory; wait until the port answers.
39
+ -> SELF-CHECK before reporting, because this is the step that silently does not happen:
40
+ fetch your own URL and report the status, `curl -sS -o /dev/null -w '%{http_code}'
41
+ "http://127.0.0.1:<port>/<file>"`. A 200 is the only proof it ran. With no status line,
42
+ report NOT SERVED plus the blocker, the absolute file path, and the one-line command a
43
+ human runs from that directory. Never report a URL you did not fetch.
44
+ -> Then drive it yourself with the `ui-review` skill at 1440, 768, and 375 before claiming
45
+ the flow works. An SVG or a single HTML file serves the same way.
46
+ -> Stop the background server before reporting, or explicitly hand it off to a human with
47
+ its process id and stop command. Never leave a hub process running after this task.
48
+ 4. State what the artifact does not answer. -> a named gap list, because a low-fidelity
49
+ artifact settles layout and flow, never final visual detail.
50
+
51
+ | need | route |
52
+ |---|---|
53
+ | low-fidelity layout, one self-contained file | upstream `html-wireframe` |
54
+ | wireframe inside a Markdown doc, git-diffable | the `wireloom` skill, vendored here, always available |
55
+ | clickable multi-screen flow with keyboard support | upstream `html-prototype` |
56
+ | vector wireframe as SVG, PNG, or PDF | the `wire-dsl` MCP server, configured as the design plugin's README shows |
57
+ | raster visual concept | the harness's image-generation tool, when it has one; pass reference images as its input |
58
+ | fixed 16:9 deck or PDF | upstream `frontend-slides` |
59
+ | favicon, app icon, or social image files | upstream `web-asset-generator` |
60
+ | hosted concept exploration | upstream `superdesign`, after the user confirms the account |
61
+ | rendered surface against a reference mockup | a screenshot, then a vision comparison of the two images against an explicit question; a screenshot diff against the baseline, with its threshold, for a measured pixel diff |
62
+ | structurally different variants of an existing page, inside the real app | in-app `?variant=` switcher behind a dev-only flag: `references/in-app-variants.md` |
63
+
64
+ Producer install identities: `references/upstream.md`
65
+
66
+ ## Rules
67
+
68
+ MUST Prefer the local account-free route before any hosted service.
69
+ MUST State which route produced an artifact. A reader cannot judge fidelity without it.
70
+ MUST Report a vision comparison of images as a judgement; a measured claim needs a screenshot diff against a baseline, with its threshold.
71
+ MUST Report the measured HTTP status beside any URL you hand over. A URL with no status
72
+ behind it is exactly the failure the self-check exists to catch.
73
+ DEFAULT One artifact per question. A second fidelity level is a second request.
74
+ NOT Present a generated image as an implementation plan.
75
+ NOT Take a hosted route before the user confirms the account it needs.
76
+
77
+ ## Output
78
+
79
+ L1 ARTIFACT: path, plus the route that produced it.
80
+ Served -- the URL and the HTTP status you measured, or NOT SERVED plus the blocker,
81
+ the absolute path, and the command to serve it.
82
+ Answers -- the layout or flow question it settles.
83
+ Open -- what it does not answer.
84
+ CAP 100w
@@ -0,0 +1,47 @@
1
+ # In-app variants
2
+
3
+ Read when the route is "structurally different variants of an existing page, inside the
4
+ real app". The variants live in application code, so this route runs in the worktree and
5
+ delivery workflow of the change that asked for it.
6
+
7
+ ## Build
8
+
9
+ 1. State the question and pick N: default 3, at most 5. Write the plan in one line at the
10
+ top of the switcher file, for example "three variants of the settings page, switchable
11
+ via `?variant=`, on the existing `/settings` route".
12
+ 2. Host the variants on the existing route, selected by the `?variant=` search param. Data
13
+ fetching, params, and auth stay above the switch; only the rendered subtree changes.
14
+ Use a throwaway route under the project's routing convention only when nothing could
15
+ host the variants, and name it with the word `prototype`.
16
+ 3. Make the variants structurally different: layout, information hierarchy, and primary
17
+ affordance, not colour or copy. Use the project's component library. Read-only data;
18
+ point any mutation at a stub.
19
+ 4. Add one floating switcher: previous and next arrows plus the variant label, updating the
20
+ URL param through the framework's router; the arrow keys cycle variants except while an
21
+ input, textarea, or contenteditable element has focus.
22
+
23
+ ## Gate the whole prototype
24
+
25
+ Put the variant components, the `?variant=` branch, and the switcher behind one dev-only
26
+ flag, for example an explicit `PROTOTYPE_VARIANTS` flag that is also false whenever
27
+ `NODE_ENV` is `production`. With the flag off, the route renders exactly what it renders
28
+ without the prototype, whatever `?variant=` says. Hiding only the switcher is not a gate:
29
+ a crafted `?variant=` URL would still render an experiment.
30
+
31
+ ## HTTP render check
32
+
33
+ Run the dev server as one background shell process on a known port, and reuse it. Fetch every variant URL and the flag-off case before
34
+ reporting:
35
+
36
+ ```
37
+ curl -sS -o /dev/null -w '%{http_code}\n' "http://127.0.0.1:<port>/settings?variant=B"
38
+ ```
39
+
40
+ Report each status beside its URL; a URL without a measured 200 is NOT SERVED. Then drive
41
+ each variant with the `ui-review` skill at 1440, 768, and 375, and stop the service.
42
+
43
+ ## After the choice
44
+
45
+ Record which variant won and why. The winning variant was written under prototype
46
+ constraints: rewrite it properly, with tests, when folding it into the page. Remove the
47
+ losing variants, the switcher, and the flag in the same change.
@@ -0,0 +1,43 @@
1
+ # Upstream routes for design-prototype
2
+
3
+ Each upstream installs from its author's marketplace through
4
+ the `design-upstream-preflight` skill, when the chosen row needs it. Nothing here arrives
5
+ as a dependency of `@srobroek/design`.
6
+
7
+ | Upstream skill | Repo | Install |
8
+ |---|---|---|
9
+ | `html-wireframe` | `plannotator/effective-html` | `plannotator-effective-html@effective-html`, via the `design-upstream-preflight` skill |
10
+ | `html-prototype` | `plannotator/effective-html` | same entry |
11
+ | `frontend-slides` | `zarazhangrui/frontend-slides` | `frontend-slides@frontend-slides`, via the `design-upstream-preflight` skill |
12
+ | `web-asset-generator` | `alonw0/web-asset-generator` | `web-asset-generator@web-asset-generator-marketplace`, via the `design-upstream-preflight` skill |
13
+ | `superdesign` | `superdesigndev/superdesign-skill` | `superdesign@superdesign`, via the `design-upstream-preflight` skill |
14
+
15
+ All five are MIT with a LICENSE file. Skill granularity is the whole plugin, so
16
+ `effective-html` also installs `html`, `design-artifact`, `html-diagram`, and `html-plan`.
17
+ The other three install one skill each, which is unusually clean.
18
+
19
+ ## Routes that need no install
20
+
21
+ - the `wireloom` skill is vendored into this package, so it is always available. Its renderer
22
+ is the unversioned `npm install wireloom`, and its grammar is read from the upstream
23
+ `main` URL rather than vendored, so both follow the current release.
24
+ - Image generation, when the harness has a tool for it, is raster only, so no SVG and no
25
+ PDF. Pass reference images as its input; never let it overwrite them.
26
+ - Reading two images side by side with a vision-capable model yields a judgement, never
27
+ a measurement. The measured pixel diff is a screenshot diff with a threshold (the
28
+ browser routes table in the `ui-review` skill's `references/tools.md`).
29
+ - The `wire-dsl` MCP server is configured as the design plugin's README shows. It
30
+ is the ONLY working Wire DSL route: the upstream repository has no plugin manifest and
31
+ its one skill-shaped file is a bare `.md`, so a catalog entry would install cleanly and
32
+ contribute nothing. Verified empirically.
33
+
34
+ ## Prerequisites and accounts
35
+
36
+ - `web-asset-generator` needs Python 3.6+ with pip and Pillow. `pilmoji` and `emoji<2.0.0`
37
+ are optional, for emoji generation.
38
+ - `frontend-slides` needs nothing to author. PPT conversion needs Python with
39
+ `python-pptx`; deploying needs Node.
40
+ - `superdesign` runs `npx --yes @superdesign/cli@latest` and needs an authenticated
41
+ account, with `login` when unauthenticated. Image and video generation consumes credits.
42
+ Confirm the account with the user before routing to it. Its free-tier limits are not
43
+ publicly documented, so make no claim about them.
@@ -0,0 +1,62 @@
1
+ ---
2
+ name: design-system-audit
3
+ description: Inventories design tokens, scales and primitives before UI work; triggers on what tokens does this project use.
4
+ metadata:
5
+ opencode/autoinvoke: false
6
+ ---
7
+
8
+ # Design System Audit
9
+
10
+ Phase GROUND. Report the system that exists. Never invent it.
11
+
12
+ TRIGGER
13
+ + before implementing, restyling, or reviewing UI in an unfamiliar repo
14
+ + "what tokens does this project use", "is there a design system here"
15
+ + a literal color, radius, or spacing value is about to be written into a component
16
+ - recording the system as a durable artifact -> `design-md`
17
+ - judging an implemented surface against the system -> `ui-review`
18
+
19
+ GATES
20
+ ASK Creating a token set after an ABSENT verdict. The user approves a new system; the audit never starts one.
21
+ ASK Taking the StyleSeed route in step 4 when the user has not asked for it. Its install adds 23 `ss-*` skills to every later session.
22
+
23
+ ## Workflow
24
+
25
+ 1. Locate carriers: LOAD `references/token-carriers.md` and run
26
+ its `glob` and `grep` patterns for every ecosystem the repository uses, token
27
+ directories first. -> a path list naming each carrier's ecosystem. An empty list after
28
+ every applicable row was searched is the ABSENT verdict; a row left unsearched makes
29
+ the verdict incomplete, never ABSENT.
30
+ 2. Inventory every carrier the list names. -> each token group with its values quoted at
31
+ `file:line`, its consumption confirmed by a hit outside the carrier, the spacing base
32
+ derived as the reference describes, and every conflict the reference lists. This
33
+ inventory is the audit and its verdict.
34
+ 3. For token build, schema, and contrast pipeline questions, LOAD
35
+ `references/token-pipeline.md`. -> the project's existing
36
+ source and builder named, so no second build authority is introduced.
37
+ 4. OPTIONAL, only when the user asks for StyleSeed or approves it at the gate: LOAD
38
+ `references/upstream.md`, apply
39
+ the `design-upstream-preflight` skill for `styleseed`, then route by task. -> StyleSeed's
40
+ findings reported beside the inventory and labelled as its own. A refused or failed
41
+ install changes nothing above, because the carrier inventory stays the verdict. A
42
+ routed name already in your available skills: LOAD it by name. Installed during this
43
+ session and not yet listed: read its SKILL.md from the install path.
44
+
45
+ ## Rules
46
+
47
+ MUST Quote `file:line` for every value reported. An unsourced value is a guess.
48
+ MUST Return ABSENT and stop when step 1 finds no carrier.
49
+ MUST Resolve a real installed path before running a StyleSeed script. The documented
50
+ `<installed-ss-tokens>/scripts/generate-palette.mjs` and
51
+ `<installed-ss-score>/scripts/styleseed-check.mjs` are literal prose placeholders that
52
+ never expand. Resolve each under the install path the preflight reports.
53
+ DEFAULT Label a value `observed` when read from a carrier and `inferred` when derived
54
+ from usage. Later phases treat the two differently.
55
+ NOT Propose a token name that `grep` over the carriers would have found.
56
+ NOT Report a framework default as a project token unless the config extends it.
57
+
58
+ OUTPUT
59
+ L1 SYSTEM: PRESENT | PARTIAL | ABSENT -- primary carrier, plus `styleseed` when step 4 ran.
60
+ Tokens -- group, path, values. Primitives -- name, path, variant mechanism.
61
+ Conflicts -- only if non-empty: token, value A at path, value B at path.
62
+ CAP 250w plus the tables
@@ -0,0 +1,106 @@
1
+ # Token Carriers by Ecosystem
2
+
3
+ Search token directories first, then the config, then the theme module, then raw
4
+ declarations in stylesheets. A config no component imports is dead: confirm consumption
5
+ before reporting a carrier.
6
+
7
+ ## CSS custom properties (any web stack)
8
+
9
+ | What | Pattern |
10
+ |---|---|
11
+ | Carriers | `**/*.css`, `**/*.scss`, `**/*.less`, `**/globals.css`, `**/theme.css` |
12
+ | Declarations | `^\s*--[A-Za-z0-9_-]+\s*:` |
13
+ | Theme scopes | `:root`, `\[data-theme`, `\.dark`, `@media \(prefers-color-scheme` |
14
+ | Consumption | `var\(--` |
15
+ | Drift | `#[0-9a-fA-F]{3,8}` inside component files |
16
+
17
+ Trap: a token declared only under `:root` and never under the dark scope is a light-only
18
+ token. Report the missing counterpart as a gap, not as a complete color role.
19
+
20
+ ## Tailwind
21
+
22
+ | What | Pattern |
23
+ |---|---|
24
+ | Carriers v3 | `tailwind.config.{js,ts,cjs,mjs}` |
25
+ | Carriers v4 | any CSS file containing `@theme` |
26
+ | Declarations v3 | `theme\s*:`, `extend\s*:`, `colors\s*:`, `spacing\s*:`, `borderRadius\s*:` |
27
+ | Declarations v4 | `--color-`, `--font-`, `--spacing-`, `--radius-`, `--shadow-` under `@theme` |
28
+ | Consumption | class strings in `class=`/`className=`, `@apply` |
29
+
30
+ Trap: values under `theme.extend` add to the stock scale; values directly under `theme`
31
+ replace it. A stock utility used in markup (`text-slate-500`, `rounded-lg`) is a framework
32
+ default, not a project token, until the config names it.
33
+
34
+ ## styled-components, emotion, vanilla-extract
35
+
36
+ | What | Pattern |
37
+ |---|---|
38
+ | Carriers | `**/theme.{ts,tsx,js}`, `**/tokens.{ts,tsx}`, `**/*.css.ts` |
39
+ | Declarations | `createGlobalStyle`, `DefaultTheme`, `createTheme`, `createThemeContract`, `styleVariants` |
40
+ | Consumption | `useTheme\(`, `\$\{\(?\{?\s*theme`, `props\.theme\.`, `vars\.` |
41
+ | Drift | hex or px literals inside a tagged template or `css(` call |
42
+
43
+ Trap: the theme object is often partial and components fill the rest with literals inside
44
+ template strings. Count the literals; a high count means PARTIAL, not PRESENT.
45
+
46
+ ## Design token JSON (DTCG, Style Dictionary, Terrazzo)
47
+
48
+ | What | Pattern |
49
+ |---|---|
50
+ | Carriers | `**/tokens/**/*.json`, `**/tokens*.json`, `**/*.tokens.json`, `**/*.resolver.json` |
51
+ | Builder configs | `style-dictionary.config.*`, `sd.config.*`, `terrazzo.config.*` |
52
+ | Declarations | `"\$value"`, `"\$type"`, `"value"` with a sibling `"type"` |
53
+ | Generated output | the config's `buildPath` / `platforms` block, or Terrazzo's `outDir` |
54
+
55
+ The first carrier glob is the one that matches a tiered layout such as
56
+ `tokens/foundation.json` and `tokens/semantic.json`; the filename globs alone miss it,
57
+ because neither filename contains `tokens`. A builder config names its sources itself:
58
+ Style Dictionary's `source` array and Terrazzo's `tokens` array are carriers even when no
59
+ glob above matches them.
60
+
61
+ Trap: JSON is the source and the emitted CSS or TS is the output. Report the JSON as the
62
+ carrier and name the generated artifact as derived; editing the output is overwritten.
63
+
64
+ ## SwiftUI and UIKit
65
+
66
+ | What | Pattern |
67
+ |---|---|
68
+ | Carriers | `**/Assets.xcassets/**/Contents.json`, `**/*Theme*.swift`, `**/DesignSystem/**/*.swift` |
69
+ | Colors | `Color\("`, `UIColor\(named:`, `\.tint\(`, asset-catalog color sets with appearances |
70
+ | Type | `\.font\(\.`, `UIFont\.preferredFont`, `UIFontMetrics`, `Info.plist` `UIAppFonts` |
71
+ | Spacing and shape | `spacing:`, `padding\(`, `cornerRadius`, `RoundedRectangle\(cornerRadius:` |
72
+
73
+ Trap: `Color.primary`, `Color(.systemBackground)`, and `.font(.body)` are platform semantic
74
+ tokens supplied by the OS. Report them as platform tokens; a project token is a named asset
75
+ or a declared constant. Dynamic Type text styles are the type scale, so a hardcoded
76
+ `.system(size:)` is drift.
77
+
78
+ ## Jetpack Compose
79
+
80
+ | What | Pattern |
81
+ |---|---|
82
+ | Carriers | `**/ui/theme/Color.kt`, `Type.kt`, `Shape.kt`, `Theme.kt`, `**/*Tokens.kt` |
83
+ | Colors | `lightColorScheme\(`, `darkColorScheme\(`, `Color\(0x` |
84
+ | Type | `Typography\(`, `TextStyle\(`, `MaterialTheme\.typography` |
85
+ | Shape and spacing | `Shapes\(`, `RoundedCornerShape\(`, `\.dp\b`, `\.sp\b` |
86
+ | Consumption | `MaterialTheme\.colorScheme\.`, `MaterialTheme\.shapes` |
87
+
88
+ Trap: `MaterialTheme { }` with no `colorScheme` argument leaves the Material baseline scheme
89
+ in place. That is PARTIAL with the baseline named, not PRESENT.
90
+
91
+ ## Spacing base derivation
92
+
93
+ 1. Collect every declared step value in one unit.
94
+ 2. Sort ascending and take successive differences.
95
+ 3. Report the greatest common divisor of the steps as the base when every step is a multiple
96
+ of it; otherwise report `irregular` with the sequence.
97
+
98
+ Never report a base the sequence does not support.
99
+
100
+ ## Conflicts worth looking for
101
+
102
+ - One token name with two values across two carriers.
103
+ - A Tailwind config value and a CSS custom property claiming the same role.
104
+ - A literal in a component that matches no carrier value.
105
+ - A light-scope token with no dark-scope counterpart.
106
+ - A generated output file edited by hand, diverging from its source config.
@@ -0,0 +1,115 @@
1
+ # Token engineering pipeline
2
+
3
+ ## What is canonical
4
+
5
+ The project's existing token source and builder stay canonical. A Style Dictionary JSON
6
+ set, a Tailwind config, CSS custom properties, or a native carrier from
7
+ `token-carriers.md` is extended in place, never
8
+ replaced unasked. Everything below is the default for a NEW pipeline the user has
9
+ approved, or for a migration the user asked for.
10
+
11
+ In that new pipeline, layered DTCG JSON under `tokens/**/*.json` is the machine source.
12
+ DESIGN.md, in every project, is the authored intent and rationale artifact, and a linted
13
+ projection of the source. It is NOT the compiler input.
14
+
15
+ The reason is concrete. `npx --yes @google/design.md export "$(git rev-parse
16
+ --show-toplevel)/DESIGN.md" --format dtcg` is lossy three ways:
17
+ it resolves references into values rather than preserving the alias graph, it serialises
18
+ colours as sRGB component objects rather than the authored colour space, and it emits one
19
+ flat file with no component, theme, or density tiers. Closing that gap would need a
20
+ project-owned adapter, which this package does not ship and must not imply exists.
21
+
22
+ Use `export` for exactly one thing: bootstrapping a project that has no tokens at all.
23
+ Label it lossy when you do. The FILE argument is positional and required; without it the
24
+ command prints usage and emits nothing.
25
+
26
+ ## The chain
27
+
28
+ ```bash
29
+ # Gate the authored artifact. Exit 1 on errors. Safe with no --package because the spec
30
+ # names the scoped package: its bins are `design.md` and `designmd`, so they do NOT match.
31
+ npx --yes @google/design.md lint "$(git rev-parse --show-toplevel)/DESIGN.md"
32
+
33
+ # Independent DTCG schema gate. `--package` is REQUIRED: the bare bin name `dtokens`
34
+ # resolves an unrelated `dtokens` package on npm, not this one.
35
+ find tokens -type f -name '*.json' -print0 \
36
+ | xargs -0 npx --yes --package=@design-token-kit/cli dtokens check --scope schema
37
+
38
+ # Build CSS custom properties, mode selectors, and typed JS. `--package` is REQUIRED:
39
+ # the bare name `tz` resolves the npm package `tz`, which ships no bin at all.
40
+ npx --yes --package=@terrazzo/cli tz build
41
+ ```
42
+
43
+ Do NOT pass a glob. `dtokens` expands none itself, so a quoted `'tokens/**/*.json'` reaches
44
+ it literally and fails with `File not found`, while an unquoted one leaves recursion to the
45
+ shell. Enumerate the files and pass each as its own argument. Quote every substituted path
46
+ for the opposite reason: a literal `<repo>` is shell redirection.
47
+ The `ui-review` skill's `references/tools.md` is the authority on all three forms.
48
+
49
+ ## One tool per job
50
+
51
+ | Job | Package and bin | Licence |
52
+ |---|---|---|
53
+ | Token build authority | `@terrazzo/cli` 2.7.1, bins `tz` and `terrazzo`, with `@terrazzo/plugin-css` and `@terrazzo/plugin-js` | MIT |
54
+ | Independent DTCG schema gate | `@design-token-kit/cli` 1.8.0, bin `dtokens` | Apache-2.0 |
55
+ | Colour and contrast maths | `colorjs.io` 0.7.1, no bin | MIT |
56
+ | DESIGN.md lint, diff, export | `@google/design.md` 0.4.0, bins `design.md` and `designmd` | Apache-2.0 |
57
+
58
+ For a new pipeline, Terrazzo is the build authority rather than Style Dictionary because it
59
+ is DTCG-first, models resolver contexts so theme and density map natively onto selectors
60
+ such as `[data-theme="dark"]`, emits a typed `.d.ts` whose `keyof Tokens` supplies the
61
+ token-name union, and performs CSS Color 4 gamut mapping.
62
+
63
+ An existing Style Dictionary 5.5.2 (Apache-2.0) pipeline stays the build authority. Where
64
+ it reads a Tokens Studio export, add `@tokens-studio/sd-transforms` 2.0.3 (MIT) and use
65
+ `transformGroup: "tokens-studio"`. Never install both builders. Two engines means two
66
+ artifact authorities, and then neither is authoritative.
67
+
68
+ ## Source format
69
+
70
+ DTCG Format Module 2025.10 is a Final Community Group Report and a W3C Candidate
71
+ Recommendation dated 28 October 2025. It is stable enough to pin as the source format. It
72
+ is NOT a W3C Standard; never call it one.
73
+
74
+ Author colours in the intended space and never pre-convert authored OKLCH to sRGB:
75
+
76
+ ```json
77
+ { "$type": "color", "$value": { "colorSpace": "oklch", "components": [0.62, 0.16, 250], "alpha": 1 } }
78
+ ```
79
+
80
+ ## Eight techniques, and who owns each
81
+
82
+ | Technique | Owner |
83
+ |---|---|
84
+ | Tiered DTCG: `foundation.json`, `semantic.json`, `component/*.json`, `themes/*.json`, `density/*.json` | Project layering. Tier names are project convention, not spec semantics |
85
+ | Build CSS, never hand-edit it: `:root` properties, per-theme selectors, density classes, aliases preserved | `tz build` with `@terrazzo/plugin-css` |
86
+ | Generated token-name union so a bad name fails typecheck | `@terrazzo/plugin-js`; expose `keyof Tokens`. Never add a second TS generator |
87
+ | Drift gate: `--check` byte-compare per generated artifact | Project CI. No build engine replaces it |
88
+ | Theme completeness: every theme defines the full raw set, fallback selector asserted | Project policy. Terrazzo generates the matrix but asserts no requirement |
89
+ | Contrast gate at 4.5:1 body and 3:1 UI boundaries over generated pairs | Project script using `colorjs.io` `foreground.contrast(background, "WCAG21")`. It has no bin, so this script is project-owned |
90
+ | Every `var(--token)` resolves | Project CI over generated CSS. Catches serialisation and scope faults a source schema check cannot see |
91
+ | Raw hex and millisecond literals outside token files | Project CI. No schema validator duplicates this |
92
+
93
+ ## One addition beyond the eight
94
+
95
+ A reachability gate, project-owned: find leaves unreachable from any public or component
96
+ token, and aliases with no consumer. No inspected tool exposes this, so it is glue and is
97
+ labelled as glue.
98
+
99
+ Fluid typography via `utopia-core` (ISC, no bin) is adopted ONLY when the product needs a
100
+ fluid scale. Otherwise reject it rather than adding a generator for its own sake.
101
+
102
+ ## Runtime theming stays a browser concern
103
+
104
+ Apply `data-theme` alongside `prefers-color-scheme`, read a synchronous boot cache before
105
+ first paint, and verify computed styles with the `ui-review` skill. No build tool can prove
106
+ the absence of a flash or the correctness of cascade precedence; only driving the surface
107
+ can.
108
+
109
+ This package ships no cascade-origin route. The `ui-review` skill reads computed styles, which
110
+ answers what a property resolved to but never which rule won or where that rule lives. So
111
+ report an override you cannot attribute as unattributed, and name the property and selector
112
+ you measured.
113
+
114
+ Do NOT invent a route to close that gap. In particular, a command naming a relative path
115
+ such as `scripts/cdp.mjs` would run whatever the target repository happens to keep there.
@@ -0,0 +1,52 @@
1
+ # Upstream routes for design-system-audit
2
+
3
+ The carrier inventory in the skill is the audit. StyleSeed is an optional second opinion,
4
+ taken only when the user asks for it or approves it, and it installs from its author's
5
+ marketplace through the `design-upstream-preflight` skill. Nothing here arrives as a
6
+ dependency of `@srobroek/design`.
7
+
8
+ The table routes by TASK, because StyleSeed splits generating a system from auditing one
9
+ and says so itself.
10
+
11
+ | Upstream skill | Task it owns | Repo | Install |
12
+ |---|---|---|---|
13
+ | `ss-lint` | Fast automated detection of design-system violations in existing code | `bitjaru/styleseed` | `styleseed@styleseed`, via the `design-upstream-preflight` skill |
14
+ | `ss-review` | Reviewing UI code for design-system compliance | `bitjaru/styleseed` | same entry |
15
+ | `ss-tokens` | Generating an accessible semantic palette from a key color; viewing, adding, and modifying tokens | `bitjaru/styleseed` | same entry |
16
+ | `ss-score` | Validating the StyleSeed artifact contract, with file and line evidence | `bitjaru/styleseed` | same entry |
17
+
18
+ All four ship in the one `styleseed` entry, which installs 23 `ss-*` skills in total. Every
19
+ one of them adds its description to every later session, which is why the route is opt-in.
20
+
21
+ ## Why the routes split by task
22
+
23
+ `ss-tokens` describes itself as generating "an accessible semantic palette from a key
24
+ color, or view, add, and modify StyleSeed design tokens", and its own **When NOT to use**
25
+ section says:
26
+
27
+ > For finding token violations in existing code -> use /ss-lint
28
+
29
+ Routing an audit to `ss-tokens` therefore hands the job to a generator that declines it in
30
+ writing. `ss-lint` is "Quick automated lint - detects common design system violations in
31
+ seconds" and `ss-review` is "Review UI code for design system compliance". Those two are
32
+ StyleSeed's audit. `ss-tokens` is what runs afterwards, once the user has approved a new or
33
+ extended system, which is the gate in the skill body.
34
+
35
+ ## Script paths
36
+
37
+ StyleSeed documents `<installed-ss-tokens>/scripts/generate-palette.mjs` and
38
+ `<installed-ss-score>/scripts/styleseed-check.mjs` as if they were runnable. Both are prose
39
+ placeholders that never expand. Resolve the install path the preflight reports first;
40
+ the `ui-review` skill's `references/tools.md` holds the working forms.
41
+
42
+ ## Why these four and not others
43
+
44
+ `ss-a11y` and `ss-copy` are displaced: accessibility belongs to
45
+ the `accessibility-audit` skill and copy to the `ui-microcopy` skill. `design-token` from
46
+ `Owl-Listener/designer-skills` is displaced by `ss-tokens`, and that repository is not
47
+ advertised at all because obtaining three useful skills from it costs 41 installed
48
+ skills; `git-subdir` cannot narrow that, which was verified empirically.
49
+
50
+ `ss-score` earns its place beside `ss-tokens` only because its output is actionable on
51
+ its own: file and line locations, detector ids, and fix text. An aggregate score with
52
+ no located finding would not qualify.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: design-token-discipline
3
+ description: Use when styling a component or editing tokens, to use named color and spacing tokens and get new scales approved.
4
+ metadata:
5
+ opencode/autoinvoke: false
6
+ ---
7
+
8
+ MUST Use a named color token for every color. A literal hex, rgb, hsl, or named CSS color in a component is a miss.
9
+ MUST Use a spacing-scale token for every gap, padding, and margin. An off-scale `px` / `rem` / `em` there is a miss; `0` needs no token.
10
+ MUST Add the token to the registry first when a value is outside the system, then reference it in the notation its file class uses.
11
+ MUST Map the two notations rather than mixing them. `{group.token}` is DESIGN.md and DTCG notation: it belongs in DESIGN.md, in `tokens/**/*.json` alias values, and in prose. `var(--group-token)` is the CSS custom-property form and the only one a browser resolves: it belongs in `.css`, `.scss`, `.sass`, `.less`, `.styl`, and in any style block, class string, or `style` attribute inside `.tsx`, `.jsx`, `.ts`, `.js`, `.vue`, `.svelte`, `.astro`, or `.html`. Dots become dashes under a leading `--`, so `{color.fg-muted}` is written `var(--color-fg-muted)`, unless the token build declares a prefix, which its generated CSS shows. A `{group.token}` left in a stylesheet is dead text.
12
+ MUST Resolve every reference against a real carrier: `{group.token}` against DESIGN.md or the discovered token file, `var(--group-token)` against the generated CSS that declares it. An unresolved ref is a miss in either notation.
13
+ DEFAULT Reuse the nearest existing token when the visual delta is one step on the current scale.
14
+ NOT Hardcode a color (`#`, `rgb(`, `hsl(`, a named CSS color) or an off-scale gap, padding, or margin in component styles. Other geometry is not under this ban: `0`, `1px` hairlines, border widths, and outline offsets stay literal.
15
+ NOT Add a one-off override (`!important`, inline style, or local CSS variable) to escape the system.
16
+ ASK before introducing a new color, type, spacing, radius, elevation, or motion scale unless the user already approved that exact change. Without approval, record the question and leave the branch blocked, including unattended runs.
17
+
18
+ | situation | choice |
19
+ |---|---|
20
+ | value already exists as `{group.token}` | use that token |
21
+ | value is one step off an existing scale | use the nearest token |
22
+ | value is genuinely off-scale | add the token, then use it |
23
+ | change would add a new scale, human reachable | ASK, then wait |
24
+ | change would add a new scale, unattended run | record the question; block until explicit approval |
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: design-upstream-preflight
3
+ description: Use before a design skill or agent routes to an upstream skill or CLI, to install and probe only what that route needs.
4
+ metadata:
5
+ opencode/autoinvoke: false
6
+ ---
7
+
8
+ # Design Upstream Preflight
9
+
10
+ Run this when a design skill or agent is loaded, before its first routed step.
11
+ Check only the rows the current route reaches. The `design` package bundles none of these;
12
+ each comes from its upstream author.
13
+
14
+ | Routed name | Upstream repo | Marketplace | Install address | Prerequisite probe | Needed when |
15
+ |---|---|---|---|---|---|
16
+ | `impeccable` skill; `impeccable detect` CLI | `pbakaus/impeccable` | `impeccable` | `impeccable@impeccable` | `impeccable --version`, or `npx --version` where the scan runs through npx | design workflow; critique steps run the CLI |
17
+ | `ss-lint`, `ss-review`, `ss-tokens`, `ss-score`, `ss-motion` | `bitjaru/styleseed` | `styleseed` | `styleseed@styleseed` | `node --version` | `design-system-audit` StyleSeed route, only after the user opts in; `motion-design` React `motion.X` authoring |
18
+ | `accessibility` | `addyosmani/web-quality-skills` | `addy-web-quality-skills` | `web-quality-skills@addy-web-quality-skills` | none | `accessibility-audit` |
19
+ | `html-wireframe`, `html-prototype` | `plannotator/effective-html` | `effective-html` | `plannotator-effective-html@effective-html` | `python3 --version` to serve | `design-prototype` |
20
+ | `frontend-slides` | `zarazhangrui/frontend-slides` | `frontend-slides` | `frontend-slides@frontend-slides` | `python-pptx`, only for PPT conversion | `design-prototype` deck row |
21
+ | `web-asset-generator` | `alonw0/web-asset-generator` | `web-asset-generator-marketplace` | `web-asset-generator@web-asset-generator-marketplace` | `Pillow` | `design-prototype` asset row |
22
+ | `superdesign` | `superdesigndev/superdesign-skill` | `superdesign` | `superdesign@superdesign` | authenticated account with credits | `design-prototype` hosted row, after the user confirms |
23
+
24
+ ## Procedure
25
+
26
+ 1. Check what is installed. -> a row is installed when its routed skill appears in your
27
+ available skills list, or its CLI answers its prerequisite probe.
28
+ 2. Install each missing row the route needs, from its listed repo, with the harness's own
29
+ route:
30
+ - Claude Code: `claude plugin marketplace add OWNER/REPO` when `claude plugin
31
+ marketplace list` does not name the marketplace, then
32
+ `claude plugin install ADDRESS`.
33
+ - OpenCode: clone the repo once with
34
+ `git clone --depth 1 "https://github.com/OWNER/REPO" "$HOME/.local/share/design-upstream/REPO"`,
35
+ then add the clone's skills directory to the `skills` array of the global OpenCode
36
+ config. OpenCode reloads skills after the config is saved.
37
+ - pi: for `impeccable`, run `impeccable install -y --providers=pi --scope=project --no-hooks`.
38
+ It writes `.pi/skills/impeccable/`. For another row, clone the repo as for OpenCode.
39
+ Then add the clone's skills directory to the `skills` array of
40
+ `~/.pi/agent/settings.json`. Run `/reload` to list the new skills.
41
+ - Another harness: its own plugin or skill install route for the listed repo.
42
+ 3. Probe each prerequisite. -> the probe exits zero. Python packages: run
43
+ `python3 -c 'import PIL'` or `python3 -c 'import pptx'`; on failure run the upstream
44
+ script through `uv run --no-project --with pillow python SCRIPT` or
45
+ `--with python-pptx`. With no `uv`, STOP and report the missing prerequisite.
46
+ 4. Load the routed skill. -> a skill in your available skills list loads by name. When
47
+ the harness lists a newly installed skill only from the next session, find
48
+ `skills/NAME/SKILL.md` under the install path and read that file.
49
+ 5. Report each install, its path, and any prerequisite still missing. -> the user knows
50
+ whether the skill loads natively now or from the next session.
51
+
52
+ ## Rules
53
+
54
+ MUST Install only the rows in the table, from the listed repo and address.
55
+ MUST STOP and report when an install or probe fails. Never substitute your own guidance
56
+ for the routed upstream.
57
+ ASK Before adding the `superdesign` marketplace or installing it: it needs an account and
58
+ spends credits.
59
+ NOT Install a row the current route does not reach.
60
+ NOT Install a Python package globally with `pip`.