Free

Google DESIGN.md: save design rules and export code values

Write a Google DESIGN.md with colours, fonts and sizes. Check CLI validation, exported code values and consistent use across two screens.

Tools

Getting started and checks · Format specification · CLI commands · Download source (ZIP)

Google DESIGN.md saves design rules for Codex to use in later tasks. One file contains colour, font and size values and explains their purpose. A separate command-line program validates the file and exports values for code.

What it is useful for

Suppose the assistant built a homepage, then chose different buttons and spacing for the next task. Saved rules provide a basis for the next screen. Ask it to read them first, then apply them to a form or list.

This is a document format and CLI, rather than a skill that appears automatically in Codex or an MCP. An ordinary DESIGN.md can still be useful as a note. Google's checks require the specified format, not just the filename. The format is alpha: save the previous file and review rule changes before updating.

Use UI UX Pro Max to choose a design or Design DNA to analyse an authorised reference. Google DESIGN.md stores decisions already made.

How to prepare the document and CLI

Ask Codex to find the existing DESIGN.md, brand guidelines and components. Preserve existing rules before proposing the required format. A text document alone does not require installing a new program.

  1. Choose two screens and shared elements. Have the assistant find actual code values and separate them from proposals.
  2. For machine validation, begin with a YAML block between --- lines. It holds named values such as colors.primary; explanations follow below. Use specification names for fields and structural sections, and write explanations in the project’s agreed language.
  3. The assistant checks Node.js, npm and any installed @google/design.md package. The checked version 0.4.0 requires Node.js 18 or later; verify the requirements of your chosen version. Agree separately on missing installations.
  4. Run lint, save its JSON report and investigate findings. For repeated project use, there is npm install @google/design.md. For one-off runs, the README suggests npx; this may also download a package and must not be treated as checking an already installed program.

The official designmd command also works on Windows, where design.md may open a Markdown editor:

npx -p @google/design.md designmd lint DESIGN.md
npx -p @google/design.md designmd diff DESIGN-before.md DESIGN.md

These commands are for the assistant: it should find actual paths and the saved previous version rather than ask you to create an example filename manually. Work needs project files and command execution. Otherwise, prepare the document and leave CLI execution as a separate action.

How to apply rules to two screens

Start with a button and field. Give the button a shared background and text colour; agree normal, focus and error states for the field. Avoid changing the entire design in one pass.

  1. Record chosen values in YAML and explain their roles below. Repeated values can reference {colors.primary} rather than use unrelated copies.
  2. Ask Codex to read the file before editing and apply rules through shared styles or components. DESIGN.md does not connect CSS to a site by itself.
  3. Test both screens with the same data: a long label, filled field, error and focus. If colour or spacing needs changing, update the shared rule and check both screens again.

The CLI has json-tailwind export for Tailwind v3 configuration and css-tailwind for v4 @theme, plus dtcg for exchanging design values. The assistant should choose the format for the existing project and save a separate output first. Review the diff before replacing a working theme with an export.

Where it is used

In the design system plan, saving rules, the format provides one document for future Codex work. Checking two screens verifies application of the rules as well as YAML correctness.

Continue to shared components. For a one-off change to an existing screen, compare Impeccable.

How to check results and fix errors

Read the field path, severity and message in the lint report. An undefined reference such as {colors.action} requires a value or corrected name. Investigate contrast warnings using the actual background and text pair. Exit code 0 means this validator found no errors; warnings may remain.

diff compares rule versions. Check separately which screens changed after application. Successful export does not replace lint: documentation allows exports to succeed despite source-file findings.

If Windows produces no report, use the designmd example. For ENOVERSIONS, the assistant should check the npm registry and project settings; do not change corporate mirrors or clear all caches without investigation. Fix format errors against the installed version's specification.

Check screens in a browser: keyboard navigation, long text in the project’s language, phone width and both themes if present. The CLI reads a document and does not confirm site-wide accessibility. The open repository uses Apache-2.0; model costs are separate.

The result is one agreed file, an understandable validation report and two screens using shared rules. Save the document with the code and repeatable check instructions. To undo changes, restore the required rule version and related component edits.

Prompt for Codex

Paste into Codex or Work with project access. Start with existing rules and code.

Help save and apply the current project's design rules in Google DESIGN.md format. Find the project, brand guidelines, existing DESIGN.md, shared components and accepted decisions. Read https://github.com/google-labs-code/design.md and its current docs/spec.md specification. Save the previous version, separate actual project values from proposals, and prepare one document in the project’s agreed language with the required YAML fields and explanations. Keep format field names as specified.
Check Node.js, npm and the @google/design.md CLI. Ask before a missing installation or npx download. If the CLI is available, run lint, save a separate JSON report, fix errors and explain remaining warnings. Compare with the previous rules using diff. Do not treat a successful export as a passing lint. After my choice, apply rules through shared components to two related screens, preserving working actions. Check them in a browser: text in the project’s language, long labels, keyboard navigation, field errors, 390-pixel width and both themes if present. Save rules, checked changes and continuation instructions. State the reason and remaining step if execution is unavailable.
In this article
Saved