⚡ PromptLoot

Home › Coding & Cursor Rules

DESIGN.md UI Rules: Stop Agents Reverting Your Layout Fixes

A DESIGN.md and rules block that records locked UI decisions, so Claude Code, Codex, and Cursor stop undoing alignment, spacing, and style fixes you made.

Added

Save this as DESIGN.md in the repo root and add this line to AGENTS.md (or CLAUDE.md / an alwaysApply .cursor/rules file):
"Read DESIGN.md before changing any UI. Never change a LOCKED item unless my message names it."

# DESIGN.md

## Design tokens (use these, never raw values)
- Colors: [primary #...], [surface #...], [text #...], [muted #...], [danger #...]
- Font: [family], sizes [14/16/20/28], weights [400/600]
- Spacing scale: [4, 8, 12, 16, 24, 32] px. Radius: [8] px. Max content width: [1100] px.
- Where they live: [path to tailwind config / CSS variables / theme file]

## Layout conventions
- Text alignment: [left-aligned everywhere except numbers in tables, which are right-aligned]
- Navigation: [top bar on desktop, bottom tabs on mobile]
- Forms: [labels above inputs, one column, primary button bottom-left]
- Reuse components from [components/ui/]; do not create a new button, card, or modal style.

## LOCKED decisions (fixed on purpose; do not "improve")
Add a line every time you fix the same UI problem twice.
- [YYYY-MM-DD] [Element]: [what it must be]. Why: [reason]. Reverted before: [yes/no]
- e.g. 2026-11-17 Pricing table: left-aligned text, not centered. Why: long plan names wrap badly. Reverted before: yes (3x)

## Before any UI change, the agent must
1. Check whether the element is in LOCKED or covered by a convention above. If yes and my request doesn't name it, leave it alone.
2. If a LOCKED rule seems wrong for the task, stop and ask; don't silently change it.
3. Run `git log -L` or `git blame` on lines you're about to restyle; if a recent commit message says it was a deliberate fix, keep it.
4. Use tokens and existing components only.
5. After the change, list every visual property you changed (element, before, after).

## When a fix gets reverted again
Prompt: "This fix was reverted. Find which change undid it and why, add a LOCKED line to DESIGN.md with the reason, and propose a check (test, lint rule, or screenshot) that would catch it next time."

How to use it

  1. Click Copy template.
  2. Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
  3. Replace the [BRACKETED] parts with your details.

Pairs well with: AI Agent Harness Starter Pack: Rules, Hooks, Status & Verify

Sponsor this page · Reach builders who use AI daily. Get details

FAQ

Why does my AI coding agent keep undoing UI fixes?

Each new session starts without memory of why a layout is the way it is. If the fix isn't written down, the agent sees an unusual choice, such as right-aligned columns or a non-standard button position, and 'corrects' it back to a common default. Recording the decision and the reason in DESIGN.md gives it that missing context.

What is DESIGN.md?

A plain Markdown file in the repo that describes your design system: tokens, layout conventions, components to reuse, and locked decisions. Claude Code, Codex, Cursor, and Gemini CLI can all read it when your AGENTS.md or CLAUDE.md points to it.

Should UI rules go in AGENTS.md or a separate file?

Keep a one-line pointer in AGENTS.md or CLAUDE.md and the details in DESIGN.md. That keeps the main rules file short, and the agent only loads the design details when it works on UI.

How do I make a UI decision stick for good?

Write it as a LOCKED line with the reason, then back it with something the agent can't ignore: a component that hard-codes the style, a lint rule, or a visual regression or screenshot test. Rules files are guidance; tests are enforcement.

Get 3 new templates every week

Free. Unsubscribe anytime.

Related templates

Design SKILL.md: Stop Your Vibe-Coded Site Looking AI-Made

A SKILL.md you drop into Claude Code, Codex, or Cursor so AI-built landing pages stop looking generic: a real design system, banned defaults, and a self-review before it ships.

Wireframe-First UI Brief: Plan Screens Before Vibe Coding

A prompt that has Claude Code, Cursor, Codex, or Lovable sketch rough text wireframes and screen states first, so you pick a layout before any code locks it in.

This Codebase Is Yours: Ownership Rules for Coding Agents

Rules-file lines that tell Claude Code, Codex, or Cursor it owns the code, so it edits and removes code instead of bolting on duplicate functions and wrappers.

Rules File Drift Check: Is Your AGENTS.md Lying to the Agent?

A prompt that checks CLAUDE.md, AGENTS.md, GEMINI.md, and Cursor rules against the real code and against each other, and flags stale or contradictory lines before your agent follows them.

Browse all Coding & Cursor Rules templates

New on PromptLoot

2D Game Asset Rules for AI Agents: Sprites & Colliders

An ASSETS.md for Claude Code, Cursor, or Codex in Godot, Unity, Phaser, or Canvas: sprite sheet layout, naming, pixel-art import, animations, and colliders.

Agent Auto-Approve Policy: What AI Agents May Merge Alone

A policy file that sorts every PR an AI agent reviews into auto-merge, human review, or blocked: docs and tests yes; payments, auth, and secrets never.
PromptLoot Pro Pack · 200+ advanced templates, agent workflows, and Cursor rules bundles. Coming soon