Skip to content

CLAUDE.md: the note your coding agent reads first

Claude Code reads one file before every task. Most people leave it empty or fill it with junk. What goes in, what stays out, and a prompt that writes it.

By Nick

2 min read Updated

Coding toolsPaste This Intermediate
On this page
Time
Ten minutes
Cost
Nothing
Level
Intermediate

Before you start

1. What goes in

Five headings, one screen:

  • What this is. Two lines. “A static site about AI for beginners. Live on Cloudflare.”
  • How to run and check it. The exact commands. npm run dev, npm run verify.
  • Conventions it cannot infer. Where content lives, which style guide is binding, which files are generated and must not be edited by hand.
  • Rules. Never commit to main. Never touch the affiliate links. Ask before deleting.
  • Lessons. Every time it gets something wrong and you correct it, add one line here. This section is the one that compounds.

2. What stays out

Anything it can read for itself: the folder structure, what each function does, the dependencies. Anything that changes weekly. Long explanations. If you are writing paragraphs, you are writing documentation, and that belongs in a separate file you point at.

3. Let it draft the first version

Open Claude Code in the project and paste this.

Read this project properly, then write a CLAUDE.md for it. One screen, five headings: what
this is, how to run and check it, conventions you could not have inferred from the code,
rules, and an empty Lessons section. Only include things that would change how you work.
If you are not sure something is true, leave it out rather than guess. Show me the file
before you save it.

Read it. Cut anything you would not have said yourself. Save.

4. CLAUDE.md vs AGENTS.md

Same idea, different reader. Claude Code reads CLAUDE.md. Codex and many other coding agents read AGENTS.md. If you use more than one agent on the same project, you do not want two copies of the same rules drifting apart.

What Anthropic’s docs say Claude Code does with them:

  • Only AGENTS.md in the project: recent versions of Claude Code read it as the project instructions, so you do not need a CLAUDE.md at all.
  • Both files: Claude Code reads CLAUDE.md and ignores AGENTS.md, unless you change the Project instructions setting in /config to read both.
  • One shared file: put the real rules in AGENTS.md, and make CLAUDE.md a single line, @AGENTS.md, which pulls the other file in. Add anything only Claude needs below that line.

The third option works on every version, which is why it is the safest default. It is the same idea as the FAQ below: one file with the content, one that points at it.

How you know it worked. The next task starts without you explaining how to run the project. When it repeats a mistake you have already corrected, add one line to Lessons.

Common questions

Is AGENTS.md the same thing?

Same idea, read by Codex and most other agents. Keep one file with the real content and make the other one say 'Read AGENTS.md first', which is exactly what this site does. Step 4 has the import line that makes Claude Code load it automatically.

How long should it be?

A screen. If it scrolls, the agent skims it and so would you. Move detail into other files and point at them.

Where does it live?

In the root of the project. You can also have one in your home folder for things that are true of every project, like how you want commits written.

What to do next

Related reading

Last reviewed 6 November 2026 by Nick.

Software changes fast. If something here is out of date, tell me and I'll fix it.

Get new guides by email

Occasional and practical. No spam, no hype, unsubscribe whenever.

Occasional practical guides from UncomplicateAI. You will get a confirmation email before anything else is sent. Unsubscribe any time. Privacy

You are not subscribed until you confirm the email. Unsubscribe any time.