anandartin/celestial-skills/design-tokens-to-code-engineering

Claude Code and agent skill by anandartin/celestial-skills

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Engineering practice: Design tokens to code — Generate platform code from one token source, build components that only read tokens and guard them with visual regression, so a brand change ships in one commit. Use in any language or framework whenever this practice applies, and when reviewing work that should follow it.

Install

npx vskill@latest install anandartin/celestial-skills/design-tokens-to-code-engineering

SKILL.md

The same SKILL.md was published earlier as anandartin/celestial-skills/design-tokens-to-code-engineering.

Design tokens to code

Generate platform code from one token source, build components that only read tokens and guard them with visual regression, so a brand change ships in one commit.

Use this when implementing a design skill or design system in a codebase, adding a theme, or cleaning up hard-coded styles. It prevents drift between design and code, one-off colours and sizes scattered through components, broken dark mode and unnoticed visual regressions.

How to do it

  1. Collect tokens into one source — Put colour, type, spacing, radius, shadow, motion and breakpoint values in a single version-controlled JSON source (the design skill or a tokens file in the W3C draft format). Each token has a name, value, type and description.
  2. Layer primitives and semantic tokens — Keep raw primitives (blue-600, space-4) separate from semantic tokens that describe purpose (color-action-primary, color-text-muted, space-inset-md). Components use only semantic tokens; themes remap semantic tokens to different primitives.
  3. Generate platform outputs — Use a token build tool such as Style Dictionary to emit CSS custom properties, a Tailwind theme, SwiftUI or Compose constants from the same source. Generated files are build output with a do-not-edit header; never hand-edit them.
  4. Build components that read tokens — Write each component against semantic tokens only, with every state (default, hover, focus, active, disabled, error, loading) defined. Expose variants as props, not as style overrides.
  5. Wire themes — Implement light and dark (and any brand themes) by swapping the semantic layer, for example with a data-theme attribute or a platform colour scheme. Check contrast for every text and UI pair in every theme.
  6. Document components with stories — Write a story or preview for every component state and theme in a component workshop such as Storybook, so design can review the real code.
  7. Add visual regression tests — Snapshot every story in each theme at fixed viewport sizes and compare on each pull request. Review diffs as part of code review and approve intentional changes explicitly.
  8. Block raw values — Add lint rules that fail on raw hex colours, pixel sizes and font names in component code, with an allow-list for the generated token files.

Checklist

  • [ ] All tokens come from one versioned source file
  • [ ] Generated outputs are rebuilt in CI and not edited by hand
  • [ ] Components reference semantic tokens only
  • [ ] Every component state has a story in each theme
  • [ ] Light and dark themes pass contrast checks for every text pair
  • [ ] Visual regression runs on every pull request with no unapproved diffs
  • [ ] Lint rejects raw colour, size and font values in components

Rules

  • Components read semantic tokens; primitives are referenced only by the theme layer. _(Themes can then change without touching any component.)_
  • Token names describe purpose, not appearance (color-feedback-danger, not red). _(Appearance names become lies the first time the brand changes.)_
  • Generated token files are build output; change the source and regenerate. _(Hand edits are overwritten and leave design and code disagreeing.)_
  • Every semantic text and background pairing is contrast-checked in each theme as part of the token build. _(A token swap can silently break contrast across hundreds of screens.)_
  • Ship tokens as CSS custom properties or compile-time constants, not runtime JavaScript lookups. _(Runtime theming in script adds work to every render.)_

Do

  • Version the token package and record changes in a changelog
  • Keep focus ring, disabled and error states as tokens too
  • Pair with design on naming before generating code

Don't

  • Do not let components accept arbitrary style overrides that bypass tokens
  • Do not keep dark mode as a separate set of component styles
  • Do not approve visual diffs in bulk without looking at them

Quality gates

GateToolThresholdWhen
Visual regressionSnapshot comparison of component stories (for example Playwright screenshots or a Storybook test runner)No unapproved pixel diffs in any themeEvery pull request touching tokens or components
No raw style valuesStylelint or ESLint rule for hex, px and font-family literals0 violations outside generated token filesEvery pull request

Workflow

Review

  • Designer reviews visual diffs for token changes
  • Reviewer checks new components for raw values and missing states

Definition of done

  • Stories cover every state in every theme
  • Token package version bumped and changelog updated

Examples

Component reading semantic tokens (src/components/Button.css)
css
:root {
--color-action-primary: var(--blue-600);
--color-on-action: var(--white);
}
[data-theme='dark'] {
--color-action-primary: var(--blue-400);
--color-on-action: var(--grey-950);
}
.button {
background: var(--color-action-primary);
color: var(--color-on-action);
padding: var(--space-inset-sm) var(--space-inset-md);
border-radius: var(--radius-control);
font: var(--type-label-md);
}
.button:focus-visible {
outline: var(--focus-ring-width) solid var(--color-focus-ring);
outline-offset: var(--focus-ring-offset);
}

Further reading

_Written for Celestial; the sources above inspired it._

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/anandartin/celestial-skills/design-tokens-to-code-engineering/badge)](https://verified-skill.com/skills/anandartin/celestial-skills/design-tokens-to-code-engineering)

Something wrong with this skill or its page? Tell us.