Claude Code · 8 min read

Generated CLAUDE.md Files Contain More Useful Commands Than Hand-Written Ones

At my training sessions, CLAUDE.md is a frequent source of questions. So that I'm not just passing on impressions but real experience, I built a tool some time ago that regularly scans Git repositories and tracks trends for me. Let's get some order into this topic!

CLAUDE.md is a file in the repository root that Claude Code loads at the start of every task. You write into it how the project is built, how it’s tested, what conventions it has, and what the agent must not do. Other agents (Codex, Cursor, Copilot) read a similar file called AGENTS.md. At trainings I keep getting the same question: what should I put in there? Somewhere on the internet they said you must stress “don’t make mistakes”!

Instead of offering another personal opinion, I decided to look at what everyone else writes there.

The data. The basis is a database of 110,000 CLAUDE.md files from a hundred thousand GitHub repositories, covering June through November, which I put together by scanning sources. What am I tracking? What people write into the files and what’s missing from them.


Half of the repositories are already dead

Before you believe any statistics about CLAUDE.md, look at where they come from. In a sample of 3,000 repositories, 45% had not a single new commit after four months, and another 5% had vanished or gone private. So roughly half are dead. So much for the longevity of vibe-coded projects. Let’s just hope that most of those 5% of vanished repositories moved on to commercial success and their owners made them private because of it 😎

A large share of public CLAUDE.md files are weekend experiments. Anyone who tells you “we analyzed tens of thousands of files and people do this” is mostly describing abandoned projects. That’s why for the deeper analysis I picked only living projects: at least 10 commits in the last three months. For part of the analysis I was stricter still: at least 1,000 stars and five active authors. There are 2,433 such projects. These are also the projects where it pays for the authors to tune and set up the project context well. When it’s just for ourselves, we talk ourselves into all sorts of things…


The agent doesn’t know how to verify its work

An AI agent that changes code needs to know how to check that it hasn’t broken anything. The fastest way is to run the tests. Ideally just the one test the change touches, because the whole suite can run for tens of minutes. So it’s a good idea to put instructions about testing into the context. How do people do it?

Command for testsCommand for a single test
All files in the repository root37%15%
Repositories with 1,000+ stars53%27%
Living and popular projects55%28%

Two thirds of the files don’t tell the agent how to run the tests. For large projects it’s better, but still only about half. Some projects have no tests at all, and it’s fair to admit that. But then the agent either runs the whole suite or verifies nothing.

There are big differences between languages. In Go and Rust, around 64% of files have a test command; in JavaScript only 26%. The “run the tests before you commit” culture evidently carries over into instructions for agents as well.


Unfortunately, the generated file beats the hand-written one

This surprised me the most. Claude Code can generate the file itself with the /init command. You can recognize such a file by the opening sentence it inserts. I would have expected hand-written files to be more thoughtful. The data says the opposite:

Files from /initHand-written
Command for tests45%32%
Command for a single test29%8%
ALL-CAPS prohibitions (NEVER, MUST…)13%22%

Hand-written files have more prohibitions and more shouting, but fewer practical commands. People write what annoys them (“NEVER delete tests!”) and forget what the agent needs every minute.

A caveat: the header from /init stays in the file even if the author rewrites it later. So some of the “generated” files are generated and then hand-improved. Even so, the practical advice follows: let the file be generated, then edit it. Writing from scratch doesn’t pay off. Especially if you’re a beginner and don’t really know what to put in CLAUDE.md…


Files grow, mistakes stay

For the 804 files that changed between July and November, I compared both versions. 494 got longer, 220 got shorter. So people mostly add.

But they rarely fix things. A test command was added in only 53 files, a single-test command in 17. Personal paths from the author’s computer (C:\Users\…, /Users/…), which don’t work anywhere else and reveal the username, disappeared from 16 files and appeared in 9 more. Yet roughly every sixteenth file has them.

To me, this is the most practical finding for anyone who uses CLAUDE.md: the file won’t improve on its own. If you don’t go through it with a checklist once in a while, it will just keep swelling. I know this from experience: I recently looked into my big project, which has a twenty-thousand-line CLAUDE.md where every single decision was being recorded. Of course that’s maximally inefficient. Decisions should be written to a separate file on the side!


AGENTS.md is displacing CLAUDE.md

In living popular projects, 15% switched to AGENTS.md within four months. Half of them deleted CLAUDE.md; the other half left in it a single line, @AGENTS.md, which pulls in the contents of AGENTS.md. For small projects without stars it was only around 2%. Part of the reason is probably that Claude Code now imports AGENTS.md if there is no CLAUDE.md.

The reason is practical. Large projects have contributors who use different agents, and nobody wants to maintain two files with the same content. If you work on a team where one person uses Claude Code and another Cursor or Codex, it’s time to unify the instructions in AGENTS.md. CLAUDE.md can then contain just the import and things specific to Claude. The earlier thesis that Claude Code has a somewhat different harness and therefore needs a different set of commands no longer holds; modern models cope with it somehow.


Agent memory so far lives mostly on social media

On X and in blogs there’s a lot of writing about agents that keep memory, a mistake log, and lessons learned between sessions. In the 2,433 best living projects, 4% of projects use something like that. The “agent writes down where it went wrong” mechanism is in roughly 1%. I don’t have the best experience with it myself: if you set it up badly, you end up writing into the swelling CLAUDE.md (mentioned above) or into a file nobody reads. Memory matters mainly for projects with multiple developers, where context transfer has to be handled; if you develop alone, then in my experience the improvement is negligible and often not worth the work.

How do those for whom it works do it? In the sample I found two approaches that leave verifiable traces in the repository history. The claude-desktop-debian project (an unofficial Claude Desktop package for Linux) has a docs/learnings/ directory: one page per type of debugging problem. The agent is supposed to read it before starting work in that area, and adds a new entry when it discovers something non-obvious. Outdated entries go to an archive with a header saying they no longer apply. Since May, 17 entries have been added to the directory in 65 commits (source: the project’s AGENTS.md).

The second approach belongs to Distr (an open source platform for distributing software to customers): when a user corrects the agent, the agent adds a rule to CLAUDE.md. But under strict rules: only an instruction on what to do and where, no description of the system and no history. CLAUDE.md has changed in 29 commits since September, mostly by a line or two within regular work (source: the project’s CLAUDE.md). What both have in common is that the learnings go into a shared file that goes through review in a PR, and that it’s clear what belongs in it and what doesn’t.

Among projects that themselves develop AI tools, working with agent memory is two to three times more common than elsewhere. Large mainstream projects haven’t touched it yet. They store their knowledge differently: in nested AGENTS.md files in individual modules (34% of projects), in skills (roughly 20%), and in references like “before working on X, read document Y”.

Documentation is in a similar situation. 72% of the top projects have a docs/ directory, but only 8% instruct the agent to update the documentation when changing code. The agent has the documentation available, but almost nobody asks it to maintain it. How the few projects that do this well handle it will be the subject of my next article.


What to take away: five half-hour fixes

If you open your CLAUDE.md today, check this:

  1. Is there a command for tests and a command for running a single test? Only 15% of files have it, and yet it saves the agent the most time.
  2. Do you have paths from your own computer in there? They don’t work anywhere else and reveal your name.
  3. Is every ALL-CAPS prohibition really needed? Whatever can be enforced through permission settings or hooks doesn’t belong in text where the agent can overlook it. Ask Claude whether it could rewrite the instruction as a hook. For rules that can be checked mechanically, that’s better; rules that rely on judgment, like “write clean code”, won’t work as a hook.
  4. Is the file over 200 lines? Roughly every fifth one is past that threshold. Split it into nested files by module and call the modules only via a backslash, not via the at sign. The backslash lets the agent skip loading the file when it isn’t needed, while the at sign forces it to load it.
  5. Does your team use multiple agents? Move the content to AGENTS.md and leave an import in CLAUDE.md.

And one more rule that I saw in the best-maintained projects: when the agent makes the same mistake a second time, add a rule. When a rule stops making sense, delete it. A file that only grows eventually goes unread by everyone. Even the agent. How do you judge whether a rule still makes sense?

  • Next to each rule, write in one sentence why it came about. When the reason disappears, it’s visible.
  • A rule that points to a nonexistent path or command is outdated. You can search for those automatically too (say, on every commit, or once a month or week during a project review).
  • After a new model, try switching the rule off and give the agent a task where it used to err. If it doesn’t repeat the mistake, the rule goes. But that requires remembering to do it in time, and keeping a record of the mistakes.

A note on the data: The analysis is based on the claude-repo-files database (state as of July 2026), the GHAgentFiles dataset from the University of Mons (license CC BY 4.0), and my own download of the current state of the repositories on November 14, 2026. I determined file features (test commands, paths, prohibitions) automatically from the text and verified them manually on samples, so treat the numbers as approximate. It covers only public repositories; corporate practice may differ. Claude Code and the conventions around AGENTS.md change by the week.

Patrick Zandl trains teams in Claude Code and agentic software development in Prague and writes about what actually works in real-world AI-assisted projects. Follow on LinkedIn

Read next

Get the next one by email

Every Tuesday: what changed in Claude Code, Codex and other coding agents, plus new articles. No spam.