Articles

Designing a design system an AI can follow

If AI writes your code, a style guide it can ignore is no use. This is how to set up a design system that the code keeps honest, for any digital product.

November 2026

Why a style guide is not enough

Most products now have some of their code written by AI. Without written rules, every session invents its own spacing, corners and shadows, and the product slowly stops looking like one product.

A style guide typed by hand does not fix that. It is out of date a week after it is written, and nobody can tell which is right, the document or the code. An AI will read it, agree with it, and then do something else.

So set one test for your design system: whatever keeps things consistent has to work without anyone remembering to do it.

The four files

You need four things, and each has one job. This works for an app, a website or a dashboard, whatever it is built in.

  • •The theme - the one place a value is written. It lives in the product code, as a theme file or a set of CSS variables, so the product can never disagree with it.
  • •The tokens file - one file exported from the theme, usually JSON. Colours for light and dark, type, a spacing scale, corner sizes, and a version number.
  • •The design document, often called DESIGN.md - the principles, the voice, each token with a note on when to use it, and each component named after the code that implements it.
  • •The sync test - one command regenerates the tokens file and the values in the document. Run without it, the test fails and says which row is wrong.

The split matters. Values are generated, so they cannot drift. The notes on when to use a token are written by a person, so the test checks them and does not overwrite them.

If you have more than one surface, say an app and a website, each one takes the same tokens file and generates its own styles from it.

Learn the rules from the screens you like

Do not start with theory. Start with the three or four screens you have already built and are happy with, and write down what makes them work.

You should end up with a handful of principles, short enough to hold in your head. On one app we work on they came to five, such as "flat, with depth only on the one thing that matters" and "text sits in the same place on every card of a kind". If you have fifteen, you have a wish list.

Write every value once, and name it by purpose

A colour, a size or a text style is written in one place, the theme. Everything else is generated from it. Nobody types a value twice.

Name things for what they are for, not what they look like. Call it "text, muted" and not "grey 500". An AI told to use the muted text colour can find it. Given a hex value, it will invent a new one that is nearly the same.

Say when not to use it

A token with only a value tells an AI what exists. It does not tell it what to choose. So give every token a line on where it belongs, and the important ones a line on where it does not.

  • •The background colour is for every screen - never for a card sitting on top of it.
  • •The warning colour is for warnings - never for decoration.
  • •Dark mode comes from the tokens - never pick a dark colour by hand.
  • •In a screen, never write a raw number or a colour. Every value comes from the theme.

Mark what is true and what is hoped for

A design system always describes two things at once: what the product does today, and what you wish it did. People can tell the difference. An AI cannot, and it will apply a wish across the whole product.

So mark every rule the product does not follow yet as a proposal. Each one should end as adopted, dropped or still to build. Tell the AI, in the document, not to apply a proposal until it has been agreed.

Version it like software

Give the system a version number, and put the same number in the document, in the code and in any visual reference. A fix or a wording change is a patch. A new token or component is a minor version. A renamed or removed token is a major one.

Expect it to change a lot at first. One we built went through twenty versions in its first week, and almost every change came from a real screen. A fade behind a name was eased so the text kept enough contrast. Cards got their shadow back, because the artwork could be as pale as the background. Write one line for each change, saying why.

Let the code check the document

A written rule is only a request. So have the sync test fail the build when the document's values, its version, or a component it names no longer match the code.

Then link the document from the file your AI tool reads first. Whichever tool writes the code, the session should start from the same rules.

Where to start

You can do the first version in a day.

  • •Pick the three screens you are happiest with.
  • •Move their colours, sizes and type into one theme file, named by purpose.
  • •Export that theme to a tokens file.
  • •Write a short design document: the principles, when to use each token, and the don'ts.
  • •Add one test that fails when the document and the code disagree.
  • •Link the document from the file your AI reads first.

Keep the document short. It should point to where the rules live, not repeat them. Ours grew too long, and shortening it is our next job.