Design
A design system for AI: tokens, roles and a "never" list
How to build a design system an AI coding agent can follow: one source of truth, colour roles, few options, a "never" list and checks in the build.
A design system for AI is a short set of files that leaves the model nothing to guess: one source of truth for tokens, colours named by role, few options, a written “never” list, and checks that fail the build. Here is how ours works, with real code from the Smoketest template.
Current as of November 23, 2026. Code samples come from Smoketest 1.0.1 (Astro 7, Tailwind CSS 4). Tool versions and formats change, so check the linked docs before you copy anything.
When an AI coding agent edits a website, it makes design decisions. If you didn’t make them first, it fills the gaps with the most likely option. That is how sites end up with the same purple gradient and the same three cards.
In How to avoid AI slop on a website built with AI we called a design system the best fix and described it in one section. This article goes one level deeper: what the files contain, how the parts connect, and how to check that the model follows them.
A note on our interest: we sell Astro templates, and Smoketest, the free one, ships with the system described here. The examples are ours; the principles work in any project.
In short: five parts
- One source of truth. Every colour, type size, radius and spacing step is defined once, as a CSS variable. Everything else reads from it.
- Roles instead of colour names. Components use
text-inkandbg-accent, nottext-gray-900andbg-indigo-600. - Few options. Six colour presets, three font pairs, four radius sizes and a fixed type scale. Less choice means less drift.
- A “never” list. Written bans the agent reads before it edits: no raw hex in components, no Tailwind default palette, no values outside the tokens.
- Checks. A contrast check runs before every deploy. A person still looks at the result.
1. Why a style guide is not enough for AI
A style guide is written for people. It says “use our indigo for buttons” and trusts the reader to remember. An AI agent doesn’t remember between tasks, and it doesn’t fill gaps with your taste.
Anthropic calls the effect distributional convergence: models predict likely output, and safe, generic designs are the most common on the web. Without direction, the model picks from that average.[1]
So a design system for AI has to do three things a style guide doesn’t:
- Be machine-readable. Values live in code, not in a PDF.
- Make wrong choices hard. If an off-system colour is impossible or flagged, the agent can’t drift into it.
- Be checkable. A rule that nothing verifies is a suggestion. Our AGENTS.md article makes the same point: instruction files are advisory, and the build is the safety net.
2. One source of truth
In Smoketest, the whole look starts in one settings file. The chain runs in one direction:
src/site.config.tsholds the brand choices underbrand: a colour preset, a theme (light, dark or the visitor’s system setting) and a font pair. The layout writes them on the<html>element.src/styles/presets.cssholds the colour values: for each preset, a light and a dark block of eleven values.src/styles/tokens.cssdefines every role as a CSS variable: background, text, icon and line colours, radii, spacing and type sizes. Roles the preset doesn’t set are derived from it withcolor-mix().src/styles/tailwind.cssmaps those roles to Tailwind utilities:bg-surface,text-ink,bg-accent,border-line.- Components use only those utilities.
npm run validatereads the same two CSS files throughsrc/lib/palette.tsto check contrast.
The point of the chain: the agent never needs to write a colour value in a component. To rebrand the site it changes one setting, or the eleven values of one preset. And because the contrast check reads the same CSS files as the browser, the two can’t disagree.
Tokens in a standard format. If you share tokens between tools, the W3C Design Tokens Community Group published the first stable version of its format (2025.10) on October 28, 2025. It is a community group specification, not a W3C standard.[2] Google’s DESIGN.md, open-sourced in April 2026, pairs YAML tokens with plain-text reasons for each value.[3] For a single Astro site, CSS variables plus Tailwind are enough.
3. Roles instead of colour names
A colour name says what a colour looks like. A role says what it is for. An agent that sees indigo-600 has to guess where it belongs. An agent that sees bg-accent knows: button fills and active elements.
Smoketest uses three layers of design tokens:
- Preset values: eleven colours per preset and theme, such as the accent, five surfaces and three text colours.
- Roles:
--bg-*,--text-*,--icon-*and--line-*variables, with hover and disabled variants. The ones the preset doesn’t set are derived from it. - Utilities: Tailwind classes that read the roles. Components use only this layer.
Here is a real preset, the light theme of Forma, the template’s default:
/* src/styles/presets.css (Smoketest) */
:root,
:root[data-preset="forma"] {
--color-yellow-alpha-100: #5B3FE0; /* the accent; the name is historical */
--color-highlight: #C084FC;
--color-black-alpha-100: #1B1426;
--bg-main: #FFFFFF;
--bg-secondary: #F9F7FC;
--bg-tertiary: #EFEBFF;
--bg-additional: #E4DDFB;
--bg-reverse: #1B1426;
--text-main: #1B1426;
--text-secondary: #626A7D;
--text-accent: #5B3FE0;
}
And the roles the agent actually writes in components, from src/styles/tailwind.css:
| Role | Utility class | Used for |
|---|---|---|
--bg-main |
bg-surface |
Page background and cards |
--bg-secondary |
bg-surface-secondary |
Bands and quieter surfaces |
--bg-accent |
bg-accent |
Button fills, active states |
--bg-reverse |
bg-surface-reverse |
The contrast panel |
--text-main |
text-ink |
Body text |
--text-secondary |
text-ink-secondary |
Secondary text, captions |
--text-accent |
text-ink-accent |
Links, accent text |
--text-reverse |
text-ink-reverse |
Text on bg-accent and the contrast panel |
--line-secondary |
border-line-strong |
Stronger borders |
Why this helps AI. The dark theme is not a simple inversion: each preset has its own dark block. In Forma, the accent moves from #5B3FE0 to #6449EC and the page from white to #0E0B15. If components used raw values, the agent would have to know that. With roles, the same bg-accent text-ink-reverse works in both themes.
Allowed pairs, written down. The contrast check lists which text role is checked on which background: 13 pairs. For example, --text-tertiary is checked only on the page background, so it doesn’t belong on a tinted band. An agent can follow a list. It can’t follow a feeling.
4. Few options: scales the model can’t drift from
Every free choice is a place for the model to pick the average. So the system offers few choices, and each one is a whole set, not a single value.
| Setting | Options in Smoketest | What it controls |
|---|---|---|
| Colour preset | 6: forma, ocean, forest, ember, rose, graphite | Eleven colour values per theme |
| Theme | light, dark or system, with an optional switch in the navbar | Which block of the preset applies |
| Font pair | 3: geometric, editorial, technical | Heading and body fonts |
| Radius | 4 sizes: 6, 10, 16 and 24 px | Every rounded corner |
| Type scale | 4 heading and 5 body sizes | Every text size |
The trick with the presets. A preset is eleven values per theme, not a palette of fifty. The rest (the accent tints, lines, icons and tertiary text) is derived from those eleven with color-mix(). Change the accent, and every tint follows.
Steps, not pixel values. Spacing and type sizes are tokens that change at two breakpoints (768 and 1280 px), so the agent picks a step instead of inventing a size.
5. The “never” list
Roles tell the agent what to use. The “never” list tells it what not to do. Keep it short and concrete, so every line can be checked by eye or by code.
A list built on Smoketest’s rules and its contrast check, in the form an agent reads:
## Never
- Never use Tailwind's default palette (bg-blue-500, text-gray-700...). Use role classes only.
- Never write hex or rgb() colours in components. Colours live in src/styles/presets.css and tokens.css.
- Never add a colour, font size or radius that isn't a token.
- Never put text-ink-tertiary on a tinted band. It is only checked on the page background.
- Never call a visual change done before checking light, dark and a second preset.
- Never animate anything but transform and opacity.
- Never ship an interactive element without hover, active and focus-visible states.
Make the first rule physical. In Smoketest, tailwind.css removes Tailwind’s default palette with --color-*: initial, and does the same for fonts, text sizes and radii. Tailwind’s docs confirm that this removes utilities like bg-red-500 and leaves only your own.[4] A class like bg-blue-500 then produces no CSS at all.
But know the side effect. A removed class doesn’t break the build. The element simply loses its background, silently. That is why the rule is also written down, and why a person looks at the result (next section).
Add style bans too. The list above is about colour and safety. Our AI slop article has a second list about taste: no blue-purple gradients, no cards inside cards, no icon over every heading. Both belong in the same file.
6. Checks: automatic and by eye
Agents sometimes skip instructions. So the rules that matter most are also checks that run every time.
Automatic checks
Contrast by pairs, not by eye. npm run validate (check V22) resolves every colour of the chosen preset from the same CSS files the site uses and measures 13 text-and-background pairs, in the light theme and the dark one. Each pair needs 4.5:1, the WCAG minimum for normal text.[5] If one fails, validate stops with an error, and npm run deploy doesn’t deploy.
We ran the same check on all six presets in both themes: 156 checks, no failures. The weakest pair is the tertiary text on the page background in Forest’s light theme, at 4.82:1.
What it doesn’t cover. The check measures text. Borders, focus rings and icons need 3:1, the threshold WCAG 2.2 sets for user interface components,[6] and Smoketest doesn’t measure them: check those by eye, or add them to your own list of pairs.
A search for stray colours. Smoketest doesn’t need one, because the theme reset makes default palette classes produce nothing. If your project keeps Tailwind’s palette, add a search to your checks. Here is the pattern:
\b(bg|text|border|ring|from|via|to|fill|stroke)-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|neutral|stone)-\d{2,3}\b
Checks by eye
Code can’t judge taste. After any larger AI edit, look at four things:
- The page at a glance. Does it still look like your brand, or like a template demo?
- Both themes. Switch to dark mode. New sections often only get tested in light.
- Text over images. The contrast check covers tokens, not photos and gradients.
- New blocks. Did the agent reuse an existing component, or invent a new one?
What the check does not prove. It verifies token pairs, not the whole site. Run Lighthouse or axe on real pages as well.
7. Wiring it into AGENTS.md and CLAUDE.md
The system only helps if the agent finds it. The instruction file is the entry point, so it should point to the system, not copy it.
A short section is enough:
## Design system
- Brand settings: src/site.config.ts (brand.*). Change the look here, not in components.
- Colour values: src/styles/presets.css. Roles: src/styles/tokens.css.
- Components use the classes in src/styles/tailwind.css only: bg-surface, text-ink, bg-accent, border-line...
- Never list: see "Never" below. Read it before editing any component.
- After edits run `npm run validate` and fix every error.
Three reasons to keep it this way:
- No copied values. If the file repeats colour values, the copy goes stale the day someone changes a preset.
- A command, not a description. “Run validate” gives the agent a way to check itself. That works better than a paragraph about good contrast.
- Short. Our AGENTS.md article covers length and what to leave out.
Skills, if you use Claude Code. Anthropic suggests packaging a company’s design system into a skill, so the knowledge loads when it is relevant instead of sitting in every prompt.[1] Smoketest ships eight skills, among them one that sets the brand. The step-by-step workflow is in How to customize an Astro template with Claude Code.
Where this approach breaks
- Someone has to design it. If an AI generates the system from its own defaults, you lock the average in. The tokens need a person with taste.
- It controls tokens, not composition. Layout, hierarchy and copy still drift. The “never” list helps; it doesn’t replace review.
- Agents still ignore rules sometimes. That is why the important rules are checks, and why a person looks at the result.
- Tooling is young. DESIGN.md is new, and the W3C token format only reached its first stable version in October 2025.[2, 3] Expect formats to change.
- It takes work up front. Roles, presets and a check have to be designed and tested before they save time. For a one-page test, a ready-made template is the faster route.
Summary
A design system for AI is not a bigger style guide. It is a small set of files that leaves the model no gaps: values defined once, colours named by role, few options, a written “never” list, and checks in the build. The model still writes the code. It just can’t invent the look.
If you build your own, start with roles and the contrast check. Those two remove most of the drift. Add the “never” list as you catch the agent’s habits.
Want to start from a system that already exists?
Smoketest is free under the MIT licence and ships with everything in this article: role tokens, six presets, the contrast check, AGENTS.md, CLAUDE.md, DESIGN.md and eight skills for Claude Code and Cursor.[7] Our paid templates, such as Nodezy for AI products, are built for specific types of sites. Questions: hello@shipthemes.com.
Frequently asked questions
What is a design system for AI?
A set of machine-readable files that define a site’s look: design tokens, roles for colours, allowed combinations, a list of bans and automatic checks. It exists so an AI coding agent doesn’t have to guess design decisions.
What are design tokens?
Named values for colours, fonts, spacing, radii and shadows, defined in one place. In an Astro and Tailwind project they are usually CSS variables exposed as utility classes.
Do I need DESIGN.md or the W3C token format?
Not for one site. They help when tokens move between tools, such as from a design tool to code. For a single Astro project, CSS variables plus Tailwind’s @theme do the job.[3, 4]
Will rules alone stop AI from changing my design?
No. Rules in AGENTS.md or CLAUDE.md are advice the agent can skip. Rules that matter should also be checks that fail the build, and a person should look at larger edits.
How many colours should the system have?
As few as your pages need. Each Smoketest preset sets eleven colour values per theme; every other colour role is derived from them, and components can’t use anything else.
Can I add this to an existing template?
Yes, in steps: move colours into variables, rename them by role, remove the default palette, then add the contrast check. Expect the first step to touch every component.
Sources
Pages checked on November 23, 2026.
- Anthropic, Improving frontend design through Skills
- W3C Design Tokens Community Group, Design Tokens specification reaches first stable version (October 28, 2025)
- The Decoder, Google’s open-source DESIGN.md gives AI agents a prompt-ready blueprint (April 23, 2026)
- Tailwind CSS, Theme variables
- W3C WAI, Understanding SC 1.4.3: Contrast (Minimum) (WCAG 2.2)
- W3C WAI, Understanding SC 1.4.11: Non-text Contrast (WCAG 2.2)
- ShipThemes, Smoketest