# DESIGN.md: how to write one your AI coding agent can build from

> What DESIGN.md is, how Google's open format (YAML tokens plus Markdown) works, and a seven-section spec, from Structure to Responsive, that tells a coding agent exactly what to build. With a template to copy.

Canonical page: <https://aymu.dev/blog/design-md-for-ai-agents>

Published 28 Nov 2026.

A `CLAUDE.md` holds the rules for the whole project: which tokens to use, which patterns are banned. That covers a
lot. But when you ask an agent to build one page or section, rules alone leave gaps. The agent knows what not to do,
but it still has to guess what to do.

A `DESIGN.md` fills that gap. It's a short spec in plain Markdown that describes one design clearly enough to build
from. The agent reads it before it writes code, and reads it again when it checks its work.

This post gives you a structure with seven sections. Each one is there because, without it, agents fill the space
with a certain kind of generic output.

## What DESIGN.md is (and Google's format)

`DESIGN.md` is a plain-text file that tells AI agents how a design should look. It sits in your repo next to the code,
like `README.md` or `CLAUDE.md`, so any agent can read it and you can review changes to it like code.

Google Labs turned the name into an open format. It started in [Google Stitch](https://stitch.withgoogle.com), where
a DESIGN.md lets you carry your design rules from one project to the next. In April 2026 Google
[open-sourced the draft spec](https://blog.google/innovation-and-ai/models-and-research/google-labs/stitch-design-md/) so
other tools can use it too. The spec and a small CLI live at
[google-labs-code/design.md](https://github.com/google-labs-code/design.md) under the Apache 2.0 license. The version is
still "alpha", and the repo says to expect changes.

Google's format has two layers. At the top, YAML front matter holds the design tokens: exact values for colors,
typography, rounded corners, spacing, motion and components. Below that, normal Markdown explains why those values
exist and how to use them. The tokens are the source of truth, and the prose gives the context. Here is a short example,
adapted from the spec:

```md
---
version: alpha
name: Daylight Prestige
description: Editorial design system with high-contrast neutrals.
colors:
  primary: "#1A1C1E"
  secondary: "#6C7278"
  tertiary: "#B8422E"
typography:
  h1:
    fontFamily: Public Sans
    fontSize: 48px
    fontWeight: 600
    lineHeight: 1.1
    letterSpacing: -0.02em
rounded:
  sm: 4px
spacing:
  md: 16px
components:
  button-primary:
    backgroundColor: "{colors.tertiary}"
    textColor: "#FFFFFF"
    rounded: "{rounded.sm}"
---

## Colors

The palette is rooted in high-contrast neutrals and a single accent color.
```

A few rules from [the spec](https://github.com/google-labs-code/design.md/blob/main/docs/spec.md): you must define at
least a `primary` color. `{colors.tertiary}` is a reference to another token. Sections use `##` headings, and you can
leave any of them out, but the ones you keep go in this order: Overview, Colors, Typography, Layout, Elevation & Depth,
Shapes, Motion, Voice & Content Strategy, Components, and Do's and Don'ts. The CLI checks your file for broken
references, low contrast and sections out of order:

```bash
npx @google/design.md lint DESIGN.md
```

It can also export your tokens to a Tailwind v4 `@theme` block (`export --format css-tailwind`) or to W3C design
tokens (`export --format dtcg`).

Shopify uses the same file name for themes. Its [DESIGN.md for themes](https://shopify.dev/docs/storefronts/themes/agentic-workflows/design-md)
sits at the theme root and explains why the theme looks the way it does. It's free-form Markdown with no required
outline, up to 50 KB. Shopify's Sidekick reads it before it makes design changes. Most local agents don't read it on
their own, so Shopify suggests pointing to it from `AGENTS.md`.

So how do our seven sections fit in? Google's format describes a design system: the brand, its colors, its fonts, its
buttons. Our sections describe one page or section built with that system: what goes where, how far apart, what moves
and what changes on a phone. You can use both. Put Google-style YAML tokens in the Tokens section below, or keep one
Google-format `DESIGN.md` at the root and a seven-section spec next to each section.

### Which one should you use?

- **Use Google's format** for your project-wide design system, especially if you use Stitch or want the linter and the
  Tailwind export.
- **Use the seven sections** when you ask an agent to build a specific page or section. Tokens alone don't say what
  the layout is, which states exist or what changes at each breakpoint.
- **On Shopify,** follow Shopify's guidance and keep one `DESIGN.md` at the theme root. Any outline works there,
  including either of these.

If you only write one, write the one for the thing you're building next. That's where agents guess the most.

## Where it lives

Put a `DESIGN.md` next to the thing it describes. For a whole site, use the project root. For a single section, use
its folder, like `src/components/sections/pricing/DESIGN.md`. Then add one line to `CLAUDE.md`:

```md
Before building or changing a page or section, read the DESIGN.md in its
folder (or the root DESIGN.md). Follow it exactly.
```

## 1. Structure

**What it stops:** the default layout. Without a structure, an agent goes for a centered heading over three equal
columns.

![Two cards: the default layout, a centered heading over three equal columns, crossed out; a written Structure with named parts ticked.](/blog/figures/design-md-for-ai-agents-1.png)

Describe the parts in order, top to bottom, and where they sit next to each other. Name every element. Say what's
not there, too.

```md
## Structure

1. Eyebrow, left-aligned, above the heading.
2. h2, left column (5 of 12 columns on desktop).
3. Right column (7 of 12): one large plan card, then two small plan rows.
4. Below the grid, one line of fine print and a text link to the FAQ.
   No icons. No comparison table. No "most popular" badge.
```

## 2. Measurements

**What it stops:** loose, uneven spacing. Agents pick spacing one element at a time, so gaps vary and nothing lines
up. [Spacing](/blog/spacing-makes-ai-sites-look-cheap) is a common reason a page feels cheap.

List the numbers: container width, section padding, gaps and sizes of key elements, at each breakpoint you care
about. Use your spacing scale or Tailwind classes, whichever your project uses.

```md
## Measurements

- Container: max-w-6xl, px-6 (mobile) / px-10 (desktop).
- Section: py-16 mobile, py-32 desktop.
- Heading to content: mt-6. Between plan rows: gap-4.
- Large card: p-10, rounded-2xl. Small rows: px-6 py-5, rounded-xl.
```

## 3. Type

**What it stops:** one default sans in three sizes. When you don't set the type, everything ends up in the same font,
and headings are just bigger body text.

Give the families, and for each text role give size, weight, line height and letter spacing.

```md
## Type

- Display: "Fraunces", 400. h2: 48px / 1.05, -0.02em (desktop), 36px mobile.
- Sans: "Inter", 400 and 500. Body: 17px / 1.6. Small: 14px / 1.5.
- Prices: display font, 56px / 1, tabular figures.
- Max line length for body text: 65ch.
```

If you haven't picked fonts yet, [the fonts post](/blog/fonts-that-dont-look-ai-generated) covers how.

## 4. Tokens

**What it stops:** made-up colors. Without named tokens, agents write raw hex values, often a purple, and each new
file adds another shade.

List the tokens this design uses and what each is for. Point to the theme file instead of repeating every value.

```md
## Tokens

From src/styles/theme.css:

- canvas: page background.
- surface: the large plan card.
- sunken: the small plan rows.
- ink: text and the primary button.
- muted: eyebrow, fine print, roles.
- accent: the primary button on the large card only.
```

If you want exact values the agent (and Google's linter) can read, add a YAML block in this section. Google's spec
allows token blocks inside a section, not only at the top of the file:

````md
## Tokens

```yaml
colors:
  primary: "#1B1B1F"
  canvas: "#F6F5F2"
  surface: "#FFFFFF"
  accent: "#2F5BEA"
```

- canvas: page background. surface: the large plan card.
- accent: the primary button on the large card only.
````

## 5. States and motion

**What it stops:** missing hover and focus states, and fade-up on everything. Agents tend to either skip states or
animate every element on scroll.

Describe every interactive element's states, and the only motion allowed.

```md
## States and motion

- Buttons: hover darkens one tone (120ms ease-out), active scale 0.98,
  focus-visible ring-2 ring-focus, disabled 50% opacity.
- Plan rows are links: hover changes background to surface.
- Billing toggle: the active pill glides to the selected option (200ms).
- No entrance animation in this section.
- prefers-reduced-motion: no movement, state changes only.
```

[The motion post](/blog/motion-that-feels-designed) has durations and easing curves you can reuse.

## 6. Assets

**What it stops:** filler images and missing files. An agent with no image will make up a blob or use a stock photo.
Give it an image path that doesn't exist, and it will leave a broken link.

List every image, icon and font file the design uses, with its path and purpose. If a real image is still to come,
say so clearly.

```md
## Assets

- fonts/Fraunces-Regular.woff2, fonts/Inter-Variable.woff2 (self-hosted).
- shots/plan-usage.png: cropped screenshot of the usage meter, 1200x800,
  on a sunken panel. To be captured; leave the <figure> with alt text.
- No icons in this section.
- No generated or stock images.
```

## 7. Responsive

**What it stops:** a desktop layout squeezed onto a phone. Agents often stack the columns and stop there. That
leaves huge headings, cramped padding and tap targets that are too small.

Say what changes at each breakpoint: order, sizes, what hides, what wraps.

```md
## Responsive

- Below lg: single column. Heading first, then the large card, then rows.
- Below sm: h2 36px, large card p-6, price 44px.
- Tap targets at least 44px tall.
- Nothing scrolls horizontally at 360px wide.
```

## The template

Copy this into a `DESIGN.md` and fill it in. Leave a section empty only if it really doesn't apply, and write "none"
so the agent knows it was a choice.

![The seven sections of a DESIGN.md as chips: Structure, Measurements, Type, Tokens, States and motion, Assets, Responsive.](/blog/figures/design-md-for-ai-agents-2.png)

```md
# <Page or section name>

One sentence: what this is for and who reads it.

## Structure

Parts in order, top to bottom. Columns and alignment. What is NOT there.

## Measurements

Container, section padding, gaps, element sizes. Mobile and desktop.

## Type

Families. For each role: size / line height, weight, letter spacing.

## Tokens

Token names from the theme file and what each one is used for here.

## States and motion

Hover, focus-visible, active, disabled for each interactive element.
The only motion allowed. Reduced-motion behavior.

## Assets

Every image, icon and font file: path, size, purpose. What is still
to come. What must not be added.

## Responsive

What changes per breakpoint: order, sizes, hidden items, tap targets.
```

## Use it in the loop

The spec is also a checklist. After the agent builds, paste:

```text
Compare the section you built with DESIGN.md, section by section. For each
measurement, type size and token, give the value in the spec and the value
in the code. Fix every mismatch, then take a screenshot at 390px and 1440px.
```

That's the start of [a screenshot, critique, fix loop](/blog/screenshot-critique-fix-loop). It works much better with
numbers to compare against than with a vague goal.

## Where specs come from

You can write a `DESIGN.md` from scratch, from a [reference you measured](/blog/give-claude-a-reference-not-adjectives),
or from a design you already have. Every Aymu [template](/templates) and [section](/sections) ships with an authored DESIGN.md
that uses these same seven sections.

![Cloudy template hero: a left headline with a sales dashboard card collage on a soft pink background](/blog/examples/cloudy.jpg)

*Example: [Cloudy](/templates/cloudy), a designed Astro template on Aymu.*

Write one today for the section you're building next. It doesn't take long, and it's the difference between the
agent guessing and the agent building what you described.
