# How to write a CLAUDE.md that reflects how you actually work

Ahmet Karaca · 12 October 2026 · Updated 8 November 2026 · https://coredence.com/guides/claude-md

A good CLAUDE.md is short, specific, and made of things you have already been burned by. `/init` can draft one from your code, but what it cannot find is how you work. Keeping that true is the real work.

## What is CLAUDE.md for?

Claude Code reads `CLAUDE.md` at the start of a session: the one in your home folder for every project, and the one in the project folder for that project. It is the part you control that is certain to load before work starts, which is why it is worth getting right and keeping small. Anthropic suggests under 200 lines per file. It is still context, not enforcement: to block an action outright, use a `PreToolUse` hook. How the file relates to auto memory is covered in the [Claude Code memory guide](https://coredence.com/guides/claude-code-memory).

## Where does the file go?

- `~/.claude/CLAUDE.md`: yours, in every project.
- `./CLAUDE.md` or `./.claude/CLAUDE.md`: the project's, shared through git.
- `./CLAUDE.local.md`: yours, in this project only; add it to `.gitignore`.
- `.claude/rules/*.md` or `~/.claude/rules/`: split by topic. With `paths` in the front matter, a file loads only when Claude works with a match.

Files in your folder and above it load at launch, broadest first, and they add up rather than override: if two disagree, Claude may pick either. Files in subfolders load when Claude works there. `/context` shows what loaded.

## CLAUDE.md, CLAUDE.local.md, rules, skills or AGENTS.md?

| File | When it loads | Use it for |
| --- | --- | --- |
| `CLAUDE.md` | Every session, in full | Rules that hold everywhere in the project |
| `CLAUDE.local.md` | Every session, after `CLAUDE.md` | Your own preferences for this project, kept out of git |
| `.claude/rules/*.md` with `paths` | When Claude reads or edits a matching file | Rules for one part of the code |
| Skill (`.claude/skills/<name>/SKILL.md`) | Its name and description up front, the body only when used | Multi-step procedures |
| Auto memory (`MEMORY.md`) | The first 200 lines or 25 KB | Notes Claude writes for itself |
| `AGENTS.md` | Only when no `CLAUDE.md` is found, or through `@AGENTS.md` | One file shared with Codex, Cursor and Copilot |

Anthropic's own rule of thumb: if an entry is a multi-step procedure or only matters for one part of the codebase, it belongs in a skill or a path-scoped rule, not in `CLAUDE.md`. What stays is short and true in every session. How AGENTS.md and CLAUDE.md share a repository is covered in the [AGENTS.md guide](https://coredence.com/guides/agents-md).

## What belongs in a CLAUDE.md?

- Things you have corrected more than once. If you have said "no, ask first" twice, it is a rule.
- Boundaries: what must never happen without asking, such as deleting, pushing, paying or sending.
- How you want answers: length, format, language, what not to pad.
- Pitfalls that cost you an hour once: the environment variable format, the build flag, the platform quirk.
- Commands it cannot guess: how to run the tests, how to build, where the fixtures come from.

Write the reason next to the rule. A model that knows why you ask before deleting will also ask before overwriting; a model that only knows "never delete" will not.

A file of this kind might read as follows:

```
# How I work

- Ask before deleting files or running reset commands.
  (A cleanup can remove something meant to be kept.)
- Plan in a few lines before touching more than three files.
- Formulas over hard-coded numbers: base * level^2.2, not 340.
- Short answers. No closing pleasantries.

# Pitfalls
- Railway env vars are Section__Key, double underscore.
- Flutter web needs vercel.json rewrites to index.html.
```

## What should stay out of a CLAUDE.md?

- Anything the code already says, since Claude can read the code.
- Aspirations. "I value clean code" changes nothing; "split a file before it passes 400 lines" does.
- Project status that will be stale next month. It belongs somewhere that is expected to change.
- Essays. Every line is loaded in every session; a page of prose is paid for every time.

## What does a measured record say belongs in it?

These figures come from one database, read on 8 November 2026: that of the person who builds Coredence. Its engine turned 27,530 messages, commits and notes into memories about how that person works, and recorded for each memory when new traces last confirmed it. For the 623 memories formed before October, the table shows how many were still being confirmed 30 days or more after they formed. The examples are illustrative.

| Kind of memory | Example | Formed before October | Still confirmed after 30+ days |
| --- | --- | --- | --- |
| Values | "Finish the main task before polishing" | 48 | 83% |
| Working patterns | "Plan in a few lines before touching several files" | 198 | 79% |
| Voice | "Short answers, no closing sentence" | 41 | 78% |
| Preferences | "Ask before deleting files" | 259 | 65% |
| Current state | "Preparing the launch of project X" | 77 | 18% |

Statements about what is happening now stopped being confirmed within weeks, as the projects moved on, while how the person works kept being confirmed for months. That is the case for leaving project status out of a CLAUDE.md, made from a record rather than from advice. Among the 599 lasting memories, the most common subjects were interface and UX (108), architecture (68), workflow (65), testing (46) and problem solving (37), which suggests where to start writing.

This is one person, working mostly in Turkish, measured by this product's own engine, and nobody outside has audited it. A memory also stops being confirmed when the work that would confirm it stops, and the data cannot tell that apart from a preference that changed.

## Why is keeping it true the hard part?

The first version is easy, because you write what is on your mind. The rules that matter most are the ones that were not: you only discover them when something goes wrong, and at that moment you are fixing the problem, not editing a file. So the file fills up with what you already knew.

Then it drifts. A preference from last spring keeps being obeyed after you changed your mind. Two lines quietly contradict each other and the model picks one. `/doctor prompt-audit` (Claude Code v2.1.283 or later) now looks for outdated and conflicting instructions, but it reads the files, not your history, and it cannot tell which lines are still true of you.

A practical habit: when you correct Claude, ask whether the correction is a rule. When you open the file, remove a line that no longer applies.

## Where Coredence fits

Coredence writes the same kind of content from the traces you left rather than from what you happen to recall, and it does not touch your `CLAUDE.md`. It reads your Claude Code sessions, especially the moments you corrected it, and your git history and notes if you allow it, and consolidates them into memories like the rules above. Each memory keeps the messages it grew from, its signal strength is computed from how often it held, a memory seen once stays a draft, and conflicts are asked rather than resolved for you.

It hands the result to Claude Code as a skill and to every MCP client through a read-only server. Your own CLAUDE.md stays yours; Coredence is the part that keeps up.

Coredence runs on macOS 14 or later (Apple silicon) and Windows 10 or later, with no Coredence account. Consolidation needs a model, and you choose it: your Claude Code subscription, your own API key, or a local model through Ollama. On those paths Coredence itself is free to use. It is not open source. If you would rather not bring a key, its own [paid plans](https://coredence.com/pricing) include the model.

## Sources, checked on 8 November 2026

- [Claude Code docs: How Claude remembers your project](https://code.claude.com/docs/en/memory)
- [Claude Code docs: Skills](https://code.claude.com/docs/en/skills)
