Refiner Client sign inSign in Book a call
Website strategyGrowth strategy

How to write a CLAUDE.md file for your website

CLAUDE.md is where you write the rules every change to your website must follow. Here is what to put in it, an example built from our own corrections, and how to keep it short.

Cover for Refiner's guide to writing a CLAUDE.md file for a website: the house rules Claude Code reads at the start of every session

A CLAUDE.md file is where you write the rules every change to your website must follow: your spelling, your URL format, where content lives, what must never change without asking, and how work is checked before it comes back to you. Claude Code reads it at the start of every session.

We didn't have one when we moved our website from Lovable to Claude Code, and it is the first thing we would do differently. Some corrections came up again and again because nothing was written down. The full story of the move is in our Lovable to Claude Code migration guide. This guide is about the file.

In this article · 08 sections
  1. 01What CLAUDE.md is, and what it isn't
  2. 02Where the file goes
  3. 03What to put in it for a website
  4. 04How to keep it useful
  5. 05Where CLAUDE.md fits in a migration
  6. 06Does Claude Code read AGENTS.md?
  7. 07Will Claude always follow CLAUDE.md?
  8. 08How long should a CLAUDE.md be?
01

What CLAUDE.md is, and what it isn't

CLAUDE.md is a plain Markdown file. Anthropic's documentation describes it as context that guides Claude's behaviour, not configuration that is enforced. Claude reads it and follows it, the way a new team member follows a style guide. If a rule must apply every single time, such as running a check before every commit, Anthropic suggests a hook instead: a command that runs automatically at a set point.

That distinction matters for a website. Use CLAUDE.md for judgement: tone, spelling, where things go, when to ask. Use your build and your checks for anything a machine can verify.

02

Where the file goes

Put it at the root of your project as CLAUDE.md, or in a .claude folder, and commit it, so everyone working on the site gets the same rules. Claude Code also reads:

  • 01~/.claude/CLAUDE.md, your personal rules for every project
  • 02CLAUDE.local.md at the project root, for personal notes on this project that stay out of the repository
  • 03CLAUDE.md files in subfolders, which load only when Claude works on files there

The quickest start is the /init command, which looks through your project and drafts a CLAUDE.md for you. Treat the draft as a starting point. It can describe how your code is built. It can't know your brand terms, or which pages are off limits.

03

What to put in it for a website

Anthropic's examples of what to include are mostly about code: build commands, coding standards and architecture. A marketing website needs more than that, because most of what goes wrong is about words, addresses and facts, not code. Cover six things:

  • 01Language. British or American English, sentence case or title case, and your brand terms spelled the way you spell them.
  • 02Addresses. Your URL format, including trailing slashes and capitals, and the rule that an address never changes without a redirect.
  • 03Where content lives. Which folder holds services, case studies and articles, and where page titles and descriptions are kept.
  • 04What needs a human. Prices, client names, results and quotes should never change without asking.
  • 05Secrets. API keys and passwords live in your host's settings, never in code, commits or a chat.
  • 06How to check work. The commands to run, and what to show you before you review.

Here is the CLAUDE.md we would write for a site like ours today. Every line is a correction we found ourselves making more than once.

# Refiner website: house rules

## Writing
- British English. Sentence case for headings and buttons.
- Never invent client facts, figures or quotes. If a claim can't be checked against a source, flag it instead of writing it.

## Addresses
- Lowercase, hyphens, no trailing slash: /services/marketing-delivery/organic-seo
- Never change or remove an address without adding a redirect.

## Content
- Services, industries, roles and case studies: one JSON file each in src/content/services, industries, roles and work
- Articles: src/content/insights/*.md
- Page titles and descriptions: src/content/seo.json. Descriptions are 140 to 160 characters.
- Every article has exactly two categories and ten tags.

## Ask first
- Prices, client names, case study results and anything under /collab.

## Secrets
- API keys live in Cloudflare's settings only. Never put them in code, commits or messages.

## Before you hand work back
- One change per branch, with a pull request that says what changed and why. Never merge: we review and merge.
- Run npm run build and node scripts/seo-check.mjs.
- Screenshot every changed page on desktop and phone.
04

How to keep it useful

Anthropic's guidance is to keep each CLAUDE.md under about 200 lines, because longer files are followed less reliably. A few habits keep it short and sharp:

  • 01Write rules you could check. "Descriptions are 140 to 160 characters" works. "Write good descriptions" doesn't.
  • 02Remove contradictions. If two rules disagree, Claude may pick either one.
  • 03Leave out what Claude can find for itself. It can read your folder structure and your build scripts. Write down what it can't know.
  • 04Move long procedures out. A ten-step routine, such as publishing a new case study, is better as a skill than as a paragraph in CLAUDE.md.
  • 05Split by topic when it grows. Rules can go in separate files in .claude/rules/, and a rule file can be limited to certain paths, so article rules only load when Claude works on articles.

The best time to add a line is the second time you make the same correction. If you catch yourself typing "British English, please" again, it belongs in the file.

Add a line to CLAUDE.md the second time you make the same correction. That is how the file stays short and useful.
Share this
05

Where CLAUDE.md fits in a migration

If you are moving a site to Claude Code, write the file before any building starts, straight after you open the project. In our migration guide it is step three of twelve, ahead of the audit and the plan. The rules about addresses matter most during a move, which is why our guide to migration redirects starts from the same idea: no address changes without a redirect.

If you are not a developer, the file is also your best protection. It sets out what you expect before each change, instead of after. Our guide to Claude Code for marketers covers the rest of the review.

06

Does Claude Code read AGENTS.md?

Claude Code reads CLAUDE.md. If your project already has an AGENTS.md for other coding tools, create a CLAUDE.md that imports it with the line @AGENTS.md, and add anything specific to Claude below that.

07

Will Claude always follow CLAUDE.md?

Not every time. It is guidance, not an enforced setting, so Claude can still miss a rule. Keep rules specific and free of contradictions. For anything that must happen every time, use a hook or a check in your build.

08

How long should a CLAUDE.md be?

Under about 200 lines per file, according to Anthropic's guidance. Ours, above, is about 30. Split longer sets of rules into separate files by topic.

Share the takeaway

“Write your house rules in CLAUDE.md before Claude Code builds anything. It is the first thing we would do differently next time.”

Copy post gives you the takeaway and the link, ready to paste into LinkedIn.
Written byAlex Lawford, founderEvery article is written from the work itself: the briefs, the reporting runs, the conversations with sales teams.Meet the founder →
Cite this article

Lawford, A. (24 November 2026). How to write a CLAUDE.md file for your website. Refiner Agency. https://refineragency.com/insights/claude-md-for-websites

Refinement consultation

Want a website that's easy to keep improving?

Tell us how your site is built and how often it changes. On a 30-minute call, we'll look at what slows changes down and what to fix first.

  1. 01What makes changes to your site slow or risky
  2. 02The house rules worth writing down
  3. 03Where to start, in priority order

Not ready for a call? Answer three questions and Alex will email you a view.