I read the CLAUDE.md files of 30 popular repos. Here is what they put in
TL;DR I pulled the root CLAUDE.md of 30 popular repos (25k to 282k stars) at a pinned commit. In 21 of them it is a symlink or a wrapper of 1 to 13 lines that hands off to AGENTS.md. Grafana's is one line: @AGENTS.md.
TL;DR
- I pulled the root
CLAUDE.mdof 30 popular repos (25k to 282k stars) at a pinned commit. In 21 of them it is a symlink or a wrapper of 1 to 13 lines that hands off toAGENTS.md. Grafana's is one line:@AGENTS.md. - What an agent ends up reading is a median of 179 lines, from 13 to 1,067.
- The most common contents are pointers to other docs (29 of 30), "never / do not" rules (28), build and test commands (26) and commit or PR rules (25). Code style rules come last, in 22.
- Across the wider set of 194 repos I checked, a root
AGENTS.md(88 repos) is more common than a rootCLAUDE.md(58).
I wanted real CLAUDE.md examples instead of advice about them, so I read the files that popular open-source projects actually commit. The pool was the 195 repos in our code-health dataset: we analysed 195 of the most-starred public repositories indexed on repowise.dev (1,000+ GitHub stars each, 253,688 production source files, November 2026). I checked each one's default branch on GitHub on 17 November 2026, and took the 30 most-starred repos that have a CLAUDE.md at the root.
The 30 are mostly TypeScript (11) and Python (6), with Go (4), JavaScript (3), Rust (3), Dart (2) and Ruby (1). They include react, ollama, anthropics/claude-code, grafana, apache/airflow, docker/compose, mem0, localsend, chatwoot and repomix. The median repo has 60,092 stars.
Do popular repos still write a CLAUDE.md, or an AGENTS.md?
Both, and mostly they keep one source of truth. First the wider count, across 194 of the 195 dataset repos (one returned 404):
repos 195 ok 194 errors 1
root CLAUDE.md 58
root AGENTS.md 88
either 96
both 50
So AGENTS.md, the file Codex, Cursor and other agents read, is already more common than CLAUDE.md at the root of these repos. About half the repos that have either file have both (50 of 96).
Inside the 30, I looked at what CLAUDE.md actually is. The git tree tells you whether a file is a symlink (mode 120000), and the content tells you the rest:
| What CLAUDE.md is | Repos | Examples |
|---|---|---|
A git symlink to AGENTS.md (or to the same file AGENTS.md links to) |
8 | airflow, compose, chatwoot, mem0, repomix |
A wrapper of 1 to 13 lines that points to AGENTS.md
|
13 | grafana, ollama, localsend, nautilus_trader, t3code |
| Its own full file | 9 | react, claude-code, hindsight, cognee, shannon |
Ten of the 13 wrappers use Claude Code's import syntax, a line with @AGENTS.md, so the content is loaded into context at session start. The other three say "see AGENTS.md" in plain text and leave the agent to open it. Three of the nine full files also cross-reference an AGENTS.md they keep next to them, and in hindsight it runs the other way: its AGENTS.md is three lines pointing to CLAUDE.md.
Count it up and 25 of the 30 repos tie the two files together on purpose. Only four (react, claude-code, shannon, pentagi) have no root AGENTS.md at all.
What a CLAUDE.md wrapper looks like
Grafana's CLAUDE.md is the shortest possible version:
@AGENTS.md
localsend's CLAUDE.md adds the one rule it wants Claude to see first, then imports the rest:
# CLAUDE.md
Always use **`fvm flutter`** / **`fvm dart`**, never the bare `flutter` / `dart` binaries ...
Full guidance for this repository lives in AGENTS.md:
@AGENTS.md
That is the pattern I would copy. Shared guidance lives in AGENTS.md, so every agent gets the same rules. CLAUDE.md holds only what is specific to Claude Code, or nothing.
If you go the symlink route, check how your team's Windows machines handle it. Git on Windows checks symlinks out as small text files unless core.symlinks is enabled, and then CLAUDE.md contains the literal text AGENTS.md. The @AGENTS.md import works everywhere.
How long is a CLAUDE.md file?
I measured what the agent ends up reading: the symlink target for symlinks, CLAUDE.md plus AGENTS.md for wrappers, and the file itself for full files.
| Median lines | Range (lines) | |
|---|---|---|
| All 30 | 179 | 13 to 1,067 |
| Symlinks (8) | 153 | 89 to 479 |
| Wrappers (13) | 183 | 25 to 734 |
| Full files (9) | 267 | 13 to 1,067 |
The middle half of the 30 sits between 107 and 267 lines. 19 of the 30 are 200 lines or shorter, and 6 are over 300. In words the median is about 1,900 (word counts undercount one repo whose file is mostly Chinese, so I lead with lines).
The short end is deliberate. React's file is 13 lines and does one job: it tells the agent which part of the monorepo it is in and that the compiler has its own instructions (CLAUDE.md):
## Monorepo Overview
- **React**: All files outside `/compiler/`
- **React Compiler**: `/compiler/` directory (has its own instructions)
That is the other common way to keep the root file small: put guides in subdirectories. 7 of the 30 point to nested AGENTS.md files, for example Grafana's docs/AGENTS.md and mem0's per-package guides.
What do people put in CLAUDE.md?
I tagged each file by section type with a script (headings plus a few body patterns), then went through every file by hand and corrected 14 tags. A file counts for a type if it has that content anywhere, as its own section or not.
| Section type | Files | Share |
|---|---|---|
Pointers to other docs (CONTRIBUTING.md, docs/..., nested guides) |
29 | 97% |
| "Never" / "do not" rules (off-limits paths, actions the agent must not take) | 28 | 93% |
| Build, test or lint commands | 26 | 87% |
| Commit, PR, branch or review rules | 25 | 83% |
| Repo layout (where code lives) | 24 | 80% |
| Code conventions (style, naming, patterns) | 22 | 73% |
Two things stood out to me.
Rules about behaviour are more common than rules about code. Style and naming came last. Linters and formatters already enforce most of that, and the files say so (mem0 lists which linter config applies to which folder). What a linter cannot enforce is "do not open a PR without asking" or "do not touch the release workflows", and that is where these files spend their words.
Almost every file is an index. 29 of 30 send the agent somewhere else: CONTRIBUTING.md, an AI policy, an architecture doc, a style guide. The root file stays short and the detail is read only when it is needed.
Real CLAUDE.md examples, by section
Commands. docker/compose (its CLAUDE.md is a symlink to AGENTS.md) opens with exactly what to run:
## Build & Test
- Build: `make build`
- Test all: `make test`
The rest of that section covers the unit test command that needs no Docker daemon and the e2e command that does. That kind of note saves an agent a failed run.
Do-not rules. mem0 (symlink to AGENTS.md) puts its "Do NOT" list at the top of the file, before the repository map:
## Do NOT
- Modify anything in `.github/workflows/` without explicit maintainer approval. Publishing credentials are pinned to workflow filenames.
- Commit `.env` files, API keys, or credentials.
- Skip pre-commit hooks.
- Use npm or yarn in TypeScript packages. This repo is pnpm-only (Bun in `integrations/opencode-plugin/`).
Each rule carries its reason or its alternative, which is what makes it usable.
Workflow. docker/compose again (AGENTS.md):
- Never create an issue or pull request without the user's explicit instruction.
Several repos write rules like this one, about what the agent may do in public on the maintainers' behalf. They read like a contributing guide written for a new kind of contributor.
Safety for CI. anthropics/claude-code's own CLAUDE.md is 40 lines on a single topic, how GitHub Actions jobs that call Claude are locked down, and it starts with "Keep them when you add or edit a workflow." A short file on the one thing an agent is most likely to get wrong in that repo.
A CLAUDE.md template from what these files share
Putting the counts together, this is the shape most of the 30 repos converge on. Shared content goes in AGENTS.md:
# AGENTS.md
One or two sentences on what this repo is.
## Do not
- Paths the agent must not edit, and why (generated code, release workflows, vendored code).
- Actions that need a human first (opening PRs, publishing, migrations).
- Secrets: never commit `.env` or keys.
## Commands
- Install: `...`
- Build: `...`
- Test one file: `...` (the fast loop the agent should use)
- Test all / lint: `...` (what CI runs)
## Where code lives
- `src/api/`: ...
- `src/web/`: ... (has its own AGENTS.md)
## Conventions the linter does not catch
- ...
## Commits and PRs
- Commit message format, branch to target, what a PR must include.
## Read before you change
- `CONTRIBUTING.md`, `docs/architecture.md`, nested guides.
And CLAUDE.md becomes:
@AGENTS.md
<!-- Claude Code only notes go here, if any. -->
Keep the root file around the middle of the range above, a couple of hundred lines at most, and push detail into the docs it points to. Our CLAUDE.md and AGENTS.md guide covers how Claude Code and other agents load these files, including imports and nested files.
How I got these numbers
All data was pulled on 17 November 2026 with the GitHub CLI, at each repo's default branch head. I recorded the commit SHA for every repo, so every file can be read exactly as I read it.
-
Pool. The 195 repos in the dataset above (selected for 1,000+ stars, before this post). For each one:
gh api repos/{repo}for stars and default branch,gh api repos/{repo}/commits/{branch}for the SHA, andgh api "repos/{repo}/contents?ref={sha}"for the root listing. -
Sample. The 30 repos with a root
CLAUDE.mdand the most stars at that moment (25,043 to 282,481). I took them in star order and dropped none. -
Files. Each
CLAUDE.mdandAGENTS.mddownloaded raw at the pinned SHA. Symlinks found from the git tree (gh api repos/{repo}/git/trees/{sha}, mode120000) and their targets read from the blob. -
Tagging. A Python script matched headings and a few body patterns per section type, printed the evidence line for each tag, and a hand check of all 30 files changed 14 of the 180 tags (for example a
# Single test file / patterncomment inside a code block that the script took for a conventions heading).
N 30
shape symlink 8
shape wrapper 13
shape full 9
at_import (@file.md line in CLAUDE.md) 10
commands 26/30 = 87%
layout 24/30 = 80%
conventions 22/30 = 73%
safety 28/30 = 93%
workflow 25/30 = 83%
pointers 29/30 = 97%
eff_lines median 179.0 min 13 max 1067 p25 107 p75 267
Lengths count the files an agent reads at the root (CLAUDE.md, and AGENTS.md where CLAUDE.md hands off to it), not docs those files point to. The repo pool came from repowise, the code index I work on. If you want a starting point for your own repo, repowise can generate a CLAUDE.md section from the indexed code and keeps it between markers, so the rules you write by hand stay yours.
FAQ
What should a CLAUDE.md file contain?
In these 30 repos: pointers to deeper docs, a short list of things the agent must not do, the build and test commands, commit and PR rules, and a map of where code lives. Style rules were the least common, because linters already enforce most of them.
Should I use CLAUDE.md or AGENTS.md?
Most of these repos use both, with one source of truth. 21 of the 30 make CLAUDE.md a symlink to AGENTS.md or a short file that imports it with @AGENTS.md, so Claude Code and other agents read the same rules.
How long should a CLAUDE.md be?
What the agent reads in these repos is a median of 179 lines, and the middle half is 107 to 267 lines. Files at the short end stay small by pointing to nested guides and other docs instead of copying them in.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.