Claude always makes mistakes in writing code? These 12 rules reduce the error rate to 3%
Claude's Coding Errors Drop to 3% with 12 Key Rules
In early 2026, Andrej Karpathy's critique of Claude's coding failures led to the creation of a CLAUDE.md file with 4 foundational rules: "Think before coding," "Prefer simplicity," "Make surgical edits," and "Execute goal-first." These effectively reduced common errors from 40% to 3% in applicable tasks.
However, as Claude Code evolved into multi-step agent workflows by May 2026, new failure modes emerged. Eight additional rules were developed to address these gaps:
5. Don't make non-linguistic decisions (e.g., API retry logic).
6. Set hard token budgets to prevent runaway iterations.
7. Expose conflicts; don't average contradictory code patterns.
8. Read existing code before writing to avoid duplication.
9. Ensure tests validate real logic, not just pass.
10. Use checkpoints for long-running, multi-step tasks.
11. Follow existing conventions over introducing new patterns.
12. Fail explicitly; avoid silent failures that appear successful.
Testing across 30 codebases showed the 12-rule version maintained a 76% adherence rate while reducing the overall error rate to 3%, covering new agent-specific issues. The key is to treat CLAUDE.md as a behavioral contract targeting observed failures, keeping it under 200 lines for effectiveness. Users should adapt the rules to their specific workflows.
marsbit05/14 10:07