News listAndrej Karpathy's distillation of the "CLAUDE.md Four Principles" goes viral on GitHub, boosting AI coding accuracy to over 90%
動區 BlockTempo2026-05-22 12:42:00

Andrej Karpathy's distillation of the "CLAUDE.md Four Principles" goes viral on GitHub, boosting AI coding accuracy to over 90%

ORIGINALAndrej Karpathy 提煉「CLAUDE.md 四大準則」引爆 GitHub,讓 AI 寫 Code 準確率飆破 90%
AI Impact AnalysisGrok analyzing...
📄Full Article· Automatically extracted by trafilaturaGemini 翻譯1754 words
The god-tier Prompt that makes AI obedient has been revealed! Recently on GitHub, a file named `CLAUDE.md` has surged to the top of the trending list. Based on the "four coding principles" distilled from the observations of former OpenAI AI Director Andrej Karpathy, this file acts as if it has implanted the soul of a senior engineer into the AI. By simply placing it in the project root directory, AI tools like Claude Code can see their code accuracy soar from 65% to over 90%, effectively curing the bad habits of AI stealthily modifying code and over-engineering. (Previous coverage: Claude Code introduces /goals command: separating execution from evaluation to prevent AI agents from being lazy or lying) (Background: OpenAI founding member Andrej Karpathy announces joining Anthropic: returning to the front lines of LLM R&D) As AI-assisted development tools like Claude Code and Cursor become increasingly popular, many developers face a common pain point: while AI writes fast, it is often "too clever for its own good," not only making assumptions and over-designing but even arbitrarily changing perfectly fine code. However, this problem now has an ultimate solution. Renowned AI expert and former OpenAI AI Director Andrej Karpathy recently provided a profound analysis of the common failure modes of Large Language Models (LLMs) when writing code; subsequently, developers like Forrest Chang distilled its core philosophy into a simple file named `CLAUDE.md`. This project (forrestchang/andrej-karpathy-skills) recently skyrocketed to the top of the GitHub trending list, garnering hundreds of thousands of Stars. Many developers have excitedly reported after testing that, upon introducing this file, the accuracy of AI-generated code jumped significantly from around 65% to an astonishing 90% or more. Unveiling the "Four Golden Rules" of `CLAUDE.md` This magical `CLAUDE.md` file is essentially a "Senior Engineer's Handbook" for AI. When placed in the project root directory, Claude Code automatically reads it and uses it as the highest behavioral guide for the entire session. Its core contains the following four ironclad rules: - 1. Think Before Coding: "Don't assume. Don't hide confusion. Lay out trade-offs." It forces the AI to explicitly state its assumptions. If it encounters uncertain requirements or multiple solutions, the AI must proactively stop and ask the user instead of silently guessing and writing blindly. The AI is also empowered to "push back" when faced with unreasonable requests. - 2. Simplicity First: "Write only the 'minimum code' to solve the problem. No speculation." The AI is strictly forbidden from "adding extra drama." It is not allowed to write defensive code for scenarios that will never happen, nor is it allowed to create complex abstract architectures for a single task. The principle is simple: if a problem can be solved in 50 lines, never write 200. - 3. Surgical Changes: "Only touch what you must. Only clean up the code you messed up." This is a favorite among many developers. This rule strictly prohibits the AI from "conveniently" refactoring or changing adjacent code, comments, and formatting while fixing a specific bug. Every line of change must be directly traceable to the user's explicit requirements. - 4. Goal-Driven Execution: "Define success criteria. Verify in a loop until achieved." It requires the AI to transform vague tasks into verifiable, concrete goals. For example, when encountering a "fix bug" command, the AI's standard action must be: first write a test that reproduces the bug ➔ then modify the code ➔ finally make the test pass, forming a rigorous verification loop. Why is this Prompt so effective? The nature of LLMs is to please the user, and they are extremely prone to "hallucinating assumptions" and "scope creep." The greatness of this `CLAUDE.md` lies in the fact that it hard-codes the "common sense and restraint" of human senior engineers into a System Prompt. Through these four principles, the AI is forced to become more cautious, focused, and result-verifiable. Many developers who have benefited from this say that their Git Diff is now cleaner than ever, bugs have been significantly reduced, and subsequent maintenance is much easier. This no longer feels like commanding a machine out of control, but rather truly experiencing the pleasure of Pair Programming with a reliable "Senior Engineer."
Data Status✓ Full text extractedRead Original (動區 BlockTempo)
🔍Historical Similar Events· Keyword + Asset Matching6 items
💡 Currently matching via keywords + symbols (MVP) · Will be upgraded to embedding semantic search later
Raw Information
ID:f6f851dccb
Source:動區 BlockTempo
Published:2026-05-22 12:42:00
Category:zh_news · Export Category zh
Symbols:Unspecified
Community Votes:+0 /0 · ⭐ 0 Important · 💬 0 Comments