DESIGN.md: give your coding agent a design system so every page looks the same

Build Guides

DESIGN.md: give your coding agent a design system so every page looks the same

Fanned-out colour swatch cards in a gradient of reds, greens and blues
Photo by Viktorya Sergeeva 馃珎 on Pexels

DESIGN.md is an open format from Google Labs for describing your visual identity to coding agents: tokens for exact values, prose for the why. Here's how to write one, lint it, and export it to Tailwind.

In this article
  1. What it is
  2. A minimal DESIGN.md
  3. Lint it
  4. Diff versions
  5. Export to Tailwind or design tokens
  6. Wire it into your agent
  7. Tips

Ask an agent for five pages and you'll often get five slightly different shades of blue, three button styles and whatever font it felt like. DESIGN.md fixes that by putting your design system in one file every agent reads.

What it is

From the spec: DESIGN.md is "a self-contained, plain-text representation of a design system". The file has two layers:

  1. YAML design tokens, the exact values: colors, fonts, sizes, corners, spacing, components
  2. Markdown prose, the why: brand personality, when to use the accent color, what to avoid

In the README's words, "Tokens give agents exact values. Prose tells them why those values exist and how to apply them." The token system is inspired by the W3C Design Tokens format, including the {path.to.token} reference syntax. The spec version is currently "alpha".

A minimal DESIGN.md

Put this in your repo root as DESIGN.md:

---
version: alpha
name: Night Shift
colors:
  primary: "#111827"
  secondary: "#6B7280"
  tertiary: "#7C3AED"
  neutral: "#F9FAFB"
  on-tertiary: "#FFFFFF"
typography:
  h1:
    fontFamily: Inter
    fontSize: 3rem
    fontWeight: 700
    lineHeight: 1.1
  body-md:
    fontFamily: Inter
    fontSize: 1rem
    lineHeight: 1.6
rounded:
  sm: 6px
  md: 12px
spacing:
  sm: 8px
  md: 16px
components:
  button-primary:
    backgroundColor: "{colors.tertiary}"
    textColor: "{colors.on-tertiary}"
    rounded: "{rounded.sm}"
    padding: 12px
---

## Overview
Calm, focused developer tool. Dense but never cramped.

## Colors
- **Primary (#111827):** headlines and body text.
- **Tertiary (#7C3AED):** the only interactive color. Use it for buttons and links, nothing else.
- **Neutral (#F9FAFB):** page background.

## Do's and Don'ts
- Do use one primary button per screen.
- Don't introduce new colors; ask first.

The rules that matter

  • Section order: sections are optional, but the ones you include should follow this order: Overview, Colors, Typography, Layout, Elevation & Depth, Shapes, Components, Do's and Don'ts.
  • Token types: colors take any CSS color (hex is recommended), and dimensions use px, em or rem.
  • Components can use backgroundColor, textColor, typography, rounded, padding, size, height and width. Variants like hover are separate entries, e.g. button-primary-hover.
  • No duplicates: a duplicate section heading or top-level YAML key is an error.

Lint it

npx @google/design.md lint DESIGN.md

The linter runs eleven rules and returns JSON findings an agent can act on. Highlights:

Rule Severity Catches
broken-ref error references like {colors.primry} that point nowhere
contrast-ratio warning button text/background pairs below WCAG AA (4.5:1)
missing-primary warning no primary color, so agents will invent one
missing-typography warning no fonts defined, so agents will use defaults
orphaned-tokens warning colors no component uses
section-order warning sections out of order

It exits with code 1 on errors, so it can run in CI or in a Claude Code hook.

Windows: if the command does nothing or opens a Markdown editor, use npx -p @google/design.md designmd lint DESIGN.md.

Diff versions

npx @google/design.md diff DESIGN.md DESIGN-v2.md

This reports added, removed and modified tokens, and flags a regression (exit code 1) if the new version has more errors or warnings. It's useful when an agent "improves" your design system.

Export to Tailwind or design tokens

npx @google/design.md export --format css-tailwind DESIGN.md > theme.css         # Tailwind v4 @theme
npx @google/design.md export --format json-tailwind DESIGN.md > tailwind.theme.json  # Tailwind v3
npx @google/design.md export --format dtcg DESIGN.md > tokens.json               # W3C design tokens

Now your code and your agent read from the same source.

Wire it into your agent

Add a line to your AGENTS.md or CLAUDE.md:

For any UI work, read DESIGN.md first. Use only its tokens; don't invent colors,
fonts or spacing. Run `npx @google/design.md lint DESIGN.md` after editing it.

To give an agent the full format rules, npx @google/design.md spec prints the spec, ready to paste into a prompt.

Tips

  • Write the prose. Tokens alone tell an agent what; a sentence like "tertiary is the only interactive color" stops it putting purple everywhere.
  • Keep it short. It goes into context on every UI task.
  • Pin the CLI version in CI while the format is alpha.
  • Ask your agent to draft it from your existing CSS or Tailwind config, then lint and edit by hand.

Building your first app with an agent? Pair this with our prompt pack for shipping a web app and 10 copy-paste prompts.

FAQ

What is DESIGN.md?

A format specification for describing a visual identity to coding agents. One file combines machine-readable design tokens (YAML) with human-readable rationale (markdown), so agents get both exact values and the reasons behind them.

How is DESIGN.md different from AGENTS.md?

AGENTS.md tells an agent how to work in your project: commands, conventions, rules. DESIGN.md describes how the product should look. They work well together, with AGENTS.md pointing the agent to DESIGN.md for UI work.

Can I use DESIGN.md with Tailwind?

Yes. `npx @google/design.md export --format css-tailwind DESIGN.md` outputs a Tailwind v4 @theme block, and `--format json-tailwind` outputs a Tailwind v3 theme.extend object.

Why doesn't `npx @google/design.md` work on Windows?

The .md in the command name can collide with Windows' Markdown file association. The README suggests the dot-free alias: `npx -p @google/design.md designmd lint DESIGN.md`.

Is DESIGN.md stable?

Not yet. The spec's current version is labeled \"alpha\", so expect changes and pin the CLI version in CI.

Sources

  1. google-labs-code/design.md README (GitHub)https://github.com/google-labs-code/design.md
  2. DESIGN.md format specification (docs/spec.md)https://github.com/google-labs-code/design.md/blob/main/docs/spec.md

Newsletter

The Codema publication. Consent is required. You are not subscribed until you confirm from the email, and nothing is stored if email delivery is not connected.