How to audit your CLAUDE.md with /doctor prompt-audit

By

Tagged: AI

Claude Code's /doctor prompt-audit finds stale facts, contradictions and dated wording in CLAUDE.md, AGENTS.md and your skills. I ran it on this site's repo.

Lydia Hallie, from the Claude Code team at Anthropic, posted a reminder on X to run /doctor prompt-audit in your Claude Code repos.

I ran it on the repo of this site. The CLAUDE.md here is 107 lines long, and I thought it was in good shape. The audit found ten problems in it, and five of them are facts that are wrong today.

What it does

/doctor prompt-audit makes Claude read your instruction files. That’s the text that loads into Claude Code sessions: CLAUDE.md, AGENTS.md, rules, skills, custom commands and subagents.

It looks for three kinds of problems:

You get a report and a proposed diff. Nothing in your files changes until you ask Claude to apply an edit. The Claude Code docs describe it in a few lines.

It needs Claude Code 2.1.283 or later, and /checkup prompt-audit is an alias. Plain /doctor, without the subcommand, is a different checkup. It looks at your installation, your extensions and your permissions.

Why instruction files need it

CLAUDE.md loads at the start of every session. A wrong line in it misleads the agent every time, and nothing tells you it happened.

Mine was created by /init on July 17, 2025. Since then I kept adding sections at the bottom and never went back to the top. In the meantime pages were renamed, and the posts folder went from 500 files to 2,265.

The other reason is the models. Instructions written a year ago often shout, because older models needed it. Current models follow instructions more literally, so the same emphasis now makes them over-apply a rule.

Run it

Open Claude Code in your project and type the command:

/doctor prompt-audit

This audits everything that loads into sessions in this project. To audit one file or one folder, pass its path:

/doctor prompt-audit CLAUDE.md

I started with this one, on the CLAUDE.md in the root of the repo.

Claude Code running /doctor prompt-audit CLAUDE.md, with the scope and model it assumed and a summary of the stale facts it found

Claude read the file, then checked what it says against the repo. It listed the folders the file names, read package.json and src/content.config.ts, and used git blame to date the lines. It took 1 minute and 6 seconds.

The report opens with what it assumed: the scope, which was ./CLAUDE.md only, and the target model. Mine was Claude Opus 5.5, the model my session runs on. Claude judges the wording against that model, because a workaround that an older model needed is dead weight on a newer one.

If the command answers that the audit isn’t available, the bundled claude-api skill is turned off in your settings, with skillOverrides or disableBundledSkills. The audit runs through that skill.

How /doctor prompt-audit worksClaude lists the instruction files, then checks the paths and commands they name against the repository, compares files that rule on the same point, and compares the wording with the model the session runs on. The result is a report ordered by confidence and a proposed diff. Files are edited only when you ask.only when you askInstruction filesInventory of whatloadsPaths and commandschecked in the repoRules on the samepoint comparedacross filesWording comparedwith the session'smodelReport, ordered byconfidenceProposed diff, onehunk per findingEdits applied

What it found in my CLAUDE.md

The file had almost no shouting. The problem was the sections /init wrote in 2025, which no longer match the repo.

LineCLAUDE.md saysThe repo saysConfidence
34-35description and tag are optional in the frontmatterboth are required in src/content.config.tsHigh
45-46pages live in blog.astro and books.astroneither file exists, they’re blog/[...page].astro and ebooks/[slug].astroHigh
106”Use TypeScript for all code implementations”functions/, lib/ and scripts/ are all .js and .mjsHigh
30MDX is how content is writtenthe posts collection only loads *.mdHigh
48”500+ files” in the posts folder2,265 filesHigh
75, 78two notes about things removed in the past, with dateshistory, with nothing for the agent to doMedium
84”No Cursor rules or Copilot instructions detected”.cursor/rules/ has 4 filesMedium
105”Always use the latest version of Tailwind (v4)""latest” next to a pinned version goes stale at v5Low

I checked the five high-confidence ones by hand, and they’re all correct.

The first is the worst. An agent that writes a post from that list leaves out the description, and the build fails.

The TypeScript line is one I would never have caught. Read literally, it tells the agent to write TypeScript in folders where every file is plain JavaScript, or to convert them.

Each finding quotes the text, says where it is and why it’s stale, and ends with a confidence level and an action. The low-confidence ones are only flagged, with no edit proposed.

The findings in Claude Code: a table with the count for each group, then each finding with its location, evidence, reason, confidence and action

The report also says what it left alone. My rules about redacting IP addresses in screenshots stayed, because they give their reason and every path in them exists. The audit keeps the context only you can provide, even when it’s long.

The proposed diff

After the findings comes a diff, with one hunk per finding. This is the one for the two pages that don’t exist and the posts count:

@@ CLAUDE.md:44-48 — findings 2 and 5
 │   ├── [slug].astro    # Dynamic blog post pages
-│   ├── blog.astro      # Blog listing page
-│   ├── books.astro     # Technical handbooks page
+│   ├── blog/           # Blog listing pages ([...page].astro)
+│   ├── ebooks/         # Technical handbooks pages
 │   └── rss.xml.ts      # RSS feed generation
-├── posts/              # Markdown blog posts (500+ files)
+├── posts/              # Markdown blog posts (2,000+ files)

And the one for the TypeScript rule:

@@ CLAUDE.md:106 — finding 3
-- Use TypeScript for all code implementations  
+- Use TypeScript in `src/`; `functions/`, `lib/` and `scripts/` are plain JavaScript (`.js`/`.mjs`), so match the file you're editing

The proposed diff in Claude Code, with removed lines in red and their replacements in green, one hunk per finding

Every hunk stands alone. To take some of them, reply in the same session and say which ones to apply.

Be careful with the rewrites. The new text restates a fact from the repo as it is today, so read each hunk before you accept it. One of mine replaced the list of frontmatter fields with “the other fields are optional”, and the report itself noted that this line is vague.

Audit the whole setup

Then I ran it with no path:

/doctor prompt-audit

This one took 6 minutes and 44 seconds, because it also covers ~/.claude. That’s my global CLAUDE.md and about 30 skills. It handed my 19 personal skills to a subagent, then checked three of the subagent’s findings itself.

It counted 23 findings. One was about wording, and 22 were stale facts and contradictions. Some of them:

The finding that surprised me is about AGENTS.md itself. It doesn’t load in my Claude Code sessions at all. When a repo has both files, Claude Code reads only CLAUDE.md. I keep my rules for writing posts in AGENTS.md, so Claude never saw them.

The fix is one line in CLAUDE.md, which imports the other file:

@AGENTS.md

Edits to files under ~/.claude are marked “all projects” in the report, because those files load everywhere. For installed plugins it only reports. And it didn’t open my settings files, .mcp.json or ~/.claude.json, because they can hold secrets.

Here are the two runs side by side:

One fileEverything
Command/doctor prompt-audit CLAUDE.md/doctor prompt-audit
What it readCLAUDE.md, plus AGENTS.md to look for conflictsthe project’s files, ~/.claude/CLAUDE.md, my skills, the plugins
Time1m 6s6m 44s
Findings1023
Edits outside the projectnonemarked “all projects”

Run it twice and the report changes

I ran the CLAUDE.md audit a second time, without opening a session:

claude -p "/doctor prompt-audit CLAUDE.md" --allowedTools "Read,Glob,Grep"

This run took 1 minute and 19 seconds and found 12 problems, where the first found 10.

Both runs agree on the five high-confidence facts. They differ at the edges. The second flagged a description of the build command that leaves out the checks it runs, and a “20+ handbooks” count. The first flagged the port of the dev server.

The first report also had a slip of its own. Its summary says nine issues, and its table lists ten.

It’s a model reading your files, so I treat the report like a review from a careful colleague. The high-confidence findings are checked against the repo, and I found no wrong one. The medium and low ones are judgment calls, and I decide on those.

When to run it

My advice is to run it when a new model comes out, and after any big change to the repo, like a migration or a renamed folder.

Start with the path form on your main CLAUDE.md. It takes about a minute, and the findings are easy to check by hand. Run the full audit when you have time to read a long report, because it also goes through every skill you have.

If your app calls the Claude API, there’s a version of this audit for your system prompts and tool descriptions. It’s /claude-api prompt-audit.

Want me to talk about your product? You can sponsor this site.

Related posts about ai: