One free GitHub repo, one CLAUDE.md file, zero lines of code. Drop it into your project and Claude Code follows 4 rules that stop the most common AI coding mistakes, so you waste fewer credits on rewrites.
238k+GitHub stars
1 fileCLAUDE.md
4 rulesfor Claude Code
Checked on 1 December 2026. The repo is very active, so the star count keeps growing.
Founding member of OpenAI and former Director of AI at Tesla, one of the best-known names in AI. He wrote publicly about the mistakes AI models make when they write code. This repo turns those notes into 4 simple rules that Claude reads before it starts working.
The CLAUDE.md file itself was written by developer Jiayuan (repo multica-ai/andrej-karpathy-skills), based on Karpathy's observations.
The problem it fixes
Wrong guessesThe AI assumes things about your project and keeps going without asking.
Too much codeIt writes 1000 lines and extra layers when 100 lines would do.
Side damageIt changes or deletes code and comments that had nothing to do with the task.
The 4 rules
What Claude starts doing
These four rules are the whole file. Each one targets one of the mistakes above.
01
Think Before Coding
Don't assume. Don't hide confusion. Show the tradeoffs.
Says its assumptions out loud, and asks when it is not sure.
If your request can mean two things, it shows both instead of picking one silently.
Pushes back when there is a simpler way.
Stops and asks when it is confused.
02
Simplicity First
Minimum code that solves the problem. Nothing extra.
No features you did not ask for.
No extra layers or "flexible" settings for one-time code.
If 200 lines could be 50, it rewrites it.
The check: would a senior engineer call this overcomplicated? If yes, simplify.
03
Surgical Changes
Touch only what is required. Clean up only its own mess.
Doesn't "improve" nearby code, comments or formatting.
Doesn't refactor things that aren't broken, and matches your existing style.
Mentions unrelated dead code instead of deleting it.
Removes only the leftovers that its own change created.
The check: every changed line should trace back to your request.
04
Goal-Driven Execution
Define what success means, then test until it is true.
Instead of a vague task, Claude turns it into a goal it can check, and keeps going until the check passes:
Instead of…
Claude does…
"Add validation"
Writes tests for bad inputs, then makes them pass
"Fix the bug"
Writes a test that shows the bug, then makes it pass
"Refactor X"
Makes sure the tests pass before and after
For bigger tasks it writes a short plan where every step has a "verify" check.
Using Cursor? The repo also has a ready Cursor rule in .cursor/rules/karpathy-guidelines.mdc; see CURSOR.md in the repo.
Test it · ask Claude Code
Add input validation to the signup form. Before you write code, tell me your assumptions and your success criteria, then write the tests first and make them pass.