coding

Teaching Claude to Write Its Own Coding Rules

Exploring how Claude can learn to generate and follow its own coding standards and best practices through iterative feedback and self-improvement techniques.

Someone on the Claude Code team shared a trick where they tell Claude to update its own rules after every mistake.

The command: After fixing something Claude got wrong, just say:

“Update your CLAUDE.md so you don’t make that mistake again.”

Turns out Claude is surprisingly good at writing guidelines for itself. The team keeps iterating this way until the mistake rate measurably drops - kind of like training it on your specific codebase quirks.

One person even runs a second Claude session to review the first one’s plan like a staff engineer doing code review. Pretty meta, but apparently it catches issues before implementation.

The CLAUDE.md file becomes this evolving playbook of “don’t do X because Y happened last time.” Works way better than repeatedly explaining the same corrections.