# How to write a CLAUDE.md file that Claude Code actually follows (2026)

URL: https://bolekrobot.pl/en/guides/claude-md-file-claude-code-follows
Type: Guide
Date: 2026-11-07
Updated: 2026-11-07
Author: Maciej Głuszak

**In short:** CLAUDE.md is the rules file Claude Code reads at the start of every conversation. The fastest way to write it is to let the assistant interview you and build a short file from your answers.

Paste into Claude Code:

```
Interview me – at most 7 questions, one at a time – and based on my answers write a CLAUDE.md in this folder: what language to reply in, what not to do without asking, how to name files and how to check the result. At most 40 lines, one sentence per rule.
```

Updated: 2026-11-07 · tested on: Claude Code 2.1, Windows 11

Claude Code does not remember the previous conversation. It remembers what you write in **CLAUDE.md** – the assistant loads it at the start of every conversation and treats it as a manual for working with you. Bolek, our AI assistant for Windows, has stood on such a file since day one, so everything below comes from daily use.

## Where the file lives and which one wins
| file | where | what for |
|---|---|---|
| CLAUDE.md in the project folder | the folder where you run claude | rules for one project: names, folder layout, how to check results |
| CLAUDE.md in your profile | the .claude folder in your user profile | rules for all projects at once: language, tone, what not to do without asking |

The assistant reads both. When rules conflict, the one closer to the work wins, i.e. the project file. Write language and tone once, in the profile.

## Step by step
1. Open a terminal in the project folder and run **claude**.
2. Paste the prompt from the box at the top of this page and answer the assistant's questions.
3. Read the finished file and strike every rule you do not understand or disagree with.
4. Start a new conversation and check that the assistant follows the rules – for example ask for a new file and look at its name.
5. When you correct the assistant a second time on the same thing, add it to the file in one line.

The built-in **/init** command also creates such a file, but it mostly describes the code of the project. If you use it, review the result against the skeleton below.

## The skeleton we start from
Four sections are enough to start:
- **Language and tone** – "reply briefly, no preamble".
- **What not to do without asking** – sending email, publishing, deleting files, payments.
- **Names and order** – "file and folder names in plain ASCII", "save results in the results folder".
- **How to know it is finished** – "before you say it is done, open the file and check the result".

## Five traps we hit
- **A file that is too long.** The file is read at the start of every conversation and costs working memory. At several hundred lines the rules start to get lost. Move details to separate files and point to them with one line.
- **Rules without a reason.** "Do not send email" works worse than "do not send email without my confirmation – a draft once went to a client". The reason helps the assistant decide cases you did not foresee.
- **Vague rules.** "Write nicely" means nothing. "Sentences of at most two lines, no exclamation marks" can be checked.
- **Conflicting rules.** Two rules that disagree end with the assistant choosing at random. Once in a while read the file top to bottom.
- **Passwords in the file.** CLAUDE.md is plain text that often ends up in a repository. Keep passwords and keys in a separate private file outside the project.

## FAQ
**Can I check which rules the assistant loaded?** Yes. The **/memory** command in a conversation shows the rules files in use and lets you open them for editing.

**What if the assistant breaks a rule?** Most often the rule is too vague or got lost in a long file. Shorten it to one concrete sentence and move it higher.
