Design system enforcement
Skill cristianorj22/arthus-harness/tests/snapshots/web-supabase/.claude/skills/design-system-enforcement
Opinionated Claude Code scaffolder — agents, skills, hooks, slash commands. Like create-t3-app, but for your .claude/. Install months of Claude Code discipline in 30 seconds.
npx -y skills add cristianorj22/arthus-harness --skill design-system-enforcementAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
How to consume Design System tokens — never hex hardcoded, always token references, design:check before commit, single source-of-truth in DESIGN.md. Use when writing or reviewing UI / CSS / Tailwind classes.
SKILL.md
4.8 KB, as published. Nobody here has run it
Design System enforcement
Source-of-truth:
Docs/design-system/DESIGN.md(front-matter YAML).Pipeline:
DESIGN.md→scripts/sync-design-tokens.mjs→src/index.css(:root { ... }) →tailwind.config.tsreads viahsl(var(--*)).Edit
DESIGN.mdfirst. Always.
The contract
- No hex literals in components / CSS — only token references.
- No font-size / spacing in raw px when a token covers it.
- DESIGN.md leads, src/index.css follows. Edit YAML, run
npm run design:sync, commit both. npm run design:checkis green before every commit that touchesDocs/design-system/,src/index.css, ortailwind.config.ts.
How to reference a token
From Tailwind classes (preferred)
// Token via Tailwind utility (assumes tailwind.config.ts maps theme.colors to CSS vars)
<button className="bg-primary text-primary-foreground rounded-lg px-6 py-3">
Submit
</button>
<div className="bg-card text-foreground border border-border rounded-xl p-5">
...
</div>
From inline / module CSS
.card {
background: hsl(var(--card));
color: hsl(var(--card-foreground));
border: 1px solid hsl(var(--border));
border-radius: var(--radius);
}
From component spec / docs
| State | Token |
|---|---|
| Rest | `{colors.card}`, `{elevation.card-rest}` |
| Hover | `{elevation.card-hover}` |
What NEVER to do
// Hex hardcoded
<div style={{ backgroundColor: '#1E3A8A' }}>...</div>
// Inline color in Tailwind via brackets
<div className="bg-[#1E3A8A]">...</div>
// Magic radius
<div className="rounded-[18px]">...</div>
// Spacing not in scale
<div className="p-[14px]">...</div>
// Custom shadow
<div className="shadow-[0_4px_8px_black]">...</div>
// Font-size in raw px
<h2 style={{ fontSize: '23px' }}>...</h2>
The validator (scripts/design-check.mjs) catches hex literals. The rest depends on review.
When you genuinely need a new token
Don't shortcut by hard-coding. Add the token:
- Edit
Docs/design-system/DESIGN.mdfront-matter:colors: ... accent-warm: "#F97316" # ★ added: highlight for callouts - (Optional) document intent in a satellite file under
Docs/design-system/tokens/. - Run sync:
npm run design:sync→ regeneratessrc/index.css. - Verify:
npm run design:checkshows green. - Use in components via
bg-accent-warm/hsl(var(--accent-warm)).
Patterns by component family (typical shadcn-aligned defaults)
| Family | Default tokens |
|---|---|
| Button (primary) | bg-primary text-primary-foreground rounded-lg px-6 py-3 font-semibold |
| Button (secondary) | bg-secondary text-secondary-foreground rounded-lg px-6 py-3 font-semibold |
| Card | bg-card text-card-foreground rounded-xl border border-border p-5 shadow-sm |
| Input | bg-card border border-input rounded-md px-4 py-3 focus:ring-2 focus:ring-ring |
Adjust to your brand by editing tokens in DESIGN.md, not by inlining hex values.
Layered radius rule
When a smaller-radius element nests inside a larger-radius one:
- Outer card
rounded-xl→ inner imagerounded-lgorrounded-md. - At most two visible radii in the same composition.
Spacing rhythm
Use a 4px base scale (p-1 = 4px, p-2 = 8px, ...). Lean toward the larger option when ambiguous.
How AI agents use this
When generating or reviewing UI:
- Read
Docs/design-system/DESIGN.mdfront-matter once for tokens. - Use only Tailwind utilities that resolve to tokens (
bg-primary,rounded-lg) or CSS-var references (hsl(var(--primary))). - If a needed token doesn't exist — propose adding to DESIGN.md, don't shortcut.
- Run
npm run design:checkbefore declaring "done".
Audit checklist (review)
When reviewing UI changes:
- No hex literals in changed
*.tsx/*.cssfiles (grep -nE '#[0-9a-fA-F]{6}'). - No magic spacing (
p-[14px],gap-[7px]). - No magic radius (
rounded-[N px]). - Colors come from token names:
bg-{primary|secondary|...}. - If new token added: DESIGN.md updated and
design:syncran. -
npm run design:checkis green. - If
tailwind.config.tswas touched, the change references CSS vars viahsl(var(--*))(no inline hex).
See also
Docs/design-system/DESIGN.md(canonical)Docs/design-system/PIPELINE.md(pipeline contract)scripts/sync-design-tokens.mjs,scripts/design-check.mjs