CLAUDE.md File: What It Is, Where It Goes, 3 Templates
What a CLAUDE.md file is, where it goes, what to write and what to leave out, plus three copy-ready templates for business owners, marketers and websites.
By Yotam DahanUpdated 10 min readClaude Code
On this page
A CLAUDE.md file is a plain-text Markdown file that Claude Code reads at the start of every session, so you can write down your rules, context and preferences once instead of repeating them in every conversation. Put it in a project's main folder for that project's rules, or in ~/.claude/CLAUDE.md for rules that apply to everything you do. Claude treats it as guidance rather than hard settings, so short, specific instructions work best.
Markdown is simply text with a few symbols for structure: # starts a heading and - starts a bullet. You don't need anything else to write a good CLAUDE.md.
How CLAUDE.md works
Every Claude Code session starts with a fresh memory. Two things carry knowledge from one session to the next: CLAUDE.md files that you write, and auto memory notes that Claude writes for itself.
| CLAUDE.md | Auto memory | |
|---|---|---|
| Who writes it | You | Claude |
| What it holds | Rules, context and preferences | Notes on your corrections and preferences |
| When it loads | Every session, in full | Every session, up to the first 200 lines or 25KB of its index |
| Best for | Anything you would otherwise repeat | Small learnings Claude picks up as you work |
Both are context, not enforced settings: Claude reads them and tries to follow them, as Anthropic's memory docs explain. To block something no matter what, use a permission rule instead, covered further down.
Where CLAUDE.md files go
~ means your home folder (%USERPROFILE% on Windows), and ./ means the main folder of your project.
| Scope | Location | Use it for | Who it applies to |
|---|---|---|---|
| Personal, every project | ~/.claude/CLAUDE.md | Your language, tone and way of working | Only you |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md | The project's rules and context | Anyone who has the folder; commit it to share it |
| Personal, one project | ./CLAUDE.local.md | Private notes for this project; add it to .gitignore | Only you |
| Organization | /Library/Application Support/ClaudeCode/CLAUDE.md (Mac), /etc/claude-code/CLAUDE.md (Linux), C:\Program Files\ClaudeCode\CLAUDE.md (Windows) | Company-wide rules set by IT | Everyone on that machine |
Claude Code loads the CLAUDE.md in the folder you start it in and in every folder above it, and the files add up rather than replace each other. A CLAUDE.md inside a subfolder loads only once Claude starts working with files in that subfolder.
Organization
Company rules from IT, if your company sets any
Your personal file
~/.claude/CLAUDE.md
Parent folders
Any CLAUDE.md in the folders above your project
This project
./CLAUDE.md first, then CLAUDE.local.md last
Because the most specific file is read last, a project rule sits closest to the work. Still, avoid contradicting your personal file, because when two rules conflict Claude may follow either one.
How to create one
- Open your project folder in Claude Code. In the terminal, move into the folder and run
claude; in the desktop app, use the Code tab and Select folder. - Run
/init. Claude looks through the folder and writes a starter CLAUDE.md. If one already exists, it suggests improvements instead of overwriting it. - Or let Claude interview you. For a folder with little in it yet, the prompt below gets better results than
/init. - Edit it.
/memorylists your CLAUDE.md files and opens one in your editor, or you can simply say "add this rule to CLAUDE.md". - Reload it. The file is read at session start, so run
/clearor start a new session after editing; Anthropic's prompt caching page explains why mid-session edits wait. - Check that it loaded. Run
/contextand look for the file under Memory files.
I want a CLAUDE.md for this folder. Ask me up to 8 questions, one at a time, about my business, who the work is for, my tone of voice, the rules I always want followed and what "done" means for me. Then write a CLAUDE.md under 60 lines with clear headings, and show it to me before you save it.What to put in it, and what to leave out
Treat CLAUDE.md as the place for things you would otherwise re-explain. A good trigger for a new line is Claude making the same mistake twice, or you typing the same correction you typed last week.
| Put in | Leave out |
|---|---|
| Who you are and who the work is for | Passwords, API keys and account numbers |
| Your tone of voice and the words you never use | Long background documents |
| How the folder is organized and how files are named | Details that change every week |
| Rules that always apply, such as "drafts only, never send" | Vague wishes like "write well" |
| What "done" looks like for your work | Step-by-step procedures you only need sometimes |
| Mistakes Claude has made before | Anything Claude can see by opening the files |
Be concrete
"Use US English and paragraphs of three sentences or fewer" works, while "write nicely" doesn't.
Stay short
Anthropic recommends under 200 lines per file, since longer files use more context and get followed less reliably.
Use headings
Group rules under headings and bullets instead of long paragraphs.
Avoid conflicts
If two rules contradict each other, Claude may pick either one, so prune old rules regularly.
Emphasize sparingly
Mark one critical rule with IMPORTANT. If every line is important, none of them stands out.
If your rules already live in another file, pull it in with an @ import such as @brand/voice.md instead of copying it. Imported files also load at startup, so imports keep things organized but don't make the file any lighter.
Three copy-ready templates
Replace everything in square brackets, delete what doesn't apply, and keep the result short. Each one is a starting point to trim after a week of real use.
Template 1: business owner
Save this as ~/.claude/CLAUDE.md to apply it everywhere, or as CLAUDE.md in the folder you use for admin work.
# About me and my business
- I run [BUSINESS NAME], a [TYPE OF BUSINESS] in [CITY OR MARKET].
- Customers are [WHO THEY ARE]. Main products or services: [LIST].
- I'm not a developer. Explain anything technical in one plain sentence.
# How to work with me
- Ask me questions before starting anything that takes more than a few steps.
- Show me a short plan before changing more than 3 files.
- Reply in [LANGUAGE], in short paragraphs, without jargon.
# Rules that always apply
- Never send emails, messages or payments. Prepare drafts for me to send.
- Never delete files. Move anything you want removed into a folder called _trash.
- Never invent numbers, prices or facts. If something is missing, ask me.
- Currency is [CURRENCY]. Dates are written [DATE FORMAT].
# Files and folders
- Incoming documents are in /inbox. Finished work goes in /output.
- Name files like YYYY-MM-DD_topic.
# When you finish a task
- List what you changed, what you couldn't do and anything you were unsure about.
# Compact instructions
When compacting, keep the list of files changed and any open questions.The last section uses a feature from Anthropic's docs: a "Compact instructions" heading tells Claude what to keep when it summarizes a long conversation.
Template 2: marketer
Save this as CLAUDE.md in your marketing folder. For full marketing workflows that use it, see Claude Code for marketers.
# Brand
- Brand: [BRAND NAME]. We sell [OFFER] to [AUDIENCE].
- Voice: [THREE ADJECTIVES]. We sound like [EXAMPLE], never like [ANTI-EXAMPLE].
- Words we never use: [LIST].
- Spelling: [US OR UK] English.
# Facts and claims
- Use only the facts in /brand/facts.md and in the files I give you.
- Every statistic needs a source link. If you can't find one, leave the number out.
- Don't name competitors unless I ask.
# Channels and formats
- LinkedIn: under [NUMBER] words, one idea per post.
- Email: subject line under [NUMBER] characters, one call to action.
- Instagram captions: the hook goes in the first line, under [NUMBER] words in total.
# Files
- Briefs are in /briefs. Drafts go in /drafts, one file per piece, named channel_topic_date.
# Before you say you're done
- Check every claim against the source files and list anything unsupported.Template 3: website project
Save this as CLAUDE.md in the main folder of the site. The guide to building a website with AI walks through a full project that pairs well with it.
# Project
- Website for [BUSINESS NAME]: [WHAT THE SITE IS FOR].
- The one action we want from visitors: [FOR EXAMPLE, BOOK A CALL].
- Built with [STACK, FOR EXAMPLE PLAIN HTML AND CSS]. Hosted on [HOST].
# Commands
- Preview locally: [COMMAND]
- Check before publishing: [COMMAND]
# Design rules
- Colors: [HEX CODES]. Fonts: [FONTS]. Keep plenty of white space.
- Mobile first: check every change at phone width before saying it's done.
- Every image needs alt text. Buttons say what happens next ("Book a call", not "Submit").
# Content rules
- Use only the copy in /content and facts I confirm. No invented reviews, numbers or logos.
- Every page needs its own title and meta description.
# Don't
- Don't add new libraries, plugins or services without asking me.
- Don't change domain, DNS or hosting settings.
# Done means
- The check command passes, the page works at phone width, and you list what you changed.When CLAUDE.md isn't enough
Permission rules
For things that must never happen, such as reading .env files, add a deny rule in your settings. Claude Code enforces it whatever the instructions say.
Skills
For step-by-step procedures you only need sometimes. A skill loads only when it's used, so it doesn't weigh down every session.
Hooks
For actions that must run at a fixed moment, such as a check after every file edit. They run as commands, not suggestions.
Rules folder
For instructions that only matter for some files, saved in .claude/rules/ and loaded when Claude works on matching files.
The guide to creating a Claude skill shows how to turn a procedure into a skill. For deny rules, Anthropic's permissions guide has the syntax, and our Claude Code cheat sheet includes a starter settings file.
Keeping CLAUDE.md lean also saves usage, because it loads into every session. The guide to Claude Code usage limits explains how much the size of your context matters.
When Claude ignores your CLAUDE.md
- It never loaded. Run
/contextand check for it under Memory files; if it's missing, it is in the wrong folder. - You edited it mid-session. Run
/clearor start a new session so the new version loads. - It is too long or too vague. Cut anything Claude already does on its own, and rewrite fuzzy rules as checkable ones.
- Two rules conflict. Look across your personal file, the project file and any subfolder files, and delete one of them.
- It needs to be a hard rule. Move it into a permission rule or a hook.
Quick check0 of 3 correct
Where do you put rules that should apply to every project on your computer?
Not quite.
The CLAUDE.md inside the .claude folder in your home folder loads in every session, in every project.
You changed CLAUDE.md halfway through a session. When does Claude see the change?
Not quite.
The file is read when the session starts, so edits load the next time that context is rebuilt.
What is the surest way to stop Claude from reading your .env file?
Not quite.
CLAUDE.md is guidance. A permission rule is enforced by Claude Code no matter what the instructions say.
What to do next
Open your most-used project folder, run /init or the interview prompt, and keep the result under 60 lines for the first week. Every time you correct Claude, ask whether that correction belongs in the file, and remove anything Claude already does on its own. The beginner tutorial shows CLAUDE.md working inside a real project, and the Claude Code course has a lesson dedicated to the CLAUDE.md file, followed by skills and MCP.
Two more CLAUDE.md templates and a monthly review
Ready-to-fill CLAUDE.md templates for content creators and freelancers, plus a 10-point monthly review that keeps the file short and sharp.
Enter your email and the full section opens right here. You also get a free lesson from the course.
Frequently asked questions
What is the difference between CLAUDE.md and AGENTS.md?
AGENTS.md is a similar instruction file that other coding agents read. Current versions of Claude Code read AGENTS.md when a folder has no CLAUDE.md, and if you keep both, a CLAUDE.md containing the line @AGENTS.md lets every tool share one set of rules.
Does CLAUDE.md work in the desktop app and VS Code too?
Yes. The terminal, the desktop app's Code tab and the VS Code extension all run the same Claude Code engine, so the same CLAUDE.md files load in each of them.
Where is the global CLAUDE.md file on Windows?
It lives at %USERPROFILE%\.claude\CLAUDE.md, which is usually C:\Users\YourName\.claude\CLAUDE.md. If it doesn't exist yet, run /memory in Claude Code and pick the user file, and it is created for you.
Can Claude Code update CLAUDE.md by itself?
Only when you ask, for example with "add this rule to CLAUDE.md". Separately, it writes its own auto memory notes without being asked, and you can browse and edit those through /memory.
Can I keep notes in CLAUDE.md that Claude won't read?
Yes. Block-level HTML comments, such as <!-- note for the team -->, are stripped before the file reaches Claude, so they cost nothing in context. Comments inside code blocks are kept.
Keep reading
How to Use Claude Code: A First-Weekend Tutorial (2026)
Learn how to use Claude Code by building a one-page site for a local business: the conversation, permissions, plan mode, undo, and 10 tips that save hours.
Claude Code · 10 min readHow to Create a Claude Skill: SKILL.md Walkthrough (2026)
Learn how to create a Claude skill: what SKILL.md is, how skills load, a full build of a campaign brief skill, and how to install skills other people made.
Claude Code · 11 min readClaude Code Commands Cheat Sheet: Shortcuts, Flags, Settings
Claude Code commands on one page: slash commands, keyboard shortcuts, CLI flags and where every settings file lives, all checked against the official docs.
Claude Code · 12 min read