CLAUDE.md template for frontend and UI design (copy-paste)
A copy-paste CLAUDE.md template for frontend projects: design rules, copy rules and a review loop. Plus where CLAUDE.md lives, @imports, and CLAUDE.md vs AGENTS.md.
TL;DR
CLAUDE.mdis the file Claude Code reads at the start of every session. It's the cheapest place to put design rules, because you write them once.- Keep it short (Anthropic suggests under 200 lines). Put long material in separate files and pull it in with
@path/to/fileimports. - The template below covers stack, design rules, copy rules and a review loop for UI work. Copy it, then fill in the brackets.
- Rules in
CLAUDE.mdstop the worst AI defaults. They don't design your site. For that, see the Design System Pack.
File locations and behaviour checked against Anthropic's memory docs on 10 November 2026.
Where CLAUDE.md lives
Claude Code combines several files, from broad to specific:
| File | Scope | Commit it? |
|---|---|---|
~/.claude/CLAUDE.md |
You, in every project | No (it's yours) |
./CLAUDE.md or ./.claude/CLAUDE.md |
This project, for the whole team | Yes |
./CLAUDE.local.md |
You, in this project only | No (gitignore it) |
src/some-folder/CLAUDE.md |
Loads when Claude works on files in that folder | Yes |
Files in your working directory and its parent folders load at launch and are combined, not overridden. You can also scope rules to file paths with files in .claude/rules/.
Quick start: run /init in Claude Code to generate a first CLAUDE.md from your codebase, then edit it. Use /memory to see which memory files are loaded, or just tell Claude "add this to CLAUDE.md".
The frontend template
Copy this into CLAUDE.md at your project root and replace the brackets.
# [Project name]
[One sentence: what the product is and who it's for.]
## Stack
- [Framework, e.g. Next.js / Vite + React], TypeScript, Tailwind
- Components live in src/components/ui. Pages compose them; don't restyle them inline.
- Run `[npm run dev]` to start, `[npm run build]` to check before finishing.
## Design system
@design/RULES.md
@design/tokens.css
- Use only colors, fonts, spacing and radius from design/tokens.css.
Never write raw hex values, px font sizes or Tailwind color classes like bg-blue-500.
- Build from src/components/ui. If something is missing, propose a new component first.
## Design rules (short version)
- Display font: [font], weight [500] max. Body: [font], 400.
- One accent color, used for at most 3 elements per page.
- No multi-stop gradients. No three equal cards in a row. No pill badge above headlines.
- No placeholder avatars, five-star rows or invented logos.
- Motion: one considered moment per page. No fade-up on every section.
- Sections: [160px] vertical spacing on desktop, [96px] on mobile.
## Copy
- Text in content/ or copy.md is final. Use it exactly; don't shorten, rephrase or "improve" it.
- New UI text: sentence case, plain words, active voice. No "Supercharge", "Unlock", "Seamless".
## How to work on UI
1. Plan first: list the sections and layouts you'll use before writing code.
2. Build one section per request, then stop for review.
3. After each UI change, list any design rule you couldn't follow and why.
4. When I paste a screenshot, compare it against these rules and list every violation.
Why each part is there
- Stack saves Claude from guessing your setup and running the wrong commands.
@imports keepCLAUDE.mdshort while still loading the full rules and tokens. Imports can be relative or absolute and can nest a few levels deep.- The short rules repeat the most important points inline, so they're seen even when the imported files are long.
- Copy rules stop Claude rewriting your tested headlines, its most common "helpful" mistake on redesigns. (How to redesign without losing copy.)
- How to work forces section-by-section building and makes rule-breaking visible instead of silent.
CLAUDE.md best practices
- Write commands, not wishes. "Weight 500 max for display headings" works. "Make it look premium" doesn't.
- Name what you don't want. Models avoid specific patterns far better than vague ones.
- Keep it short. Long files dilute every rule in them. Move detail into imported files.
- Update it when Claude gets something wrong. Each correction you repeat twice belongs in
CLAUDE.md. - Don't put secrets in it. It's committed and it's read every session.
- Put personal preferences in
~/.claude/CLAUDE.md, not the project file your team shares.
CLAUDE.md vs AGENTS.md
AGENTS.md is a shared instructions file several AI coding tools read. Claude Code now reads AGENTS.md natively too, but by default only when there's no CLAUDE.md in the project. If you keep both, the simplest setup is to put shared rules in AGENTS.md and import it from CLAUDE.md:
# CLAUDE.md
@AGENTS.md
## Claude-specific
[anything only Claude Code needs]
That way Cursor, Lovable and other tools that read AGENTS.md get the same design rules. (Lovable, for example, reads both AGENTS.md and CLAUDE.md in your repo.)
Pair it with a skill
CLAUDE.md holds this project's rules. Anthropic's frontend-design skill adds general design taste across every project. They work well together: the skill makes Claude choose deliberately, CLAUDE.md makes sure it chooses your system every time.
What CLAUDE.md can't do
A rules file tells Claude what not to do and which values to use. It can't supply the values. If design/tokens.css contains a generic palette and a default font, Claude will follow your rules perfectly and still produce a generic site. Setting up the design system itself is the bigger job.
Pack
The Design System Pack is the design system to point your CLAUDE.md at: 11 finished React sections with a rules prompt for each, a new-project prompt, and a renovate prompt that restyles an existing site one section at a time while keeping every word of your copy. Works in Claude Code, Cursor, Lovable, Bolt and v0.
$19 one-time, unlimited projects, 14-day refund.