Audit and tune your CLAUDE.md
CLAUDE.md is the most impactful file in your repo. This tutorial walks through a systematic audit — measuring current quality, identifying anti-patterns, and shipping a better version.
Prerequisites
- An existing CLAUDE.md in your repo (any size)
- A few weeks of Claude Code usage to compare "before" and "after"
- Willingness to edit shared team docs
What you'll learn
- How to measure whether your CLAUDE.md is doing its job
- The five most common anti-patterns and how to fix each
- How to split behavior between CLAUDE.md, skills, and slash commands
- How to ship the changes without derailing your team
- How often to audit going forward
Most CLAUDE.md files are written once, in a hurry, and then rot. This tutorial is a systematic audit — the same one we run on our own files every quarter. The goal isn't to add more; it's to find what's not doing work and remove or restructure it. A shorter, sharper file usually produces better output than a longer one.
Before changing anything, capture what "before" looks like. Three numbers matter: total token count, section count, and average length per instruction.
# Token count (approx — 4 chars ≈ 1 token)
wc -c CLAUDE.md # then divide by 4
# Section count
grep -c '^##' CLAUDE.md
# Instructions per section (rough)
grep -c '^- ' CLAUDE.mdA healthy CLAUDE.md for a typical repo is 600-1200 tokens, 4-8 top-level sections, with tight instructions (usually one sentence each). If yours is much larger, the tuning work is mostly deletion.
Also grab a "before" prompt-response example. Pick a common task ("write a unit test for this handler"), record Claude's current response. You'll compare after tuning.
Search for "always" and "please always" in your CLAUDE.md. Each hit is a candidate for one of: (a) delete (it wasn't doing work), (b) rewrite with a specific trigger, or (c) move to a skill.
grep -n -i "always\|please" CLAUDE.md
# For each hit, ask:
# 1. Does this actually happen? (test — try a task where it should trigger)
# 2. Is the trigger clear? (if not, rewrite: "when X, do Y")
# 3. Is it about behavior vs about a task? (behavior → skill; task → slash command)From our own audit of one repo's CLAUDE.md: 11 "always" instructions, 8 deleted (weren't applying), 2 rewritten with triggers, 1 promoted to a skill. Net result: 40% shorter, output notably improved.
Every code example in CLAUDE.md carries outsized weight — Claude treats them like law. Which is great when they're current and bad when they've drifted.
# List every code block in CLAUDE.md
grep -n '```' CLAUDE.md
# For each example, ask:
# - Is this still how we write code today? (check against recent files)
# - If not, is it (a) update to reflect current, (b) delete, (c) explicitly labeled "legacy"?
# - Who owns keeping this current?Add owner comments to examples that stay. <!-- OWNER: @you LAST-VERIFIED: 2026-08 -->. Set a quarterly reminder. This prevents examples from silently rotting.
A common mistake: one CLAUDE.md that mixes "here's what this repo currently is" (repo-state) with "here's how our team writes code" (conventions). These have different lifecycles and different owners.
Split into two files. CLAUDE.md becomes tight, repo-state. A separate .claude/team-conventions.md (referenced from CLAUDE.md) holds cross-repo conventions.
# CLAUDE.md (repo-state, ~500-800 tokens)
- What this specific repo is
- Its stack, its patterns, its quirks
- Pointers to broader docs
# .claude/team-conventions.md (~500-800 tokens, shared)
- How our team writes error handling
- How we test
- How we do PR review
- Our vocabulary and definitions
# Auto-load the conventions file from CLAUDE.md with a reference:
# "Team-wide conventions are in .claude/team-conventions.md.
# Follow those unless this repo's local conventions override."Now each file has one owner and one lifecycle. The repo-state changes every sprint. The conventions file changes once a quarter. Both are focused. Both are maintainable.
Run the "before" prompt-response test from step 1 against your tuned CLAUDE.md. Compare responses. In our team's audit, the "after" response was: shorter, more specific to the actual task, and skipped the boilerplate reasoning that thick CLAUDE.md files force. Same request, better answer.
Look for instructions in CLAUDE.md that are really about "how Claude should behave when doing X" — not "what our repo is." These are candidates to extract as skills.
# In CLAUDE.md:
"When writing markdown tables, use the compact style.
Prefer tables for comparisons. Always cite sources when
quoting external content."
# This is behavior, not repo state.
# Extract to .claude/skills/markdown/SKILL.md:
---
name: markdown
description: Conventions for markdown output
---
## Tables
Use compact style. Prefer tables for 3+ comparable items.
## Citing sources
When quoting external content, cite the source URL.
## Code blocks
Always specify the language. Include a caption if useful.
# Now CLAUDE.md just references it:
# "For markdown output, follow the markdown skill."Skills activate contextually. When Claude is writing markdown, the skill's conventions apply. When Claude is doing anything else, they don't take up context space. CLAUDE.md gets shorter; behavior gets more targeted.
CLAUDE.md changes affect everyone on the team. Ship them like a feature, not like a docs edit.
# Before merging the audit PR:
- [ ] Run 3 common team tasks against the new CLAUDE.md; verify quality
- [ ] Post in #team-chat: "CLAUDE.md audit landing — here's what changed"
- [ ] Update team wiki page (if any) linking to it
- [ ] Have someone else's PR reviewed with the new file first,
to catch anything the audit missed
# After merging:
- [ ] Watch for "why is Claude behaving differently?" reports for a week
- [ ] Adjust based on real feedback (not theoretical concerns)The one-week feedback window is important. Big CLAUDE.md changes sometimes remove instructions that were quietly doing work; you don't know until you see the effect on real tasks. Be ready to add back specific items if the audit was too aggressive.
Recap
A CLAUDE.md audit: measure the starting state, delete unearned "always" instructions, update stale examples, split repo-state from conventions, extract behaviors to skills, ship carefully with a feedback window. Total time: two focused hours for a mid-sized file.
How often to do this: quarterly for actively-developed repos, twice a year for stable ones. The file rots gradually; audits catch it before the drift compounds.
Common gotchas
- You cut something that was quietly doing work: Watch team output for the first week. If someone reports "Claude used to do X and stopped," check whether the audit deleted the instruction that caused X. Add it back with a proper trigger if so.
- The skill extraction feels forced: Not every behavior should be a skill. Rule of thumb: extract when the behavior applies to a specific context (markdown output, code review, etc.). Don't extract cross-cutting instructions that apply everywhere.
- The team-conventions file becomes a dumping ground: Guard against it. Team conventions should describe how the team writes code, not everything the team believes. If a conventions file grows past ~1200 tokens, audit it too.
- Nobody owns updating the file: Assign one owner explicitly. Rotate quarterly if you want. Unowned docs rot regardless of how tight they start.
- You audit and then never audit again: The value compounds. First audit: big improvement. Second audit six months later: another meaningful improvement. Set a calendar reminder.
Get cctk to skip the boilerplate
Everything in this tutorial is already scaffolded in cctk — commands, subagents, hooks, MCP configs. Install and customize instead of starting from scratch.