Best Codex Prompts open the library

guide

Design rules in AGENTS.md

By the uberdesigner team · reviewed

Answer in brief

Put the design rules that apply to every task in an AGENTS.md file in the repository. Codex reads that file for instructions, so the stack, the tokens, the commands and the banned habits don't have to be repeated in each prompt. A good AGENTS.md is short, written as rules, and points to the files where the values live.

What AGENTS.md is for

AGENTS.md is a plain Markdown file of instructions for coding agents working in a repository. It plays the part a contributor guide plays for a new developer: how this project is built, what to run, what never to do. For where Codex looks for the file and how it treats more than one, check Codex's documentation.

For front-end work it solves one problem above all. Without it, each task makes its own small design decisions, and after ten tasks you have three greys and four button heights.

What to put in it

Write rules, not prose

Each line should be something the agent can obey or break. "We care about quality" is neither. "Every interactive element has a visible focus-visible state" is a rule. Keep the file to what you would actually enforce in review. A long file full of preferences buries the five rules that matter.

Keep values in one place

Don't copy the whole palette into AGENTS.md if it already lives in a tokens file. Point to the file and state the rule. Two copies of the same values drift apart, and the agent then has to guess which is right.

The stop rule deserves its own line: if a design needs a value that isn't in the system, the agent stops and says so. This one line prevents most of the slow drift.

Update it when a correction repeats

When you send the same follow-up twice, such as "use the Button component, don't write a new one", it belongs in AGENTS.md. The file is the memory of the project's decisions. Treat a repeated correction as a missing rule.

An example design rules block for AGENTS.md

AGENTS.md
# Front-end rules

## Stack and commands
- Vite + React + TypeScript (strict). Plain CSS with custom properties. No UI library, no CSS framework.
- Run before reporting a task as done: npm run typecheck, npm run lint, npm run test, npm run build.
- No new dependencies without asking first.

## Design values
- Every colour, font size, space, radius, shadow and duration comes from src/styles/tokens.css. No raw hex, px or seconds in component CSS.
- Type sizes: 12, 14, 16, 20, 28, 40, 64px. Spacing: 4, 8, 12, 16, 24, 32, 48, 72, 120px. Radius: 6px controls, 12px cards.
- One accent colour. It is for primary actions, links and focus only.
- If a design needs a value that is not in tokens.css, stop and ask. Do not add one quietly.

## Components
- Components live in src/components/Name/ as Name.tsx, Name.css, Name.test.tsx.
- Reuse Button, Input, Card and Dialog. Do not write a second version of an existing component.
- Every interactive component defines hover, focus-visible, pressed and disabled states.

## Accessibility and motion
- Focus-visible ring: 2px accent, 2px offset, on every interactive element.
- Text contrast at least 4.5:1. Touch targets at least 44px.
- Motion: 0.15s for colour changes, 0.3s for movement, ease-out. Only animate transform and opacity.
- With prefers-reduced-motion, remove movement and keep colour changes.

## Layout
- Desktop first. Below 720px: one column, no hover-only behaviour, no horizontal scroll at 390px.

## Do not add
- Gradient text, emoji, decorative icons, drop shadows on text, invented copy, invented numbers or testimonials, sample pages.

## Reporting
- End each task with: files changed, commands run and their results, what you could not verify, and decisions you made that the task did not specify.

Written for this page as a starting point; swap the parts in [brackets] for your own. The full prompt of each uberdesigner template is longer and specific to one finished design, and it is tested by rebuilding the template from the prompt alone.

Questions and answers

Does AGENTS.md replace the task brief?

No. AGENTS.md holds what is true for every task. The brief holds what is true for this one: the goal, the content, the files in scope and the checks. A brief that follows a good AGENTS.md is much shorter.

How long should AGENTS.md be?

Short enough that every line gets followed. One screen of rules is a good target for the front-end part. Link out to the tokens file and to longer documents and keep the rules themselves in the file.

Keep reading

Who makes this site

Best Codex Prompts is written and run by the ubernatural team, the designers who make uberdesigner. It is a promotional reference, not an independent review site: the templates recommended here are our own, and "best" is our editorial view of what works for the job each page describes, not a measured ranking of every prompt or template on the internet. This site is not affiliated with or endorsed by OpenAI. Codex is OpenAI's product.

Cite this page: Best Codex Prompts, “Design rules in AGENTS.md”. Reviewed 11 November 2026. https://bestcodexprompts.com/guides/agents-md-design-rules/