Design system rules for AI coding agents: Claude Code, Cursor, Copilot
Short answer: an AI coding agent builds interfaces from what is common in the code it learned from. Common is not the same as right, and it is not the same from one session to the next. If you want an agent to make the same decisions your team would, about labels, errors, dialogs and buttons, you have to write those decisions down in a form it can follow: one decision per rule, a short statement that can be checked against code, a stable id, examples, exceptions, and a clear sign of how firmly to hold it.
This page explains why, and what such rules look like, with examples from Justified by Blackwood & Blake. For the steps to install its rules in Claude Code or another agent, see Use Justified with an AI agent.
What an agent does without rules
Section titled “What an agent does without rules”Ask an agent for a sign-up form and you get one quickly, and it usually looks right. Underneath, the agent has answered a dozen questions nobody asked it. Is the field named by a label or a placeholder? Does the email error appear on every key press, when the person leaves the field, or only on submit? Is the submit button disabled until the form is valid? Where does a server error go? Does the phone number field bring up the digit keypad, and does Enter send the form? Does Escape in the dialog throw away what was typed?
Without instructions, it answers them the way the code it learned from most often does. Much public example code is written for demos and tutorials, where the same shortcuts appear again and again: a placeholder instead of a label, an error in a toast, a submit button that stays disabled without saying why. An agent reproduces the average, with confidence and at speed.
Two more things make this harder than it is with people:
- The answers drift. Ask for the same form in two sessions, or in two parts of the same app, and you may get two different validation timings. Nothing in the code says which one is intended.
- The agent does not ask. A new developer who is unsure where an error goes might ask a designer. An agent picks something and moves on, and the choice looks as deliberate as every other line.
Why components are not enough
Section titled “Why components are not enough”A good component library helps. With shadcn, an agent gets a Dialog that already traps focus and a Checkbox with the right role. But a component says what it can do, not when or how to use it. A Button does not know whether it should be disabled, and a Dialog does not know whether a second dialog may open on top of it. Is shadcn accessible? goes through what shadcn’s Radix primitives handle and what they leave to your app, and Design system vs component library covers the difference in general.
What an agent needs on top of the components is the layer of decisions: behaviour rules.
What makes a rule usable by an agent
Section titled “What makes a rule usable by an agent”A rule written for people can lean on shared context and good judgement. A rule written for an agent cannot. These are the properties that make the difference, with examples from Justified’s rules.
One decision per rule
Section titled “One decision per rule”A rule that mixes several decisions gets applied halfway. Where an error is shown and when it is shown are two decisions, so they are two rules: FRM-002a says at the field, as text, and FRM-002b says after the person leaves a changed field or sends the form. An agent fixing one of them knows exactly which it is fixing.
A short statement that can be checked against code
Section titled “A short statement that can be checked against code”The heart of each rule is one to three sentences, at most about 60 words, that say what to do in terms an agent can verify. FRM-002b says to show a new error only when the person leaves the field after changing it or sends the form, never while they type, and to remove an error as soon as the value is valid. Given a form component, an agent can tell whether the code does that. “Validate at a sensible time” would give it nothing to check.
A stable id
Section titled “A stable id”Every rule has an id, such as FRM-002b or DLG-001, that never changes even when the wording does. Ids give the agent and the people around it a shared, short name. A review can say “breaks DLG-001” instead of describing the problem from scratch. A commit message can cite the rule it fixes. A person can say “follow DLG-003 here” and be understood.
Examples with real interface text
Section titled “Examples with real interface text”Each rule has Do and Don’t cases with concrete screens and the words on them: a Rename folder dialog, a Postcode field with the error “Enter a five-digit postcode, for example 11359”. An agent matches new work against examples like these more reliably than against a principle.
Exceptions written out
Section titled “Exceptions written out”Agents tend to apply a rule everywhere once they have it. Exceptions keep them from overdoing it. DLG-001, on Escape, says it does not cover a side panel that people work beside. STA-005b, a guideline (our choice) on double submits, says a search sent twice does no harm and needs no guard. Without those lines, an agent might add guards and Escape handlers where they only get in the way.
How firmly to hold it
Section titled “How firmly to hold it”Not every rule carries the same weight, and an agent should know which is which. Justified marks each text with its level and verdict:
- A requirement restates what a WCAG 2.2 Level AA criterion asks, such as FRM-007 on
autocompletevalues. If the person asks for something else, the agent does what they ask and says which criterion is involved. - A rule the judges decide is supported by all or most of the judges who spoke on it, such as DLG-003 on naming the destructive button. The agent follows it, and says so when asked to depart from it.
- A guideline is our own choice where the judges are split or fewer than two of them have spoken, such as ACT-004 on keeping a long form’s submit button enabled. The agent follows it only where the project has no convention of its own.
This is what lets an agent push back in proportion. It can mention a WCAG criterion when one is at stake, and stay quiet about a guideline when the team has chosen differently. The method explains how verdicts and levels are worked out.
A rule for when two apply
Section titled “A rule for when two apply”Rules meet. Justified states the order once: a rule that WCAG requires comes before other rules, a narrower rule before a wider one, and any rule before a guideline. An agent that finds two rules pulling in different directions does not have to guess.
One file per rule, and a short index
Section titled “One file per rule, and a short index”An agent’s context is limited, and every word of instruction competes with your code for it. So the rules come in two layers. A short index, as an AGENTS.md or a Claude Code skill, holds every rule as its one statement, a few thousand words in all. Each full rule, with its reasons, Do, Don’t and exceptions, is its own Markdown file that the agent opens only when its work touches that rule. The index tells it when to do that.
A version and a status
Section titled “A version and a status”Each rule has a version, a history and a status, decided or proposed, so an agent can treat a proposed rule as likely to change.
AGENTS.md and skills: where agents read rules
Section titled “AGENTS.md and skills: where agents read rules”Claude Code, Cursor and GitHub Copilot all read an AGENTS.md file in the project, and all three can load skills: a folder with a SKILL.md whose description tells the agent when to load the rest. That suits rules: the index loads when the work touches an interface, and full rules only when needed. All three also find skills in .claude/skills/, so one skill folder there serves every agent on the team.
According to each vendor’s documentation, read on 24 November 2026:
| Agent | Instructions | Skills in the project | Documentation |
|---|---|---|---|
| Claude Code | CLAUDE.md, or a repository’s AGENTS.md in its place |
.claude/skills/ |
Memory, Skills |
| Cursor | AGENTS.md in the root or a subfolder, or rules in .cursor/rules |
.cursor/skills/ or .agents/skills/, and .claude/skills/ for compatibility |
Rules, Skills |
| GitHub Copilot | AGENTS.md anywhere in the repository, where the nearest one wins, or .github/copilot-instructions.md |
.github/skills/, .claude/skills/ or .agents/skills/, in the Copilot features its documentation lists |
Repository instructions, Agent skills |
For agents that fetch from the web, Justified also publishes an llms.txt, a plain-text map of the site, and every rule as JSON. The how-to page has the commands.
Building and reviewing with the same rules
Section titled “Building and reviewing with the same rules”The same rules serve two jobs. When the agent builds, they shape the code it writes. When it reviews, they give it a checklist with names. A review that lists findings by rule id is easy to act on:
FRM-002b: the email field shows its error on every key press. Show it when the person leaves the field after changing it, or when they send the form.
DLG-003: the delete confirmation’s buttons say OK and Close. Label the action Delete project, and add a Cancel that closes the dialog with nothing changed.
Each id links to a page with the full rule and its verdict, so a developer who disagrees can see what the rule rests on and decide.
Justified’s review skill does this with a fixed report. Every rule also says what to look for in code, so the agent checks the same things each time instead of making up its own list.
Writing your own rules in this style
Section titled “Writing your own rules in this style”You can add house rules of your own next to Justified’s, or write a set from scratch. A rule an agent can follow usually has:
- An id that will not change.
- One decision, stated in one to three plain sentences, in terms that can be checked against code.
- A short reason, so the agent can explain the rule when someone asks.
- Two or three Do cases and Don’t cases, with real screen names and button labels.
- The exceptions, written as plainly as the rule.
- How firmly to hold it, and what to do when someone asks for something else.
- What to look for in code to find a break, and whether reading the code, running the page or a person finds it.
- A version and a date.
Keep every rule in its own file, keep an index of one line per rule, and tell the agent when to open the full text.
What rules cannot do
Section titled “What rules cannot do”Rules make an agent’s choices consistent and visible. They do not make its code correct. An agent can still misread a rule, miss a case, or write something that breaks it. Review what it produces, test with a keyboard and a screen reader, and test with real people.
Justified helps you work toward WCAG 2.2 AA. It does not make a product compliant on its own and is not a certification. Read the full statement
Start here
Section titled “Start here”- Browse the rules, grouped by area: forms, dialogs, buttons and more.
- Use Justified with an AI agent: install the skill or AGENTS.md.
- Use Justified with shadcn: add the components that already follow the rules.
Justified is an independent project. It is not affiliated with, sponsored or endorsed by the organisations whose guidance it cites. Read the full statement.
Apple is a trademark of Apple Inc., registered in the U.S. and other countries and regions.