CLAUDE.md is loaded into context on every turn. Every line you add is paid for again and again, and long files get skimmed by the model the same way long docs get skimmed by people. A short file that is always right beats a long file that is mostly right.
What belongs in it
- Stack in one line.
Python 3.12, FastAPI, SQLite, pytest. No history, no rationale. - Exact commands. How to install, run, test and lint, copy-pasteable.
pytest -q tests/is better than "run the tests". - A folder map. Five to ten lines:
app/core/ - config, storage,app/modules/ - one folder per feature. - Conventions that are not obvious from the code. "All settings come from
Settings, neveros.getenvin modules." - A short never-do list. "Never edit migrations by hand. Never commit
.env."
What to cut
- Anything the agent can read from
package.jsonorpyproject.toml. - Style rules your formatter already enforces.
- Long explanations of why. Keep a link to a doc instead.
- Task-specific instructions. Put those in the prompt for that task.
A quick test
Read your file and ask, line by line: if this line were missing, would the agent do something wrong this week? If the answer is no, delete it.
Checklist
- [ ] Under 60 lines
- [ ] Commands are exact and copy-pasteable
- [ ] Folder map matches the current tree
- [ ] Never-do list has 3 to 6 items
- [ ] No secrets, tokens or internal URLs
Disclosure: I built a small tool for this. It reads only your folder and file names (no source code), flags missing setup files, ignore rules and secret exposure, and can generate a CLAUDE.md / ignore / settings bundle for your repo.
