Make Claude write its own rules
Free. No signup.
Researchers checked the AI rules files on the 100 most popular GitHub projects that use one, and only 9 had no mistakes. Most were too long or never updated. Here's the setup the team that built Claude Code uses instead: every time Claude messes up, that mistake goes in the file.
What you need
- Claude Code works best for this, since Claude can edit its own
CLAUDE.mdfile. Run/memoryto open it. - In the Claude app, Claude can't edit your project instructions itself, so it hands you the line and you paste it in. That version is at the end of step 1.
Let it write its own rules
This is how the Claude Code team runs their own file: anytime Claude does something wrong, they add it to CLAUDE.md so it doesn't happen again. Paste this at the bottom of your CLAUDE.md:
## Lessons When I correct you, or you realize you got something wrong, add one short line under this heading saying what to do instead, so you don't make that mistake again. One sentence per lesson. Don't add a lesson that's already here, and don't add anything my linter or formatter already checks. If this file gets close to 200 lines, tell me and suggest what to cut.
The point is your rules come from real mistakes, not guesses about problems you haven't had yet. Read the new lines every so often and delete any that are wrong.
Using the Claude app instead? Put this in your project instructions:
When I correct you, or you get something wrong, end your reply with one line I can paste into my project instructions so you don't make that mistake again. One sentence. Skip it if the lesson is already in my instructions.
Clean up the file you have
Anthropic's docs say to keep each CLAUDE.md under 200 lines, because longer files use more context and Claude follows them less. 42 of the 100 files in the study were over that. If yours is long, run this once:
Read my CLAUDE.md and clean it up. Keep it under 200 lines. Cut anything my linter or formatter already enforces (naming, formatting, import order). Move instructions that only matter for rare tasks into separate files, and leave one line in CLAUDE.md saying what each file is for and when to read it. If two rules contradict each other, ask me which one wins. Show me the line count before and after and every line you cut, and wait for me to approve before you save.
Check it's not out of date
24 of the 100 files had never been changed since the day they were made, even though the projects kept changing. If you made yours with /init and never touched it again, run this:
Check the git history for CLAUDE.md and for the rest of the project. List anything in CLAUDE.md that's out of date now (files that moved, commands that changed, things we stopped doing) and propose the updated lines. Don't change anything until I approve.
Where the numbers come from
- dos Santos et al., "Configuration Smells in AGENTS.md Files" (2026): the 100 most-starred GitHub app projects with a
CLAUDE.mdorAGENTS.md. 91 had at least one of six common mistakes, 9 had none. Read the paper - Anthropic's Claude Code memory docs: keep
CLAUDE.mdunder 200 lines. Docs - Boris Cherny, creator of Claude Code, on how his team updates
CLAUDE.mdwhenever Claude makes a mistake. VentureBeat
Stuck?
DM me on Instagram (StilesAI). It's free, I got you.
DM @StilesAI