What is a design.md file?
A design.md file is a single markdown document that describes a design system (colors, typography, spacing, components, and the rules that tie them together) in a way both humans and AI coding agents can read and apply consistently. The format was published by Google Labs.
The short answer
A design.md file has two layers stacked into one file:
- YAML frontmatter at the top, delimited by
---. This is the machine-readable part: every token (every color, every typography role, every component) is named and given a value here. - Markdown body below. This is the human-readable part: an editorial walk-through of the system, organized into a canonical sequence of sections.
Tokens defined in the frontmatter can be referenced anywhere in the file using a curly-brace syntax such as {colors.primary}, {rounded.lg}, {spacing.md}. That single rule is what lets an agent read both the values and the rationale from one source of truth.
Why design.md exists
Coding agents need persistent, structured context. A README tells an agent what a project does. A CLAUDE.md or .cursorrules tells it how to behave. There was no equivalent for the visual design of a product: the kind of information a designer keeps in Figma, a brand book, or a custom Tailwind config.
Without it, agents end up inventing colors, picking arbitrary typography, and producing UI that drifts from the brand on every generation. design.md closes that gap by giving the agent a file it can both read for intent and parse for exact values.
The frontmatter: tokens an agent can resolve
The YAML frontmatter contains five core token categories. Token names are kebab-case, color values are hex sRGB strings, and dimensions carry a unit (16px, 1.5rem, -0.02em).
---
version: alpha
name: "Acme Studio"
description: "A sober editorial workflow tool: white canvas, near-black ink, single-violet brand voltage on CTAs."
colors:
primary: "#533afd"
primary-active: "#4530e0"
canvas: "#ffffff"
surface-soft: "#f8fafd"
ink: "#061b31"
body: "#50617a"
on-primary: "#ffffff"
typography:
display-lg:
fontFamily: "sohne-var, 'SF Pro Display', sans-serif"
fontSize: "32px"
fontWeight: "300"
lineHeight: "1.1"
letterSpacing: "-0.02em"
body-md:
fontFamily: "sohne-var, 'SF Pro Display', sans-serif"
fontSize: "16px"
fontWeight: "400"
lineHeight: "1.5"
rounded:
sm: "4px"
DEFAULT: "6px"
md: "8px"
lg: "12px"
pill: "9999px"
spacing:
xs: "4px"
sm: "8px"
md: "16px"
lg: "24px"
section: "80px"
components:
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.on-primary}"
typography: "{typography.body-md}"
rounded: "{rounded.DEFAULT}"
padding: "10px 20px"
button-primary-active:
backgroundColor: "{colors.primary-active}"
textColor: "{colors.on-primary}"
rounded: "{rounded.DEFAULT}"
---Notice that button-primarydoesn’t hard-code its background color; it points at {colors.primary}. Change the brand color in one place and every component that references it follows. State variants (-active, -disabled, -focus) are separate top-level entries, not nested objects.
The body: editorial guidance an agent can read
Below the frontmatter, the markdown body uses a canonical sequence of ##-level sections. Each is optional individually, but if present they must appear in this order:
- Overview: the editorial summary: voice, mood, color philosophy, the single typographic move that defines the system.
- Colors: sub-grouped by role (Brand & Accent, Surface, Text, Hairlines, Semantic, plus any brand-specific palette).
- Typography: the type scale as a table, plus principles and a Note on Font Substitutes.
- Layout: spacing system, grid and container, whitespace philosophy.
- Elevation & Depth: the shadow vocabulary and the philosophy behind it.
- Shapes: border-radius scale and (when relevant) photography geometry.
- Components: every component from the frontmatter, described in prose, sub-grouped (Buttons, Cards, Inputs, Navigation, Sub-systems).
- Do’s and Don’ts: token-grounded rules that prevent the most common drift.
Inside the body, the same {colors.primary} reference syntax is used. Hex codes appear at most once next to their token reference, never duplicated downstream. That keeps the file consistent: every color mentioned in prose resolves to the same value the components use.
Linting: the format checks itself
The reference implementation ships a linter with seven rules:
broken-ref: every{token.path}must resolve. Misspelled or undefined references fail at error level.missing-primary: every system needs acolors.primary.missing-typography: typography block must be populated.contrast-ratio:on-*color pairs must meet WCAG AA against the surface they sit on.orphaned-tokens: tokens defined but never referenced are flagged.missing-sections: informational warning when canonical sections are absent.token-summary: informational rollup of how many tokens exist per category.
Run npx @google/design.md lint DESIGN.mdin CI to keep a project’s design system honest as it evolves.
How design.md compares to other agent files
| File | What it describes | Who reads it |
|---|---|---|
README.md | What the project is and how to run it | Humans, agents |
CLAUDE.md / .cursorrules | How an agent should behave in this repo | Agents |
design.md | The visual design system: tokens + rules | Designers, engineers, agents |
tokens.json (W3C DTCG) | Design tokens, machine-only | Tooling |
The closest neighbor is the W3C Design Tokens Community Group tokens.json format. The difference is that design.md bundles the tokens with the editorial rationale in a single file, so an agent can both look up a value and understand the design intent. The two formats can coexist: tokens.json as the build-tool input, design.md as the human + agent reference.
Tools and references
- github.com/google-labs-code/design.md is the canonical specification, schema, and reference linter.
- Stitch
design.mdspecification is Google’s hosted spec page. - awesome-design-md is a community registry of example files and tooling.
- getdesign.md is a third-party gallery of example design.md files for popular sites.
Generating a design.md from a live site
Hand-writing a design.md from scratch is doable but slow. Imitation reads any public URL, screenshots the page, extracts the live CSS, and writes a spec-compliant DESIGN.md: frontmatter, body, and extension sections for motion, imagery, icons, framework recommendations, responsive behavior, and known gaps. Paste a URL on the homepage to try it.
Frequently asked questions
What is a design.md file?
A design.md file is a single markdown document that captures a complete design system: colors, typography, spacing, radii, components, and the philosophy that ties them together. Tokens live in YAML frontmatter at the top of the file; narrative guidance lives in the markdown body. The format was designed so both humans and AI coding agents can read and apply the design consistently.
Who created the design.md format?
design.md was published by Google Labs. The reference repository, specification, and reference linter live at github.com/google-labs-code/design.md. The format is part of Google's broader effort to give coding agents persistent, structured context. It occupies the same niche as README.md for project overviews and CLAUDE.md for agent instructions.
What's inside a design.md file?
Two layers. The YAML frontmatter (delimited by --- at the top) holds machine-readable tokens: colors as hex codes, typography as objects with fontFamily and fontSize, a spacing scale, a rounded scale, and named components that compose those primitives. The markdown body explains the system in prose: an Overview, Colors, Typography, Layout, Elevation & Depth, Shapes, Components, and a Do's and Don'ts section.
How is design.md different from a regular style guide?
A traditional style guide is written for humans. design.md is written for both humans and agents. Token values are addressable via a curly-brace reference syntax (for example, {colors.primary}, {rounded.lg}, or {spacing.md}) that an agent can resolve programmatically. A linter checks for broken references, missing primary colors, contrast-ratio violations, and orphaned tokens. The result is a single file that an agent can both read for intent and parse for values.
What does the token reference syntax look like?
Tokens are referenced inside curly braces using dot notation: {colors.primary}, {rounded.sm}, {spacing.section}, {typography.body-md}, {component.button-primary}. References can appear inside the YAML frontmatter (so a button's backgroundColor can point to the primary color) and inside the markdown body (so prose can call out the same token by name). Every reference must resolve to a token defined in the same file.
Is design.md a standard?
It is an open specification published at version 'alpha' by Google Labs, released under an open-source license. It is not yet a W3C or ECMA standard, but the spec is stable enough to use in production. Several tools and registries, including getdesign.md and the awesome-design-md repository, have grown around it.
Can I generate a design.md from an existing website?
Yes. Imitation reads a live URL, captures a screenshot, extracts CSS data from the rendered DOM, and produces a spec-compliant DESIGN.md with the YAML frontmatter and full markdown body. Token references resolve against the frontmatter; component definitions enumerate state variants; and extension sections cover motion, imagery, icons, framework recommendations, responsive behavior, and known gaps. You can paste a URL on the homepage to try it.
What's the difference between design.md and CLAUDE.md or .cursorrules?
CLAUDE.md and .cursorrules are agent-instruction files: they tell an agent how to behave in your repository (which commands to run, which conventions to follow). design.md describes the visual design of a product. The two are complementary; many projects keep a CLAUDE.md at the repo root and a DESIGN.md in their design folder. design.md happens to be agent-friendly because of the YAML+prose structure, but its purpose is design specification, not agent instruction.