/product-skills:ui-design-systemfrom product-skills
Generates a design-token system from a brand color: creates scales, spacing, typography, and component specs. Exports as CSS, SCSS, or JSON with WCAG contrast checking.
Ships in product-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The direction is already chosen: there is a brand colour and a style. This skill turns that into a token system people can build with: a 10-step primary and complementary secondary scale (50-200 are near-white tints for backgrounds and hover), fixed neutral, semantic and surface colours, a 1.25 modular type scale, an 8pt spacing grid, component sizes, radius, shadows, motion, breakpoints and z-index. It exports them as JSON, CSS custom properties or SCSS variables. A checker then computes WCAG contrast for every pair that carries text and, when the brand hex fails, names the primary shade that passes. The rest of the skill specs components on top of those tokens and hands them off.
The deliverable states contrast ratios only as the checker printed them. Ratios guessed by eye are wrong often enough that a pasted number is the only one worth trusting.
@theme, SCSS, a JS themeIf there is no direction yet (no brand colour, no style, only a product brief), start with
product-team/design-direction, which picks the direction. This skill turns that
direction into a working token system.
#RRGGBB or #RGB) and a style preset: modern, classic or
playful (fonts, radius and shadow set).product-team/design-direction's checker).Settle the inputs below before generating. When one is missing and would change the result, ask; when it would not, use the default and say so.
modern.Ask the two or three that matter for this request. If the user wants tokens straight away, generate with defaults and put the assumptions at the top.
Run from the skill folder:
# Generate tokens (JSON), then check contrast on them
python3 scripts/design_token_generator.py "#0066CC" modern json > /tmp/tokens.json
python3 scripts/token_contrast_checker.py --tokens /tmp/tokens.json
# Bundled samples: sound (exit 0) and flawed (exit 1)
python3 scripts/token_contrast_checker.py --tokens assets/sample_tokens.json
python3 scripts/token_contrast_checker.py --tokens assets/sample_tokens_flawed.json
# Extra pairs a component adds: hover fill with a white label, focus ring at 3:1 (non-text)
python3 scripts/token_contrast_checker.py --tokens assets/sample_tokens.json \
--pair surface.background:primary.600 --pair primary.DEFAULT:surface.background:3
# Other exports and a summary
python3 scripts/design_token_generator.py "#0066CC" modern css > /tmp/design-tokens.css
python3 scripts/design_token_generator.py "#8B4513" classic scss > /tmp/_design-tokens.scss
python3 scripts/design_token_generator.py "#FF6B6B" playful --format text
| Script | Input | Output | Exit codes |
|---|---|---|---|
design_token_generator.py | brand_color (required) [style] [output] or --format text|json|css|scss | Token system as JSON, CSS, SCSS or a summary | 0 written, 2 missing or bad colour, unknown style or unreadable presets |
token_contrast_checker.py | --tokens file.json|-, --target AA|AAA, --pair FG:BG[:MIN] (repeatable), --format text|json | Ratio per text pair, failed pairs, suggested primary shade, verdict | 0 all pass, 1 a pair fails, 2 unreadable or incomplete input |
The checker tests five kinds of pair: body text (foreground on background), muted text
(neutral-500), link text (brand on background), button label (background colour on a brand
fill), and each semantic label (contrast on base). All use the normal-text threshold
(4.5:1 AA, 7:1 AAA), because button labels and links are normal-size text. --pair adds
any other pair, as #RRGGBB or a token path such as primary.600. The optional third
field sets its own minimum, for example 3 for a focus ring or large text.
python3 scripts/token_contrast_checker.py --tokens assets/sample_tokens_flawed.json # exit 1
Contrast check, WCAG AA (4.5:1 normal text)
FAIL body text #9CA3AF on #FFFFFF 2.54:1
pass muted text #6B7280 on #FFFFFF 4.83:1
FAIL link text #FF6B6B on #FFFFFF 2.78:1
FAIL button label #FFFFFF on #FF6B6B 2.78:1
pass error label #111827 on #EF4444 4.71:1
pass info label #111827 on #3B82F6 4.82:1
pass success label #111827 on #10B981 6.99:1
pass warning label #111827 on #F59E0B 8.26:1
Brand colour fails as text/fill. Use primary.700 (#994e4e, 5.91:1) for links and button fills; keep the brand hex for large or decorative use.
Verdict: FAIL (3 of 8 pairs fail)
| Code | Meaning |
|---|---|
| 0 | Generator wrote tokens; checker found every pair passing |
| 1 | Checker only: at least one pair fails (the output names it and the shade to use) |
| 2 | Unusable input: missing or malformed brand colour, unknown style, unreadable or incomplete tokens JSON (one-line error: on stderr) |
assets/malformed_tokens.json exercises the exit-2 path; assets/contract.json lists every run.
link text or button label fails, use the shade the checker names for links and
button fills, and keep the brand hex for large or decorative use. If a semantic or
surface pair fails in a file someone edited, restore the generated value or pick a
darker one and re-run.references/developer-handoff.md).Done when: the checker's verdict is PASS at the agreed target, or each remaining failure is listed with the reason it was accepted.
Define each component's sizes, variants and states only in terms of tokens. A raw hex or px value in a component is a second source of truth that drifts from the first.
sizing.components.button|input.sm|md|lg (32/40/48px heights). Keep one
height scale for every control that sits in the same row.primary.DEFAULT, or the checker's shade. Hover goes
one step darker. Secondary uses neutral-100 with neutral-900 text, and ghost is
transparent with neutral-700 text. Do not use primary.500 as the fill: it is a lighter
tone than the brand (3.86:1 with white for #0066CC).focus-visible (a 2px outline in a colour at 3:1 against
the page, never outline: none), disabled and loading. List the tokens each state uses.Templates and the token-to-component map are in references/component-architecture.md.
Done when: every variant and state names its tokens, and every colour pair a component
adds (hover and active fills with their labels, the focus ring, outline and ghost text)
passes the checker via --pair.
The generator's breakpoints are 480/640/768/1024/1280/1536px (xs to 2xl), and its
type scale is fixed in px. For fluid headings, derive clamp() values from the scale's
min and max sizes using the formula in references/responsive-calculations.md. Test at
each breakpoint, and at 200% zoom with no horizontal scroll.
Ship the JSON plus the stack's export, the checker output, the component specs, and the
integration snippet for the stack (Tailwind 4 @theme inline, plain CSS, Sass, JS theme)
from references/developer-handoff.md. That file uses the exact names the generator
emits (--colors-primary-DEFAULT, --typography-fontSize-base, and so on).
| Situation | Do | Why |
|---|---|---|
| Brand hex fails as link or fill | [PROVEN] Use the checker's shade for text and fills, and keep the brand hex for decoration | Contrast is arithmetic. A brand guideline cannot make 2.8:1 readable |
| Brand hex passes | [RECOMMENDED] Fill with primary.DEFAULT, hover with the next darker step | Step 500 is lighter than the brand, so it often fails where the brand passes |
| Team wants AAA | [RECOMMENDED] Agree it per surface (body text first), not for every pair | The fixed error and info bases cannot reach 7:1 with any label (error 5.58:1 and info 5.71:1, both on black), so blanket AAA means a new semantic palette |
| Dark mode needed | [PROVEN] Build and check a separate palette | Inverted light tokens give wrong elevation and fail contrast unpredictably |
| Style preset does not fit | [EXPERIMENTAL] Edit references/token-presets.json (fonts, radius, shadows) and re-run | Keeps one source of values. Record the change in the handoff |
Mistake: Filling buttons with primary.500 because it is "the middle of the scale".
Why it happens: Tailwind-style scales put the brand at 500. This generator puts it in
DEFAULT and makes 500 a lighter, less saturated tone.
Instead: Fill with primary.DEFAULT when the checker passes it, otherwise with the
shade it names.
Mistake: Approving a palette because it looks readable on a good monitor. Why it happens: Designers review on calibrated screens in good light. Instead: Run the checker and paste the ratios. Do not paraphrase them as "accessible".
Mistake: Tweaking values in design-tokens.css to fix one screen.
Why it happens: It is faster than re-running the generator.
Instead: Change the brand colour, the style or references/token-presets.json, then
regenerate, so JSON, CSS and SCSS stay identical.
Mistake: A component with #2563EB or 13px in its styles.
Why it happens: The token did not exist yet, so a raw value went in.
Instead: Add the token, then use it. Search component styles for raw hex and px
before handoff.
Mistake: outline: none with a pale box-shadow (or nothing) in its place.
Why it happens: The default ring looks unstyled.
Instead: A 2px focus-visible outline in a colour at 3:1 against the page.
Keyboard users have no other way to see where they are.
references/token-generation.md: how each scale is computed, what the colour steps
are, type and spacing scales, contrast formula, export shapesreferences/component-architecture.md: component hierarchy, naming, props, variant and
state templates, token-to-component mapreferences/responsive-calculations.md: breakpoints, fluid type with clamp(), gridsreferences/developer-handoff.md: exports, Tailwind 4, CSS, Sass, JS themes, Style
Dictionary, Figma, checklist, versioningreferences/token-presets.json: every fixed value the generator uses| File | Purpose |
|---|---|
scripts/design_token_generator.py | Brand colour and style to token JSON, CSS, SCSS or summary |
scripts/token_contrast_checker.py | WCAG contrast for text pairs in a tokens JSON, with a suggested primary shade |
references/token-presets.json | Fixed presets: semantic, surface, neutral, fonts, type, spacing, sizing, radius, shadows, motion, breakpoints, z-index |
references/*.md | Knowledge base listed above |
assets/sample_tokens.json | Sound tokens for #0066CC modern (checker exit 0) |
assets/sample_tokens_flawed.json | #FF6B6B playful with the foreground lightened to #9CA3AF (checker exit 1: body text, link text, button label) |
In scope: token generation from a chosen brand colour and style, JSON/CSS/SCSS export, WCAG 2.x contrast for the text-bearing pairs, component variant and state specs on those tokens, responsive and handoff guidance.
Out of scope: choosing the direction, dark-mode palettes, icons and imagery, Figma plugin work, rendering or screenshot checks.
Caveats: contrast uses the WCAG 2.x formula, and APCA can differ for thin type and dark surfaces. The checker covers the generator's own pairs, not every pair a component creates. Font names are suggestions, so confirm licences before shipping.
Related skills, one job each:
product-team/design-direction chooses the design system from a brief: style, palette,
type pairing and tokens. Use it before this skill when there is no brand colour or style yet.product-team/product-designer handles design critique, journey maps and usability scoring.engineering/marketing-site-builder builds a marketing site and runs its finish gate.engineering/interface-refinement refines an existing UI with a detector and commands.engineering/design-auditor grades a built UI.engineering/a11y-audit runs the WCAG audit on a running interface, beyond token contrast.engineering/senior-frontend implements components and state in the frontend codebase.assets/contract.json (opens in a new tab)assets/malformed_tokens.json (opens in a new tab)assets/sample_tokens.json (opens in a new tab)assets/sample_tokens_flawed.json (opens in a new tab)references/component-architecture.md (opens in a new tab)references/developer-handoff.md (opens in a new tab)references/responsive-calculations.md (opens in a new tab)references/token-generation.md (opens in a new tab)references/token-presets.json (opens in a new tab)scripts/design_token_generator.py (opens in a new tab)scripts/token_contrast_checker.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
design-tokens, design-system, wcag-contrast, css-variables, scss, component-specs
15 skills in this plugin
/ab-test-setupCheck an A/B hypothesis, size the test, and analyse results from a CSV with data-quality checks (sample ratio mismatch, small counts, multiple variants). Use when planning an experiment, calculating sample size or duration, reading experiment results, or when someone says "let's test that."
/agile-product-ownerAgile product ownership for backlog management and sprint execution. Use when you have an epic to turn into INVEST-checked user stories with acceptance criteria, oversized stories to split, a sprint to load to capacity, or a backlog to prioritize.
/apple-hig-expertApple Human Interface Guidelines expert across iOS, iPadOS, macOS, watchOS, tvOS, and visionOS. Use when designing or reviewing an Apple-platform app, auditing for HIG compliance, picking native components, or validating accessibility. Use when you have a screen inventory (JSON of true/false flags per screen) to audit, or a UX goal to map to a native pattern.
npx claudepluginhub borghei/claude-skills --plugin product-skillsOther plugins' skills for the same job