Thoughts

Thoughts

ds-specs: a Claude Skill for LLM-first design systems, with two-way Figma sync

Aug 2026 · Updated Oct 2026 · 7 min read
Design SystemsAI WorkflowClaudeOpen Source
One design system, two-way Figma sync: a Figma variable linked to a CSS token through codeSyntax

I wrote earlier about fixing a design system so Claude could actually follow it. That fix lived in Lune, a planning tool for wedding planners. A friend asked me to help with its brand, design and product, and after I handed it off, I kept Lune as my design system lab. The fix was a /DSYS folder in Lune's repo, written by hand for that one codebase. It worked great, as long as I never wanted it anywhere else. (I wanted it everywhere else.)

So I rebuilt it as a Claude Skill called ds-specs. It's free on GitHub for any designer or team whose UI keeps drifting off the system.

The ds-specs repository on GitHub

From a folder to a skill

A folder only knows its own project. A skill walks into a codebase it has never met, so it looks around first. It checks whether the project uses Tailwind or plain CSS, sizes the spec tree to fit, and won't write specs for components that don't exist yet. I'll take a small spec that's right over a big one that's quietly wrong.

Three tiers, three layers

Each spec can only point at the tier above it, so a component spec never gets to touch a raw hex value. (Sorry, components.)

specs/
├── foundations/   color, typography, spacing, radius, elevation, motion…
├── tokens/        the master variable map
├── atoms/         ─┐
├── molecules/      ├─ components, 8-section template each
├── organisms/     ─┘
└── patterns/      layout and composition rules

Each token also passes through three layers, so the UI never talks to the upstream library directly:

--ds-text: #292A2E;                        /* upstream library */
--color-text: var(--ds-text, #292A2E);     /* your alias */
color: var(--color-text);                  /* components — alias only */

Five gates

Lune had one pre-commit hook. ds-specs checks at five points, from the moment a session starts to deploy. Locally, autofix can swap in an exact hex match while you read the diff. CI and deploy never fix anything. They just block.

Near misses get a person. #1868DA sitting next to a #1868DB token could be a typo or a deliberate one-off, and no script can tell which, so the gate flags it and leaves the call to you.

On a codebase that already has hundreds of violations, the gates record a baseline and fail only when the count goes up. Fail hard against 400 old violations and someone deletes the gate by Thursday.

A two-way bridge to Figma

This was the part I was least sure I'd get right. Figma variables have a codeSyntax field. Set it to the matching CSS custom property and the Figma variable and the code token become one record. Sync is exact, and nobody has to guess that "Text/Primary" means --color-text.

When the two sides disagree, ds-specs doesn't pick a winner. Reconcile lays out a diff in six categories and waits, because only a person knows whether the designer or the developer moved the value. Think of it as couples counseling for your tokens.

Try it

On claude.ai, download the .skill file from the latest release and upload it under Settings → Capabilities → Skills. In Claude Code or Cowork, clone the repo and copy the skill folder into ~/.claude/skills/. The README has full steps.

You don't have to call it by name. Say "tokenize this" or "my prototype is drifting" and it builds the spec tree. "Push my specs to Figma" hands off to Figma's library skill. "Does Figma match my code" reconciles without changing a thing.

Update, October 2026: what Storybook changed

Adding Storybook to Lune this month changed what these specs are for. Storybook's MCP endpoint lets any agent ask for a component by name and get back its props and working code.

First, Storybook showed me drift I couldn't see by reading the docs. PlannerVendorCard's spec still described an imageSrc prop that had becomeimages. Components still carried old-palette hex values and gold focus rings that their specs never allowed. One token, text-muted, measured about 2.4:1 against white and caused 88 of the 100 accessibility failures. Fixing that one token cleared all 88.

It also showed me that part of every spec was a copy. I wrote props, variants and code examples by hand in markdown, and Storybook generates all three from the code, where they can't go stale. The imageSrc mistake came from one of those copies.

So I split the job. Storybook answers what a component is and how to call it. The spec keeps what a story can't show: when to use it, why each token, and what not to do. The template went from eight sections to five.

Then I made sure an agent gets both in one answer. A small script copies each spec's rules into the component's doc comment, and the MCP returns that comment with the code. I still write the rules in one place, the markdown. The same script runs on every commit and fails when a spec and its component disagree: a prop the spec never mentions, a missing story, or a comment that's out of date.

I learned that a spec's value is its judgment. The props tables only ever duplicated the code. The ds-specs skill picked up the same changes in v0.2.0. On a project with Storybook, it writes the short template and adds the spec sync.

Copy editing by Claude Sonnet 5. hehe~

Resources

github.com/ejun-9/ds-specs: the skill, install steps, and the .skill file for claude.ai.

Expose your design system to LLMs by Hardik Pandya, the article this whole approach is built on.

Also on Medium.

Keep reading