DESIGN.md — portable visual system contract
Use this skill when a task touches Google Stitch's DESIGN.md format or
the project explicitly references its design system / design tokens. The
skill loads only when DESIGN.md exists at the project root (see
preconditions above), so general UI / frontend / component work that
isn't tied to a DESIGN.md won't trip it.
Source of truth
DESIGN.md is a contract file. Read it before changing visual UI.
- Treat YAML front matter tokens as normative values: colors, typography,
spacing, radius, and component tokens are exact inputs to code.
- Treat the Markdown body as design rationale: it explains mood, hierarchy,
interaction intent, and where tokens should or should not be used.
- If no
DESIGN.md exists this skill is inactive; for new UI, offer to
create one or ask for a brand/reference, but don't generate one
unprompted.
Default: read-only
Do not modify DESIGN.md unless the user explicitly asks for a design
system change. Implementation work consumes the contract; it does not
edit it. Token additions, renames, or section restructures land in their
own commit with a clear message and (ideally) a Stitch round-trip.
Implementation rules
- Map tokens into the local styling system already in use: CSS variables,
Tailwind theme values, design-token JSON, component props, or native
styles.
- Use token references and component patterns from
DESIGN.md instead of
hard-coded one-off values.
- Keep accessibility constraints intact. Do not weaken contrast, focus,
reduced-motion, or touch-target guidance unless the user explicitly
asks.
When an edit IS authorised
- Preserve unknown headings and extra prose; other agents or Stitch may
own them.
- Express component variants as related entries
(
button-primary, button-primary-hover, etc.).
- Land token / structure changes in their own commit, separate from the
feature consuming them.
Validation
If Node/npm tooling is available, lint with:
npx @google/design.md lint DESIGN.md
For design system changes, diff before/after:
npx @google/design.md diff DESIGN.before.md DESIGN.md
If the CLI is unavailable or network/dependency policy blocks it, the
manual fallback is best-effort only — check for broken {path.to.token}
references, missing primary color / typography tokens, duplicate section
headings, and section order. The CLI ALSO checks contrast ratios and
orphaned tokens; the manual fallback does not, so re-run the CLI when
you regain network access.
Expected sections
The Google draft spec uses YAML front matter plus Markdown sections.
Common sections:
## Overview
## Colors
## Typography
## Layout
## Elevation & Depth
## Shapes
## Components
## Do's and Don'ts
Self-rewrite hook
After every 5 uses OR on any failure:
- Read the last N skill-specific episodic entries.
- If a new failure mode has appeared (e.g. tokens drifting away from
DESIGN.md, accessibility rules being weakened, unauthorised edits to
the contract file), append it to this skill's
KNOWLEDGE.md.
- If a constraint was violated, escalate to
semantic/LESSONS.md.
- Commit:
skill-update: design-md, <one-line reason>.
1---2name: design-md3description: DESIGN.md — portable visual system contract4---56# DESIGN.md — portable visual system contract78Use this skill when a task touches Google Stitch's `DESIGN.md` format or9the project explicitly references its design system / design tokens. The10skill loads only when `DESIGN.md` exists at the project root (see11`preconditions` above), so general UI / frontend / component work that12isn't tied to a `DESIGN.md` won't trip it.1314## Source of truth15- `DESIGN.md` is a contract file. Read it before changing visual UI.16- Treat YAML front matter tokens as normative values: colors, typography,17 spacing, radius, and component tokens are exact inputs to code.18- Treat the Markdown body as design rationale: it explains mood, hierarchy,19 interaction intent, and where tokens should or should not be used.20- If no `DESIGN.md` exists this skill is inactive; for new UI, offer to21 create one or ask for a brand/reference, but don't generate one22 unprompted.2324## Default: read-only25**Do not modify `DESIGN.md` unless the user explicitly asks for a design26system change.** Implementation work consumes the contract; it does not27edit it. Token additions, renames, or section restructures land in their28own commit with a clear message and (ideally) a Stitch round-trip.2930## Implementation rules311. Map tokens into the local styling system already in use: CSS variables,32 Tailwind theme values, design-token JSON, component props, or native33 styles.342. Use token references and component patterns from `DESIGN.md` instead of35 hard-coded one-off values.363. Keep accessibility constraints intact. Do not weaken contrast, focus,37 reduced-motion, or touch-target guidance unless the user explicitly38 asks.3940## When an edit IS authorised411. Preserve unknown headings and extra prose; other agents or Stitch may42 own them.432. Express component variants as related entries44 (`button-primary`, `button-primary-hover`, etc.).453. Land token / structure changes in their own commit, separate from the46 feature consuming them.4748## Validation49- If Node/npm tooling is available, lint with:5051 ```bash52 npx @google/design.md lint DESIGN.md53 ```5455- For design system changes, diff before/after:5657 ```bash58 npx @google/design.md diff DESIGN.before.md DESIGN.md59 ```6061- If the CLI is unavailable or network/dependency policy blocks it, the62 manual fallback is best-effort only — check for broken `{path.to.token}`63 references, missing primary color / typography tokens, duplicate section64 headings, and section order. The CLI ALSO checks contrast ratios and65 orphaned tokens; the manual fallback does not, so re-run the CLI when66 you regain network access.6768## Expected sections69The Google draft spec uses YAML front matter plus Markdown sections.70Common sections:7172- `## Overview`73- `## Colors`74- `## Typography`75- `## Layout`76- `## Elevation & Depth`77- `## Shapes`78- `## Components`79- `## Do's and Don'ts`8081## Self-rewrite hook82After every 5 uses OR on any failure:831. Read the last N skill-specific episodic entries.842. If a new failure mode has appeared (e.g. tokens drifting away from85 DESIGN.md, accessibility rules being weakened, unauthorised edits to86 the contract file), append it to this skill's `KNOWLEDGE.md`.873. If a constraint was violated, escalate to `semantic/LESSONS.md`.884. Commit: `skill-update: design-md, <one-line reason>`.