Write a Rules File for Your Website Repo So AI Editors Stop Guessing
Disclosure: I work on VibUI, a paid library of website prompts. It's linked once, at the very end. Monday morning, new chat. You ask the editor to add a testimonials section. It reaches for a carousel library you banned
Disclosure: I work on VibUI, a paid library of website prompts. It's linked once, at the very end.
Monday morning, new chat. You ask the editor to add a testimonials section. It reaches for a carousel library you banned last week, writes px font sizes you replaced with tokens, and invents three customer quotes. You type the same corrections you typed on Friday. They're the same corrections you typed on Thursday.
The tool isn't forgetful out of spite. Each session starts blank. A rules file is how you hand it the memory you keep having to retype.
What a rules file is
Most AI coding editors and agents can read a plain text file from your repo at the start of a session and treat it as standing instructions. The file names and locations vary by tool and change over time, so check the docs for yours. Common ones include AGENTS.md, CLAUDE.md, .cursor/rules and .github/copilot-instructions.md. Chat-style builders often have a "project instructions" or "knowledge" box that does the same job.
The content matters more than the filename, and it's mostly the same everywhere.
A starter file for a website repo
# Project rules
## What this is
Marketing site for [product]. Static pages, plain CSS, minimal JavaScript.
## Commands
- Install: npm ci
- Dev server: npm run dev
- Build: npm run build (must pass before you say you are done)
## Styling
- Use only variables from src/styles/tokens.css. No raw colours, no px font sizes.
- Spacing from the --space-* scale only.
- No !important. No new CSS files; edit the existing ones.
## Components
- Search src/components before creating anything. Reuse, don't duplicate.
- Variants are props, not new files.
## Content
- Use only copy from content/*.md. Never invent testimonials, ratings, statistics, logos or customer counts.
- If copy is missing, leave a visible TODO.
## Dependencies
- Add no packages without asking. Prefer native HTML and CSS.
## Accessibility
- Visible labels, keyboard support, visible focus, contrast of at least 4.5:1.
## When you finish
- List every file you changed and every new dependency or asset.
What to put in, and what to keep out
| Put in | Keep out |
|---|---|
| Commands to build and test | Long explanations of why |
| Hard rules ("never", "only") | Style preferences you'd bend |
| Where things live | A copy of your whole design doc |
| What "done" means | Anything that changes weekly |
| Links to tokens and content files | Secrets of any kind |
Keep it to about a page. A long file gets skimmed by the tool just as it would by a person, and rules at the bottom get followed less than rules at the top.
Write rules from your corrections
Here's a habit that works. The second time you type the same correction into a chat, stop and add it to the file. After a few weeks you've got a file made entirely of things that actually went wrong, which beats anything you'd draft in advance.
Check that it's being read
Ask the tool at the start of a session: "Which project rules are you following? List them." If it can't, the file isn't being loaded, or it's in the wrong place for that tool. Then break a rule on purpose ("add a carousel") and see whether it pushes back.
The idea applies across v0, Lovable, Bolt, Cursor, Windsurf, Claude, ChatGPT, Gemini, Replit, GitHub Copilot, Framer AI, Google Stitch, Readdy, Aura.build, OpenAI Codex, wherever a tool offers a place for standing instructions.
Where a prompt library fits
A rules file says how to work. It doesn't say what to build. For starting layouts that follow rules like these: VibUI is the library I work on: 2,852 website prompt templates (775 pages, 1,100 sections, 817 components, 160 animated backgrounds), about 1,000 of them with source code. It's one-time pricing with no auto-renewal: $48 quarterly, $99 yearly, $179 lifetime (listed down from $384). Yearly and lifetime also include 2,407 AI video prompts. There are 60 free samples, and a free account can copy 2 prompts. Open a free sample with source code and see how many of your rules it already meets.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.