How to Write a CLAUDE.md for Website and Marketing Projects

If you build websites or run marketing work with Claude Code, one file does more for consistency than any single prompt: CLAUDE.md. It holds the instructions Claude reads at the start of every session, so you stop repeating the same brand rules, naming conventions, and “never do this” warnings.

This guide covers where the file goes, what belongs in it, a template for website and marketing projects, and the mistakes that cause it to be ignored. The mechanics come from Anthropic’s memory documentation, which may change, so check it for the latest.

What CLAUDE.md is

CLAUDE.md is a plain markdown file of persistent instructions. Anthropic describes it as context loaded every conversation, best for project conventions and “always do X” rules. It is different from a one-time prompt: you write it once, and it applies to every session in that project.

It also differs from auto memory, which is notes Claude writes for itself from your corrections. CLAUDE.md is the guidance you write on purpose.

Where the file goes

Per Anthropic’s documentation, there are three main places:

  • Project instructions: ./CLAUDE.md or ./.claude/CLAUDE.md, shared with your team through source control.
  • User instructions: ~/.claude/CLAUDE.md, your personal preferences across all projects.
  • Local instructions: ./CLAUDE.local.md, personal notes for one project that you add to .gitignore.

Running /init generates a starting CLAUDE.md by analyzing your project, and if one already exists it suggests improvements instead of overwriting it. For a brand-new website, it is a quick way to get a first draft, which you should then edit.

What belongs in a website or marketing CLAUDE.md

Include facts and rules that are true of the project every time:

  1. What the project is. One or two sentences: the business, the audience, and the goal of the site.
  2. Brand voice rules. Tone, words to use and avoid, point of view (for example “we” for an agency).
  3. Structure and conventions. Folder layout, how pages are named, where images go.
  4. Build and preview commands. How to run the site locally and how to check it.
  5. SEO rules. Title and description length targets, one H1 per page, how internal links are written.
  6. Tracking conventions. Your UTM naming rules, analytics setup, and event names.
  7. Never-do list. Things Claude must not do: invent testimonials, change legal text, edit the checkout.
  8. Approval rules. What needs a human before it ships.

A copy-ready template

Adapt this to your project and replace every placeholder with your real details:

# Project: [Business name] website

## What this is
[One sentence about the business and audience.] Goal of the site: [one action].

## Voice
- Write as "we" for the agency. Direct, plain language. No hype words.
- Never invent statistics, client names, quotes, or case studies.
- If a fact is missing, leave a [TODO] and ask me.

## Structure
- Pages live in /pages. Images in /images, compressed before commit.
- One H1 per page. Descriptive, lowercase-hyphen URLs.

## SEO
- Title tag around 50-60 characters, keyword first.
- Meta description around 120-160 characters with a clear reason to click.
- Every image has alt text.

## Tracking
- UTM values are lowercase with hyphens. Never add UTMs to internal links.

## Commands
- Preview: [your command]
- Check: [your command]

## Do not
- Do not edit [legal pages / checkout] without asking.
- Do not publish or deploy. Ask me first.

Anthropic’s guidance on size matters here: target under 200 lines per file. Longer files consume more context and can reduce how well Claude follows them.

Keep it specific and short

Vague rules get vague results. Compare:

  • Weak: “Write good, on-brand copy.”
  • Better: “Use plain language, short sentences, and the word ‘we.’ Do not use the words ‘revolutionary’ or ‘game-changing.'”

Also avoid contradictions. If one section says “keep it short” and another says “be thorough,” Claude has to guess. Review the file every few weeks, and when you notice yourself correcting the same mistake twice, add a line to the file.

Split large instruction sets

If the file grows too long, Anthropic suggests moving content out:

  • Imports: CLAUDE.md can pull in other files with @path/to/file syntax, so you can keep a long brand guide in its own document.
  • Rules files: the .claude/rules/ folder holds instructions that can be scoped to certain files, so they load only when relevant.
  • Skills: reference material or workflows you only need sometimes belong in a skill rather than in always-on instructions.

See our comparison of skills, MCP, subagents, and hooks for when to use each.

Important: CLAUDE.md is guidance, not enforcement

Anthropic’s documentation is clear that instructions in CLAUDE.md are followed as guidance and are not guaranteed. For anything that has to happen every time, such as a check before deploy, use a hook instead. And always review what Claude produces before it goes live.

Never put secrets in it

CLAUDE.md is often committed to source control and shared. Do not put passwords, API keys, client data, or private information in it. Keep those in environment variables or a secrets manager.

A short checklist

  • [ ] Project purpose and audience in two sentences
  • [ ] Voice rules with real examples of what to avoid
  • [ ] SEO and tracking conventions
  • [ ] Build and preview commands that actually work
  • [ ] A never-do list, including “do not invent facts”
  • [ ] Under about 200 lines
  • [ ] No secrets
  • [ ] Reviewed and trimmed regularly

Related guides

New to the tool? Start with Claude Code for beginners and our Claude Code tips and tricks. For prompts that go with your instructions, see our guide to Claude prompt engineering for copywriting. Our meta tag generator and SERP preview tool help you check the SEO rules you write into the file. If you want to see what finished builds look like, browse our Claude Code website examples.

Frequently asked questions

Where do I put CLAUDE.md?

In your project root as CLAUDE.md, or in .claude/CLAUDE.md. A personal version goes in ~/.claude/CLAUDE.md.

How long should CLAUDE.md be?

Anthropic recommends staying under about 200 lines per file. Move reference material into imports, rules, or skills.

Does Claude always follow CLAUDE.md?

It treats the file as guidance, not strict rules. Use hooks for actions that must always happen, and review the output.

Should I commit CLAUDE.md to git?

The project file is meant to be shared with your team through source control. Keep personal notes in CLAUDE.local.md and add it to .gitignore.

Want this set up for your team?

We build AI-assisted workflows with clear guardrails. See our AI and automation service or get in touch.