DESIGN.md with Claude Code

Learn about AI Coding Agents and DESIGN.md
On this page

To make Claude Code use DESIGN.md, place the file in your repository root and reference it from CLAUDE.md (e.g. "Read DESIGN.md before generating any UI and follow its tokens exactly"). Claude Code then loads your design tokens and rules as context for every UI-related task.

That one instruction is the core of the setup. But the wording of the instruction, the size of your file, and how you verify the output decide whether Claude Code follows your design system or quietly improvises around it. This page covers all three.

If the format is new to you: DESIGN.md is an open-source file format from Google that stores a complete design system in a single Markdown file: machine-readable design tokens (colors, typography, spacing, components) in YAML frontmatter, plus human-readable rationale in Markdown prose. AI coding agents like Claude Code, Cursor, and Copilot read it to generate UI that consistently matches your brand. For background, read what DESIGN.md is; for the full format reference, see the DESIGN.md guide.

Quick setup#

  1. Put DESIGN.md in your repository root, next to CLAUDE.md and README.md. A minimal, spec-valid file looks like this:

    ---
    version: alpha
    name: Heritage
    colors:
      primary: "#1A1C1E"
      tertiary: "#B8422E"
      neutral: "#F7F5F2"
    typography:
      body-md:
        fontFamily: Public Sans
        fontSize: 1rem
        fontWeight: 400
        lineHeight: 1.6
    rounded:
      sm: 4px
    components:
      button-primary:
        backgroundColor: "{colors.tertiary}"
        textColor: "{colors.neutral}"
        rounded: "{rounded.sm}"
        padding: 12px
    ---
    
    ## Overview
    
    Architectural minimalism: deep ink text on warm limestone, with a single
    earthy red reserved exclusively for primary actions.
    
  2. Add the reference snippet to CLAUDE.md (full snippet below). Claude Code loads CLAUDE.md automatically at session start, so the instruction persists across sessions without re-prompting.

  3. Test it. Start a fresh session and prompt: "Build a settings page with a primary button and a form. Use only tokens from DESIGN.md." Then check the generated code for your exact values: in this example, a #B8422E button with #F7F5F2 text and a 4px radius. If you see a Tailwind default blue instead, the reference isn't working; see troubleshooting below.

Does Claude Code read DESIGN.md automatically?#

No. As of July 2026, Claude Code has no native DESIGN.md feature: it treats the file like any other Markdown in your repo. Google's Stitch is reported to consume the format natively, but coding agents like Claude Code, Cursor, and Copilot need an explicit pointer. For Claude Code, that pointer belongs in CLAUDE.md, which is loaded automatically; an AGENTS.md reference works the same way if you standardize on that file (see DESIGN.md vs CLAUDE.md and AGENTS.md).

Mechanically, DESIGN.md is plain context: the agent reads the file, and the YAML tokens plus prose rules inform every subsequent UI decision. The spec is built for exactly this: "the tokens are the normative values; the prose provides context for how to apply them."

Context has a cost, so file size matters. In our July 2026 analysis of all 74 files in the awesome-design-md collection, the median DESIGN.md weighs in around 7,050 tokens (546 lines), with the largest around 11,000. That is an affordable slice of a modern context window, but not free. In Atlassian's published test, a DESIGN.md file covered only about 30% of their large design system, while their MCP server and skills covered about 80%, and using the file as the sole source needed roughly 92% more tokens than the MCP approach. Their counterpoint: the file still gave them the best one-shot prototypes, taking output "from generic 'slop' to something recognizably Atlassian". Atlassian's own conclusion was that DESIGN.md suits high-level art direction, quick prototyping in unfamiliar environments, design-tool interoperability, and customer theming, and that MCP or skills give better results at lower cost when your agent supports them. The practical takeaway here: keep the file focused (see troubleshooting) rather than encyclopedic.

Copy this into your CLAUDE.md:

## Design system

- Before writing or modifying any UI code (components, styles, layouts,
  themes), read DESIGN.md in the repository root.
- The YAML frontmatter in DESIGN.md is the single source of truth for
  colors, typography, spacing, radii, and component styles. Use token
  values exactly as written: never approximate a color, font size, or
  spacing value, and never introduce new ones.
- If a value you need is not defined in DESIGN.md (for example a warning
  color or an extra radius step), do NOT guess or invent one. Stop and
  ask me which token to use or whether to add one.
- Treat the "Do's and Don'ts" section of DESIGN.md as hard constraints,
  not suggestions.
- After completing UI work, list which DESIGN.md tokens you used.

Each line targets a specific failure: the "before any UI code" trigger makes the read unconditional, "exactly as written" blocks near-miss approximations, the "ask, don't invent" rule prevents token fabrication when your file has gaps, and the closing self-report makes violations visible in the transcript instead of only in the rendered page.

How do you verify the output?#

Treat DESIGN.md as your acceptance spec, not just an input:

  • Lint the source of truth first. Run npx @google/design.md lint DESIGN.md. An ambiguous or broken file (unresolvable {token} references, contrast failures) gives the agent room to improvise. Exit code 0 means the agent's instructions are at least internally consistent.
  • Compare visually in the viewer. Paste your DESIGN.md into the DESIGN.md viewer to see your tokens rendered (palette, type scale, component styles) and hold the generated UI next to it. Mismatched values jump out faster in swatches than in code review.
  • Use screenshots in the loop. Claude Code accepts images, so screenshot the generated screen and prompt: "Compare this against DESIGN.md and list every deviation." The agent is good at catching its own drift when explicitly asked.

Troubleshooting#

SymptomLikely causeFix
Agent ignores tokens entirelyNo CLAUDE.md reference, or it's phrased as a suggestionUse the imperative snippet above; confirm CLAUDE.md is in the repo root and loaded (ask "what does DESIGN.md define?")
Agent invents colors for states you didn't defineToken fabrication: your file has gaps, the model fills themKeep the "ask, don't invent" rule; add the missing tokens (error, hover, focus) so there is nothing to fabricate
Styles degrade in long sessionsEarly context loses weight as the session growsRe-anchor: "Re-read DESIGN.md before continuing", or start a fresh session for new UI surfaces
File is huge and responses got slower or vaguerDESIGN.md well above the ~7k-token medianCut using lint findings: orphaned-tokens flags colors no component references (684 such tokens across 61 of the 74 community files); drop prose the agent can infer

Advanced: skills and subagents#

Two patterns worth adopting once the basics work; the specifics of skill and subagent configuration vary by Claude Code version, so treat these as patterns rather than exact recipes:

  • A design-system skill. Claude Code skills bundle instructions the agent loads when relevant. Packaging the snippet above plus a lint step into a skill (a SKILL.md that says "read DESIGN.md, apply tokens, run npx @google/design.md lint DESIGN.md on any change to it") keeps design rules out of your main CLAUDE.md while still enforcing them for UI tasks.
  • A design-review subagent. Have a subagent whose only job is review: it reads DESIGN.md, then checks a diff or screenshot against the tokens and the Do's and Don'ts, and reports deviations. Because it runs with fresh context, it isn't biased by the session that produced the UI.
  • Inject the spec itself. For agents that generate or edit DESIGN.md files, npx @google/design.md spec --rules outputs the format specification plus lint rules, useful context so the agent writes spec-valid YAML (well-formed token maps, valid component properties) instead of guessing the schema.

Same file, other tools: the point of the format is portability. The identical DESIGN.md works in Cursor via a rules file (see how to use DESIGN.md with Cursor) and in any tool that reads AGENTS.md.


Next step: paste your DESIGN.md into the free DESIGN.md viewer and check that what Claude Code will read matches what you think you shipped: broken references and contrast problems are cheaper to fix before the agent inherits them.

Frequently asked questions

Does Claude Code read DESIGN.md automatically?

No. As of July 2026, Claude Code has no built-in DESIGN.md support. It does load CLAUDE.md automatically at session start, so the reliable pattern is a CLAUDE.md instruction telling it to read DESIGN.md before any UI work. Google's Stitch is reported to consume the format natively; coding agents need the reference.

Where exactly should the file live?

Put DESIGN.md in the repository root, next to CLAUDE.md and README.md. That's where the ecosystem's tooling and examples expect it, and a root-level path resolves unambiguously. In a monorepo, keep one canonical file at the root, or state explicitly in CLAUDE.md which path each package's design file lives at.

How big can DESIGN.md be before it hurts?

In our July 2026 analysis of all 74 files in the awesome-design-md collection, the median file is roughly 7,000 tokens; the largest run about 11,000. That's affordable context, but if yours is well beyond the median, cut orphaned tokens and inferable prose before adding anything new.

Can I use multiple DESIGN.md files per app area?

The spec describes a single self-contained file, and one file keeps the agent's source of truth unambiguous. If areas of your app genuinely have distinct design systems, a practical workaround is one DESIGN.md per area with CLAUDE.md stating which paths each governs, but treat that as a workaround, not a spec feature.

Does this work in Claude Code web and desktop too?

The mechanism is just repository files, so it travels with your repo: any Claude Code surface that loads your project's CLAUDE.md picks up the reference and can read DESIGN.md. Quick check on any surface: ask the agent to name your primary color without opening the file for it.