Every time I start a new project with Claude Code, I add a CLAUDE.md. After enough projects, I know which rules survive and which ones get ignored after session two.
Here's what I actually keep.
The core rules (always in)
Minimal footprint. Only touch files directly related to the task.
Do not refactor adjacent code, add comments to unchanged files, or fix things "while you're in there".
Do not ask for confirmation before running shell commands or making edits.
Execute and report what you did.
When uncertain about file location or naming, ask before creating.
Do not guess.
After any significant change, run the existing tests and report results.
Do not mark work complete if tests fail.
Four rules. They cover scope creep, confirmation prompts, structural drift, and false completion. These go in every project.
What I took out
"Write clean, readable code." — This does nothing. Claude's baseline is already reasonably clean. The rule never fires in a useful way.
"Follow best practices." — Same problem. Too vague to mean anything. If there's a specific practice you want followed, name it explicitly.
"Add comments to explain your reasoning." — Sounds useful. In practice Claude adds a comment to every function explaining what the function does, which is the one kind of comment nobody needs. If you want comments on non-obvious decisions only, you need to say that.
Long lists of style rules. — I had a 40-rule CLAUDE.md for a while. Claude followed about 15 of them consistently. The others got lost in context. I trimmed to the 8 that actually mattered.
What goes in project-specific sections
After the core rules, I add a short project section:
## This project
Stack: Next.js 15, TypeScript, Tailwind
Components: src/components/ (no exceptions)
API routes: app/api/
Naming: kebab-case for files, PascalCase for components, camelCase for everything else
Tests: run npm test before marking anything complete
This section is the one that gets updated as the project grows. The core rules never change.
The rule I add last
Once the project has some history, I add this:
Before implementing anything, check if a similar function/component already exists.
Only create new code that doesn't already exist in the codebase.
This one doesn't make sense until you've watched Claude create a second Button component or a third date formatting helper. After you've seen it once, the rule goes in immediately.
I've collected 25 of these prompts — the ones that change specific Claude behaviors in specific situations — in the Agent Prompt Playbook. Pattern, explanation, and the exact wording that works. payhip.com/b/6rRkT, $29.
Top comments (0)