Skip to the workspace
Pebellslearn by building
CLAUDE.md  ›  Lesson

How to Structure a CLAUDE.md

How to Structure 12 minA good CLAUDE.md is short, specific and split into headed sections, with every line something a new teammate could act on and long material moved to separate files.

claude code / How to Structure a CLAUDE.md

Explore each scene at your own pace.

01 · The rule

The rule

How to Structure a CLAUDE.md

A CLAUDE.md that grows by accident turns into a wall of text, and Claude skims a wall of text the way people do. Structure keeps it short, easy to search and easy to follow.

The rule

Short, specific, sectioned: every line something a newcomer could act on.

Short. Every line is loaded into every session and costs context each time. Aim for something you can read in a minute. Move long material, such as a deployment guide or an architecture write-up, into its own file and point to it. CLAUDE.md can also import another file by writing its path after an @, but an import is loaded every session too; a plain pointer ("see docs/deploy.md before deploying") keeps the material out of context until it is needed.

Specific. "Format Python with ruff format" can be followed and checked. "Write clean code" cannot.

Sectioned. Headings let Claude, and your teammates, find things. A pattern that works for most projects:

  1. About: one or two lines on what the project is.
  2. Commands: build, run, test, lint.
  3. Map: only the non-obvious parts of the layout.
  4. Rules: conventions and hard limits.
  5. Workflow: how to verify and commit.
  6. Gotchas: known traps.

Give reasons. "Keep pricing in pricing.py, because the billing tests import it directly" lets Claude apply the rule to cases you did not list.

Say what to do, not only what to avoid. "Put new price rules in pricing.py" points somewhere; "don't put prices in the routes" leaves Claude guessing where they should go instead.

Emphasise sparingly. Mark the one or two rules that matter most as IMPORTANT. If everything is important, nothing is.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.