design.md
A file-format specification and CLI/library from Google Labs for describing a design system to coding agents. A DESIGN.md combines machine-readable design tokens (YAML front matter) with human-readable rationale (markdown prose), and the tooling lints, diffs, and exports those tokens to formats like Tailwind and W3C DTCG.
Apache-2.0Permissive — free to use in commercial and proprietary software, with attribution.View license →
Production readiness
4/5- Actively maintainedCommits in the last 6 months
- No known vulnerabilitiesNot yet scanned
- Clear, usable licenseApache-2.0 (permissive)
- Proven adoptionWidely used
- Has documentationDocumentation indexed
npm install design.mdOur analysis
DESIGN.md is a Markdown-based format spec (plus an npm CLI and linter library) for encoding a brand's visual identity—colors, typography, spacing, components—as design tokens that AI coding agents can read and apply consistently.
When to use design.md
Use it when you want a single, version-controllable source of design truth that coding agents (and humans) can consume to generate on-brand UIs, when you need to lint token references and WCAG contrast, diff design-system versions in CI, or export tokens to Tailwind v3/v4 or DTCG.
When not to
Skip it if you already maintain tokens in a mature pipeline like Style Dictionary or Tokens Studio, if you don't work with AI agents and just need runtime theming, or if you need a stable production format—the spec is explicitly alpha and subject to breaking changes.
Strengths
- Pairs machine-readable tokens with prose rationale, giving agents the 'why' behind values, not just numbers
- Built-in linter checks broken references, WCAG contrast, orphaned tokens, and section ordering
- Exports to widely used targets (Tailwind v3 config, Tailwind v4 CSS @theme, W3C DTCG)
- Token model is inspired by the W3C Design Token standard, aiding interoperability
- Both CLI and programmatic API; stdin support fits CI and agent pipelines
Trade-offs
- Explicitly alpha—format, schema, and CLI are unstable and expected to change
- Value is largely tied to agent workflows; limited benefit for teams not using coding agents
- No vulnerability rewards program coverage and a Google-Labs experimental posture suggest no support guarantees
- Narrow scope: it standardizes/describes tokens but doesn't render components or enforce them at runtime
Maturity
Version 'alpha' under active development by Google Labs, published on npm as @google/design.md. High star count signals strong early interest, but the spec is unstable and positioned as experimental rather than production-ready.
DESIGN.md
A format specification for describing a visual identity to coding agents. DESIGN.md gives agents a persistent, structured understanding of a design system.
The Format
A DESIGN.md file combines machine-readable design tokens (YAML front matter) with human-readable design rationale (markdown prose). Tokens give agents exact values. Prose tells them why those values exist and how to apply them.
---
name: Heritage
colors:
primary: "#1A1C1E"
secondary: "#6C7278"
tertiary: "#B8422E"
neutral: "#F7F5F2"
typography:
h1:
fontFamily: Public Sans
fontSize: 3rem
body-md:
fontFamily: Public Sans
fontSize: 1rem
label-caps:
fontFamily: Space Grotesk
fontSize: 0.75rem
rounded:
sm: 4px
md: 8px
spacing:
sm: 8px
md: 16px
---
## Overview
Architectural Minimalism meets Journalistic Gravitas. The UI evokes a
premium matte finish — a high-end broadsheet or contemporary gallery.
## Colors
The palette is rooted in high-contrast neutrals and a single accent color.
- **Primary (#1A1C1E):** Deep ink for headlines and core text.
- **Secondary (#6C7278):** Sophisticated slate for borders, captions, metadata.
- **Tertiary (#B8422E):** "Boston Clay" — the sole driver for interaction.
- **Neutral (#F7F5F2):** Warm limestone foundation, softer than pure white.
An agent that reads this file will produce a UI with deep ink headlines in Public Sans, a warm limestone background, and Boston Clay call-to-action buttons.
Getting Started
Validate a DESIGN.md against the spec, catch broken token references, check WCAG contrast ratios, and surface structural findings — all as structured JSON that agents can act on.
npx @google/design.md lint DESIGN.md
{
"findings": [
{
"severity": "warning",
"path": "components.button-primary",
"message": "textColor (#ffffff) on backgroundColor (#1A1C1E) has contrast ratio 15.42:1 — passes WCAG AA."
}
],
"summary": { "errors": 0, "warnings": 1, "info": 1 }
}
Compare two versions of a design system to detect token-level and prose regressions:
npx @google/design.md diff DESIGN.md DESIGN-v2.md
{
"tokens": {
"colors": { "added": ["accent"], "removed": [], "modified": ["tertiary"] },
"typography": { "added": [], "removed": [], "modified": [] }
},
"regression": false
}
The Specification
The full DESIGN.md spec lives at docs/spec.md. What follows is a condensed reference.
File Structure
A DESIGN.md file has two layers:
YAML front matter — Machine-readable design tokens, delimited by
---fences at the top of the file.Markdown body — Human-readable design rationale organized into
##sections.
The tokens are the normative values. The prose provides context for how to apply them.
Token Schema
version: <string> # optional, current: "alpha"
name: <string>
description: <string> # optional
colors:
<token-name>: <Color>
typography:
<token-name>: <Typography>
rounded:
<scale-level>: <Dimension>
spacing:
<scale-level>: <Dimension | number>
components:
<component-name>:
<token-name>: <string | token reference>
Token Types
TypeFormatExampleColorAny CSS color (hex, rgb(), oklch(), named, etc.)"#1A1C1E", "oklch(62% 0.18 250)"Dimensionnumber + unit (px, em, rem)48px, -0.02emToken Reference{path.to.token}{colors.primary}Typographyobject with fontFamily, fontSize, fontWeight, lineHeight, letterSpacing, fontFeature, fontVariationSee example above
Section Order
Sections use ## headings. They can be omitted, but those present must appear in this order:
#SectionAliases1OverviewBrand & Style2Colors3Typography4LayoutLayout & Spacing5Elevation & DepthElevation6Shapes7Components8Do's and Don'ts
Component Tokens
Components map a name to a group of sub-token properties:
components:
button-primary:
backgroundColor: "{colors.tertiary}"
textColor: "{colors.on-tertiary}"
rounded: "{rounded.sm}"
padding: 12px
button-primary-hover:
backgroundColor: "{colors.tertiary-container}"
Valid component properties: backgroundColor, textColor, typography, rounded, padding, size, height, width.
Variants (hover, active, pressed) are expressed as separate component entries with a related key name.
Consumer Behavior for Unknown Content
ScenarioBehaviorUnknown section headingPreserve; do not errorUnknown color token nameAccept if value is validUnknown typography token nameAccept as valid typographyUnknown component propertyAccept with warningDuplicate section headingError; reject the file
CLI Reference
Installation
npm install @google/design.md
On Windows, quote the package name if your shell treats @ specially (PowerShell, some terminals):
npm install "@google/design.md"
Or run directly (always resolves from the public npm registry):
npx @google/design.md lint DESIGN.md
npm error ENOVERSIONS (“No versions available for @google/design.md”)
The CLI is published as @google/design.md on npm. ENOVERSIONS almost always means npm is not querying the public registry (custom registry= in .npmrc, a corporate mirror that has not synced this package, or a misconfigured @google:registry for the @google scope).
Check your effective registry:
npm config get registry
For a normal install from the internet it should be https://registry.npmjs.org/. After fixing config, retry with npm cache clean --force if a stale 404 was cached.
All commands accept a file path or - for stdin. Output defaults to JSON.
Windows tip: when invoking the CLI directly from a
package.jsonscript (rather than throughnpx), use thedesignmdalias instead ofdesign.md. The.mdsuffix in the original bin name confuses Windows command resolution with the file association for Markdown files. Thedesignmdshim resolves to the same entrypoint and works identically across all platforms.// package.json { "scripts": { "design:lint": "designmd lint DESIGN.md" } }
lint
Validate a DESIGN.md file for structural correctness.
npx @google/design.md lint DESIGN.md
npx @google/design.md lint --format json DESIGN.md
cat DESIGN.md | npx @google/design.md lint -
OptionTypeDefaultDescriptionfilepositionalrequiredPath to DESIGN.md (or - for stdin)--formatjsonjsonOutput format
Exit code 1 if errors are found, 0 otherwise.
diff
Compare two DESIGN.md files and report token-level changes.
npx @google/design.md diff DESIGN.md DESIGN-v2.md
OptionTypeDefaultDescriptionbeforepositionalrequiredPath to the "before" DESIGN.mdafterpositionalrequiredPath to the "after" DESIGN.md--formatjsonjsonOutput format
Exit code 1 if regressions are detected (more errors or warnings in the "after" file).
export
Export DESIGN.md tokens to other formats.
npx @google/design.md export --format json-tailwind DESIGN.md > tailwind.theme.json
npx @google/design.md export --format css-tailwind DESIGN.md > theme.css
npx @google/design.md export --format dtcg DESIGN.md > tokens.json
OptionTypeDefaultDescriptionfilepositionalrequiredPath to DESIGN.md (or - for stdin)--formatjson-tailwind | css-tailwind | tailwind | dtcgrequiredOutput format
FormatOutputDescriptionjson-tailwindJSONTailwind v3 theme.extend config objectcss-tailwindCSSTailwind v4 @theme { ... } block with CSS custom propertiestailwindJSONAlias for json-tailwinddtcgJSONW3C Design Tokens Format Module
spec
Output the DESIGN.md format specification (useful for injecting spec context into agent prompts).
npx @google/design.md spec
npx @google/design.md spec --rules
npx @google/design.md spec --rules-only --format json
OptionTypeDefaultDescription--rulesbooleanfalseAppend the active linting rules table--rules-onlybooleanfalseOutput only the linting rules table--formatmarkdown | jsonmarkdownOutput format
Linting Rules
The linter runs nine rules against a parsed DESIGN.md. Each rule produces findings at a fixed severity level.
RuleSeverityWhat it checksbroken-referrorToken references ({colors.primary}) that don't resolve to any defined tokenmissing-primarywarningColors are defined but no primary color exists — agents will auto-generate onecontrast-ratiowarningComponent backgroundColor/textColor pairs below WCAG AA minimum (4.5:1)orphaned-tokenswarningColor tokens defined but never referenced by any componenttoken-summaryinfoSummary of how many tokens are defined in each sectionmissing-sectionsinfoOptional sections (spacing, rounded) absent when other tokens existmissing-typographywarningColors are defined but no typography tokens exist — agents will use default fontssection-orderwarningSections appear out of the canonical order defined by the specunknown-keywarningA top-level YAML key looks like a typo of a known schema key (e.g. colours: → colors:); custom extension keys stay silent
Programmatic API
The linter is also available as a library:
import { lint } from '@google/design.md/linter';
const report = lint(markdownString);
console.log(report.findings); // Finding[]
console.log(report.summary); // { errors, warnings, info }
console.log(report.designSystem); // Parsed DesignSystemState
Design Token Interoperability
DESIGN.md tokens are inspired by the W3C Design Token Format. The export command converts tokens to other formats:
Tailwind v3 config (JSON) —
npx @google/design.md export --format json-tailwind DESIGN.md— emits atheme.extendJSON object fortailwind.config.js.--format tailwindis a backwards-compatible alias.Tailwind v4 theme (CSS) —
npx @google/design.md export --format css-tailwind DESIGN.md— emits a CSS@theme { ... }block using Tailwind v4's CSS-variable token namespaces (--color-*,--font-*,--text-*,--leading-*,--tracking-*,--font-weight-*,--radius-*,--spacing-*).DTCG tokens.json (W3C Design Tokens Format Module) —
npx @google/design.md export --format dtcg DESIGN.md
Status
The DESIGN.md format is at version alpha. The spec, token schema, and CLI are under active development. Expect changes to the format as it matures.
Disclaimer
This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.
On this page
- DESIGN.md
- The Format
- Getting Started
- The Specification
- File Structure
- Token Schema
- Token Types
- Section Order
- Component Tokens
- Consumer Behavior for Unknown Content
- CLI Reference
- Installation
- npm error ENOVERSIONS (“No versions available for @google/design.md”)
- lint
- diff
- export
- spec
- Linting Rules
- Programmatic API
- Design Token Interoperability
- Status
- Disclaimer