ESP
← Back

Design-tokens

Welcome message from the Design-tokens skill

The problem

Creating coherent design tokens is slow and error-prone. Going from a brand color to valid JSON with perceptually uniform scales, WCAG/APCA accessibility values, and HSL/OKLCH formats can take hours. And doing it right — following the W3C Design Tokens Community Group specification — is specialist territory.


The solution

A Claude Code skill that acts as an interactive W3C token generator. With three inputs (brand color, base gray, and typography) it generates a complete system: color palettes with a canonical OKLCH scale, modular typography, spacing, elevations, grid, motion, accessible focus, and the new Liquid Glass material from iOS 26.

Two modes:


The creation process

The skill is defined in a single Markdown file at .claude/commands/design-tokens.md. The main challenge was specifying the behavior: how to calculate perceptually uniform color ramps, how to structure the JSON per the W3C spec, what to ask and in what order, and how to generate the HTML showcase with no external dependencies.

Several iterations to refine: the canonical OKLCH scale, the cross-token reference system ({spacing.gap.4}), the structure of composite typography tokens, and accessibility extensions for each literal color.


The execution process

When "/design-tokens" is invoked, Claude follows the skill flow:

  1. Asks for the mode (quick or guided).
  2. Collects the required inputs.
  3. Runs a Python script internally for color calculations (OKLCH → sRGB, WCAG, APCA) with mathematical precision.
  4. Writes "{name}.tokens.json" and "{name}.showcase.html".
  5. Opens the showcase in the browser with "open".

The showcase is self-contained HTML that reads the JSON via "fetch" and renders the tokens live.


Results


Learning and Conclusion

Claude Code skills are surprisingly powerful when the instruction is well specified. The Markdown file is the product: it defines the behavior, the calculations, the output format, and the tone of the conversation.

The biggest takeaway: precision in the skill prompt matters more than in any conversational prompt . Every ambiguity becomes a poorly generated token or an unnecessary question to the user. Investing time in the specification saves time on every subsequent run.


Showcase

For a quick-mode input of:


The following result was obtained:


Assumptions:


View the showcase ↗