Karpathy's Coding Rules Turned Into a CLAUDE.md, GitHub 232k Stars
Andrej Karpathy once complained about three problems with LLMs writing code: guessing, over-engineering, and making unrelated code changes. Someone turned his observations into a CLAUDE.md, GitHub 232k stars. Four behavioral rules that make coding agents go from grinding away heads-down to asking first and then writing.
Andrej Karpathy's programming rules have been turned into a CLAUDE.md file, which has just surpassed 232,000 stars on GitHub.
CLAUDE.md is a behavior-guide file in the root directory of projects such as Claude Code; AI coding agents read it before starting work. Karpathy is a former Tesla AI director and founding member of OpenAI. He previously tweeted about three problems with LLMs writing code: running heads-down under wrong assumptions, not clarifying confusion, and not surfacing tradeoffs; overcomplicating code and APIs, turning something that could be done in 100 lines into 1,000; and casually changing comments and code unrelated to their task.
Someone organized these observations into a repository: multica-ai/andrej-karpathy-skills. At its core is a CLAUDE.md with four behavioral rules, applicable to Claude Code, Cursor, Codex, and any environment that supports AGENTS.md.
Rather than writing longer prompts, it's better to constrain the agent's behavioral loop. This is probably why it has 232k stars.
The four rules:
- Think Before Coding: Think first, then write. Don't guess silently; lay out assumptions. When there are multiple interpretations, don't pick one on your own; if there's a simpler approach, say so directly. If something is unclear, stop and ask.
- Simplicity First: Simplicity first. Don't add unrequested features, don't create one-off abstractions, don't build unrequested "flexible configuration." If 200 lines can shrink to 50, rewrite it.
- Surgical Changes: Surgical changes. Only touch lines related to the request; don't casually "improve" nearby code, comments, or formatting. If you find unrelated dead code, mention it—don't delete it.
- Goal-Driven Loop: Goal-driven loop. Turn the task into "failing test -> fix -> loop until all green." For multi-step tasks, list a plan first, with verification conditions for each step.
This is exactly the opposite of how most people use it now. Many people are watching the agent work line by line; this file makes the agent ask first, cut code, and verify its own PRs. The original wording from the poster beamnxw is: "one file that forces it to ask first, cut 1,000 lines down to 100, and verify its own PRs."
Installation is not complicated: just put CLAUDE.md in the project root directory. For a new project, you can download it directly:
curl -o CLAUDE.md https://raw.githubusercontent.com/multica-ai/andrej-karpathy-skills/main/CLAUDE.md
The repository also provides a Claude Code plugin method so the rules take effect globally. See the repository README for the specific commands.
The video below comes from the original tweet:
The essence of these rules is to turn "telling the model what to do" into "defining success criteria and letting it iteratively converge on them." One Karpathy quote is included in the repository: "LLMs are exceptionally good at looping until they meet specific goals... Don't tell it what to do, give it success criteria and watch it go."
Of course, rules are not a panacea. The repository also reminds people: these guidelines favor caution over speed, and trivial tasks don't need the full workflow. Using it to keep non-trivial changes in check is enough.
发布时间: 2026-11-21 13:49