How to give Claude Code (or Cursor) a design system
A design system for a coding agent is a small set of files it reads before it writes interface code: the decisions in a spec (layout, colour roles, type, spacing, motion), the values in a tokens file, and the rules as sentences. Claude Code reads CLAUDE.md at the start of every session and loads any file it imports with @; Cursor reads project rules in .cursor/rules and AGENTS.md. You can write these files yourself or generate them with LayQ.
What goes where
| File | What it holds | Who reads it |
|---|---|---|
DESIGN.md or specs/design.md | The decisions: kind of product, layout, colour roles, type scale, spacing, which components, motion. | Any agent you point at it |
design-tokens.css | The values as CSS variables: colours for light and dark, spacing, radius, durations. | Your code, and the agent when it writes styles |
CLAUDE.md | Project instructions; a line @DESIGN.md loads the spec in every session. | Claude Code |
AGENTS.md | The same instructions in the shared format. | Codex, Cursor and others; Claude Code can read it too |
.cursor/rules/design.mdc | A project rule with alwaysApply: true that points at the spec. | Cursor |
With LayQ, in six steps
- ConnectPaste the setup into Claude Code, Codex, Cursor or Gemini CLI once. It adds LayQ’s MCP server and skill.Claude CodeCodexCursorGemini CLI
- PlanAsk your agent for a plan, or choose on the Blueprint: kind of product, layout, palette, interaction rules and motion, with a live preview.Blueprint
- SpecsThe plan export writes specs/design.md, interaction.md, motion.md, tech.md and design-tokens.css into the project.What is a DESIGN.md?
- StarterThe agent sets up the Next.js template for your kind of product, with the specs and tokens already in place.Next.js templates
- ComponentsIt installs components and blocks as source (219 components, 58 blocks); they read the same tokens.ComponentsBlocks
- CheckIt checks the screens against the design rules for your plan and fixes what fails.Design rules
What to say after connecting
Plan a booking app with LayQ: write the specs, set up the template, then build the booking page and check it against the rules.Without LayQ: the same thing by hand
- Write DESIGN.mdDecide and write down what the product is, the layout (columns, maximum width, navigation), colour roles (background, surface, text, muted, accent, danger), a type scale of three or four sizes, a spacing scale, corner radius, motion (durations, easing) and which component library to use.What is a DESIGN.md?
- Put the values in a tokens fileOne CSS file of variables, so the agent writes var(--space-4) instead of inventing 13px.
:root { --color-bg: #ffffff; --color-surface: #f4f5f7; --color-text: #15171a; --color-muted: #5d636b; --color-accent: #2f6fdf; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --radius-sm: 8px; --radius-lg: 16px; --text-sm: 14px; --text-md: 16px; --text-xl: 28px; --duration-fast: 150ms; --ease-out: cubic-bezier(0.2, 0, 0, 1); } - Add the rules as sentencesWrite what to do as sentences with values: “One filled button per screen; the others are outlined or text.” Borrow from the design rules.Design rules
- Point the agent at itIn Claude Code, import the spec from CLAUDE.md. In Cursor, add a project rule that always applies.CLAUDE.md
.cursor/rules/design.mdc# Design @DESIGN.md Read DESIGN.md before you change any screen. Use only the variables in styles/tokens.css; never write raw colours or pixel values.--- description: Design system alwaysApply: true --- Read DESIGN.md in the project root before you write UI. Use only the variables in styles/tokens.css. - Check the resultAsk the agent to compare each new screen with DESIGN.md and list what differs; with a browser MCP server it can look at the page itself.
Sources: code.claude.com/docs/en/memorycursor.com/docs/context/rulesgithub.com/google-labs-code/design.md
Questions
- Does Claude Code read DESIGN.md by itself?
- No. It reads CLAUDE.md (or AGENTS.md) at the start of a session. Add the line @DESIGN.md to CLAUDE.md and the spec loads with it.
- What is the difference between a design system and a component library?
- The library is the parts. The design system is the decisions: which parts, which colours, how much space, how things move. An agent with only parts still guesses the decisions.
- Does this work with Cursor too?
- Yes. Put a rule in .cursor/rules with alwaysApply: true that points at DESIGN.md, or use AGENTS.md, which Cursor reads too. LayQ has a setup for Cursor as well.