Where to Find the Formal Specification for the DESIGN.md Format
The formal specification for the DESIGN.md format is located at docs/spec.md in the google-labs-code/design.md repository, defining the YAML front-matter schema, required markdown section hierarchy, and design token reference syntax.
The DESIGN.md format standardizes how design systems document tokens, components, and guidelines in human-readable markdown. If you are building tools that parse these files or authoring design system documentation, you need the authoritative schema that governs structure and validation. This guide identifies the exact location of the formal specification for the DESIGN.md format and details what it covers.
Location of the DESIGN.md Formal Specification
The canonical specification lives at docs/spec.md in the root of the repository. This document serves as the single source of truth for all DESIGN.md implementations, detailing the mandatory structure and parsing rules that compliant tools must enforce.
According to the google-labs-code/design.md source code, the specification defines:
- YAML front-matter schema – Valid keys, value types, and delimiters
- Section ordering rules – Mandatory sequence of markdown headings
- Token syntax – Reference patterns and validation logic
- Consumer behavior – How parsers handle unknown content, duplicates, and invalid values
Core Components Defined in the Specification
YAML Front-Matter Schema
The specification mandates an optional YAML block delimited by --- at the start of the file. This block declares design tokens including colors, typography, spacing, and component properties.
The schema supports typed tokens such as:
Color– Hex, RGB, or HSL valuesDimension– Pixels, rems, or ems for spacing and sizingTypography– Font family, size, weight, line height, and letter spacing
Token values can reference other tokens using the syntax {path.to.token}, enabling systematic aliasing and theming.
Required Section Hierarchy
DESIGN.md files must follow a strict heading order as defined in docs/spec.md:
- Overview
- Colors
- Typography
- Layout
- Elevation & Depth
- Shapes
- Components
- Do's and Don'ts
The specification details how parsers should treat unknown sections and enforce this sequence when validating files.
Component Token Structure
For component definitions, the spec outlines how to define variants and property token types. Components reference design tokens using the {namespace.token} syntax, allowing buttons, inputs, and other UI elements to inherit values from the global token system.
Practical Examples from the Specification
Front-Matter Implementation
The following YAML block demonstrates the required structure for declaring tokens:
---
version: alpha
name: Example System
colors:
primary: "#1A1C1E"
secondary: "#6C7278"
typography:
h1:
fontFamily: Public Sans
fontSize: 48px
fontWeight: 600
lineHeight: 1.1
letterSpacing: -0.02em
rounded:
sm: 4px
spacing:
base: 16px
components:
button-primary:
backgroundColor: "{colors.primary}"
textColor: "{colors.secondary}"
rounded: "{rounded.sm}"
padding: 12px
---
Markdown Body Structure
The markdown content must follow the required section order:
## Overview
The system conveys a modern, high-contrast brand identity focused on legibility and trust.
## Colors
- **Primary (#1A1C1E):** Core text and interactive elements.
- **Secondary (#6C7278):** Supporting UI components and borders.
## Typography
- **Headlines:** Public Sans Semi-Bold, 48 px.
- **Body:** Public Sans Regular, 16 px.
## Layout
A fluid grid with an 8 px spacing scale.
## Elevation & Depth
Uses tonal layers instead of heavy shadows.
## Shapes
All components use a 4 px corner radius.
## Components
Buttons, chips, lists, and inputs are defined with token references.
## Do's and Don'ts
- **Do** maintain WCAG AA contrast ratios.
- **Don't** mix rounded and sharp corners on the same screen.
These snippets obey the schema and section ordering defined in docs/spec.md, making them compatible with any tool implementing the DESIGN.md consumer logic.
Reference Files and Implementation Resources
Beyond the primary specification, the repository contains several authoritative resources:
docs/spec.md– The full formal specification containing normative definitions of tokens, sections, and parsing rulesREADME.md– General repository overview and quick start guideexamples/totality-festival/DESIGN.md– Real-world implementation demonstrating complete front-matter and section complianceexamples/paws-and-paths/DESIGN.md– Additional practical example showing variant component definitionspackages/cli/src/linter/fixtures/DESIGN-test.md– Test fixture used by the CLI linter to validate specification compliance and edge cases
Summary
- The formal specification for the DESIGN.md format is located at
docs/spec.mdin thegoogle-labs-code/design.mdrepository - It defines the YAML front-matter schema for design tokens and the mandatory markdown section hierarchy
- Token references use
{path.to.token}syntax with specific validation rules for resolution - Required sections follow the strict order: Overview, Colors, Typography, Layout, Elevation & Depth, Shapes, Components, and Do's and Don'ts
- Example implementations in
examples/totality-festival/DESIGN.mdand the CLI test fixture demonstrate compliant file structures
Frequently Asked Questions
What file contains the official DESIGN.md specification?
The official specification is located at docs/spec.md in the main branch of the google-labs-code/design.md repository. This document contains the normative definition of the format's schema, parsing rules, and validation requirements for both authors and tool builders.
What is the required section order in a DESIGN.md file?
According to the specification, sections must appear in this exact sequence: Overview, Colors, Typography, Layout, Elevation & Depth, Shapes, Components, and Do's and Don'ts. Parsers must handle unknown sections gracefully while enforcing this hierarchy for standard sections to ensure consistent document structure.
How do I reference design tokens in DESIGN.md front-matter?
Use the token reference syntax {path.to.token} within YAML values. For example, backgroundColor: "{colors.primary}" references the primary color token defined elsewhere in the front-matter. The specification in docs/spec.md details validation rules ensuring these references resolve to valid token definitions.
Are there example files that follow the DESIGN.md specification?
Yes, the repository includes compliant examples such as examples/totality-festival/DESIGN.md and examples/paws-and-paths/DESIGN.md. Additionally, the CLI linter uses packages/cli/src/linter/fixtures/DESIGN-test.md as a reference fixture for validating specification compliance and testing parser behavior.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →