← All pillsFirst steps · 24 Nov 2026Base

CLAUDE.md: What It Is and How to Write It as a Beginner

Claude Code built your project and now you can't tell how it works? CLAUDE.md is the file Claude reads every session. How to create it in 10 minutes, with an example.

CLAUDE.md is a text file in your project folder. Claude Code reads it on its own at the start of every session. In a few lines you write what the project is, how you want to work and where to find the rest. You create it in a minute with the /init command and tidy it up in ten.

The problem: the project is yours, but you can't tell how it works

Today on Medium a developer published an article whose title says it all: "I Let an AI Agent Build My Whole Project. Then I Couldn't Explain It."

If you have just started with Claude Code, that sounds familiar. The site works, the app runs. Then you ask for a change and Claude repeats a mistake you had already fixed. Or it asks again how to start the project. Every session starts from zero, and you repeat the same explanations.

The reason is simple: Claude does not remember past conversations. It only remembers what it finds written in files. CLAUDE.md is the first of those files.

CLAUDE.md is the file Claude Code reads every session
CLAUDE.md is the file Claude Code reads every session

What it is, in practice

Think of it as a note on the fridge, not a manual.

  • What it is: a text file with a few headings and a few lists. Nothing more.
  • Where it lives: in the main project folder, next to the other files.
  • Who reads it: Claude Code, on its own, every time you open a session in that folder.
  • Who writes it: you, or Claude itself with the /init command.
  • How long: as short as possible. Ten lines are enough to start, one page is the maximum.

There is also a "personal" CLAUDE.md, in the .claude folder on your computer. It applies to every project: put the preferences you always have there, for example "answer in plain English".

Create it in three steps

1. Let Claude write it. Open the terminal in your project folder, start Claude Code with the claude command and type:

Ready to copy

/init

Claude reads the project files and writes a first version of CLAUDE.md. If you prefer to give precise instructions, type this instead:

Ready to copy

Read this project and write a short CLAUDE.md, under 250 words. Use only these sections: What it does, How to start, Where things are, How to work. Only write things you can actually see in the files. If something is unclear, write "TO CHECK" instead of guessing. Do not change anything else.

2. Read it and cut it down. The first version is often long and full of technical detail. Keep only what helps to understand the project: what it does, how to start it, where the important parts are.

3. Add three lines of your own. The ones Claude cannot guess: how you want it to work, what it must never do, the language you prefer.

An example to copy

Imagine a bakery website built with Claude Code. A good CLAUDE.md looks like this:

Ready to copy

# Rosa Bakery website Showcase site with menu, opening hours and a cake order form. ## How to start - npm install the first time, then npm run dev - The site opens at http://localhost:3000 ## Where things are - Pages: app/ folder - Menu text: content/menu.json - Order form: app/order/ ## How to work - Answer in plain English. - Before changing anything, explain what you want to do. - Make small changes, don't rewrite whole pages. - Never touch the .env file. ## More - Feature notes: documentation/features/ - Work diary: documentation/diary/

Swap in the names from your project and delete the lines you don't need.

A short CLAUDE.md: what the project does, how to start it, where things are, how to work
A short CLAUDE.md: what the project does, how to start it, where things are, how to work

A small test: 10 minutes

Before using it on your real project, try it in an empty folder. That way you see it work with your own eyes.

  1. Create a test folder, for example "memory-test", and open Claude Code inside it.
  2. Create a three-line CLAUDE.md with one clear rule: "Do not create new folders".
  3. Ask Claude: "Create a file hello.txt that says hello, following CLAUDE.md".
  4. Check that it followed the rule.
  5. Change the rule in the file and ask again. If Claude follows the new rule, you know how it works.

What usually breaks

  • The file becomes a manual. If it is too long, Claude still reads it every session: it uses up your plan's usage limit faster and can get confused. Long material goes in other files, and CLAUDE.md points to them.
  • Passwords and keys end up inside. Never. They belong in the .env file, which you do not share.
  • Two rules fight. "Always improve the code" next to "don't touch what works" is confusing. One clear rule per topic.
  • Nobody updates it. When you change how the project starts, change that line in the file too. An old rule teaches new mistakes.

CLAUDE.md or skill?

A skill is a recipe for one specific job: making a video, writing an email in your style. You use it when you need it.

CLAUDE.md is always on and applies to the whole project. In short: a skill is one job, CLAUDE.md is the house rules.

The next step: a folder that tells the project's story

CLAUDE.md is the front door. As the project grows, you also need a documentation folder with a few things:

  • one note per feature: what it does, when it runs, where the code is, what is missing;
  • a diary: one line per task, with what and why;
  • traps: the mistakes that cost you time, with the fix.

You don't have to write it by hand. At the end of each task, just ask:

Ready to copy

Update the note for the feature we touched and add a line to today's diary: what we did and why.

We use this on all our projects. On an Italian gaming store we have worked on since July, after four months there are 84 feature notes, 56 diary days and 30 traps written down. When someone asks "how does the cart work?", the answer is a single page you can read in two minutes. And in the next session Claude starts from there instead of rereading all the code.

Our case: 84 notes, 56 diary days, 30 traps written down
Our case: 84 notes, 56 diary days, 30 traps written down

To go deeper on giving an agent a memory, read AI Agent Memory: 5 Rules to Stop Repeating Mistakes.

Frequently asked questions

Do I need CLAUDE.md for a small project? Yes. Even ten lines save you from explaining every session how to start the project and how you want to work.

Do I need to know how to code to write it? No. It is plain text with a few headings. You can let Claude write it with /init and then correct it in your own words.

Does Claude really read it every time? Yes. Claude Code loads the CLAUDE.md in the folder where you open the session, and the personal one in the .claude folder on your computer too.

How long should it be? One page at most. Anything long goes in other files, and CLAUDE.md says where to find them.

I also use other tools, like Cursor or Codex. Do I need one file for each? No. Many tools read a twin file, AGENTS.md. Keep the rules in one file and in the other write one line that points to it.

Just starting with Claude Code?

Many people who don't code are building sites, tools and small apps with Claude Code. The first month is when habits form, good or bad.

If you want to start on the right foot, get in touch: in one hour we set up your first project together, CLAUDE.md included.


In short: CLAUDE.md is a text file in your project folder that Claude Code reads on its own every session. Keep it short, say what the project does and how you want to work, and point to the rest.

Newsletter

AI that actually works, in your inbox.

New pills, the tools we use and what we learn on real projects. Few emails, only when there is something useful.

By subscribing you agree to receive the newsletter. No spam, unsubscribe in one click. Privacy