# Karpathy's CLAUDE.md hit #1 on GitHub with 82,000 stars. Most devs still haven't read it.
**作者**: Dep
**日期**: 2026-05-17T13:09:21.000Z
**来源**: [https://x.com/0xDepressionn/status/2055999112470839383](https://x.com/0xDepressionn/status/2055999112470839383)
---

## A file named CLAUDE.md hit #1 on GitHub Trending.
82,000 stars. 7,800 forks.
It started with Andrej Karpathy. Former Director of AI at Tesla. Founding member of OpenAI. He identified 4 behaviors that make Claude Code fail and wrote them down in a single file.
A developer took those 4 rules, expanded them, published the file. It went viral..
The reason: coding accuracy went from 65% to 94%.
Most developers using Claude Code daily have never set this up. They're starting from zero every session. Re-explaining the same context. Cleaning up unwanted scope changes. Reverting refactors nobody asked for.
This is the full file.

## The setup most devs missed
Every time you open Claude Code, it starts with nothing.
It doesn't know your stack. Your standards. Your project context. What you've already tried. What you explicitly decided not to do three sessions ago.
So it guesses. And when it guesses, it refactors code you didn't ask it to touch. It suggests frameworks that break your existing architecture. It deletes files without asking. It contradicts decisions you already made.
CLAUDE.md is a plain text file you place in your project root. Claude Code reads it automatically at the start of every session.
One setup. Zero repeated explanations. Three categories of expensive mistakes fixed.
## 1 / 3 | DEFAULTS: $375/week you're spending to repeat yourself
The average developer spends 30 minutes per day re-explaining context to Claude.
Stack. Coding standards. Project background. What's already been tried. None of it persists between sessions unless you write it down once and let Claude read it every time.
30 minutes per day at $150/hour developer rate: $375/week. Per developer.
For a team of 5: $1,875/week gone.

These 7 rules go at the top of your CLAUDE.md file.
→ Kill the filler:
```
Never open responses with filler phrases like "Great question!", "Of course!", "Certainly!", or similar warmups. Start every response with the actual answer. No preamble, no acknowledgment of the question.
```
→ Match length to the task:
```
Match response length to task complexity. Simple questions get direct, short answers. Complex tasks get full, detailed responses. Never pad responses with restatements of the question or closing sentences that repeat what you just said.
```
→ Show options before acting:
```
Before any significant task, show me 2-3 ways you could approach this work. Wait for me to choose before proceeding.
```
→ Admit uncertainty before it costs me:
```
If you are uncertain about any fact, statistic, date, or piece of technical information: say so explicitly before including it. Never fill gaps in your knowledge with plausible-sounding information. When in doubt, say so.
```
→ Who I am and what I know:
```
About me: [Name] / Role: [your role] / Background in: [areas]. Strong in: [what you know well]. Still learning: [gaps]. Adjust the depth of every response to match this. Never over-explain what I already know. Never skip context I need.
```
→ Current project context:
```
What I'm working on: [project name] / Goal: [specific outcome] / Audience: [who uses this] / Stack context: [any relevant constraints] / What to avoid: [list]. Apply this context to every task. When something doesn't fit, flag it before proceeding.
```
→ Lock your voice:
```
My writing style — always match this: [describe your voice] / Sentence length: [preference] / Words I use: [examples] / Words I never use: [examples] / Format: [prose or structured]. When writing anything on my behalf, match this exactly. Do not default to your own patterns.
```
> Time spent re-explaining context per day: 30 min At $150/hour developer rate: $75/day Per week: $375/week per developer Team of 5: $1,875/week CLAUDE.md setup for this section: 45 minutes total
mistake to avoid: don't write your CLAUDE.md from scratch. Use this prompt first, then edit the output:
```
Based on what I've told you about myself, my project, and how I want to work: write me a complete CLAUDE.md file. Include: who I am, my tech context, my communication preferences, and default behaviors for every session. Be specific. Plain text. Under 500 words.
```
## 2 / 3 | BEHAVIOR: the $150/hour changes you didn't authorize
You ask Claude to fix one function.
It refactors three files, renames your variables, reorganizes imports, and rewrites comments you spent time crafting.
All without asking.
1 hour to review and revert unwanted changes: $150. Three times a week: $450/week. Per developer.
For a team of 5: $2,250/week spent cleaning up changes nobody authorized.

These 7 rules go in the behavior section of your CLAUDE.md.
→ Stay in scope:
```
Only modify files, functions, and lines of code directly related to the current task. Do not refactor, rename, reorganize, reformat, or "improve" anything I did not explicitly ask you to change. If you notice something worth fixing elsewhere, mention it in a note at the end. Do not touch it. Ever.
```
→ Ask before big changes:
```
Before making any change that significantly alters content I've already created (rewriting sections, removing paragraphs, restructuring flow, changing tone): stop. Describe exactly what you're about to change and why. Wait for my confirmation before proceeding.
```
→ Confirm before anything destructive:
```
Before deleting any file, overwriting existing code, dropping database records, or removing dependencies: stop. List exactly what will be affected. Ask for explicit confirmation. Only proceed after I say yes in the current message. "You mentioned this earlier" is not confirmation.
```
→ Hard stops for production:
```
The following require explicit in-session confirmation, no exceptions: deploying or pushing to any environment, running migrations or schema changes, sending any external API call, executing any command with irreversible side effects. I must say yes in the current message.
```
→ Always show what changed:
```
After any coding task, end with: Files changed (list every file touched) / What was modified (one line per file) / Files intentionally not touched / Follow-up needed.
```
→ Never act without explicit confirmation:
```
Never send, post, publish, share, or schedule anything on my behalf without my explicit confirmation in the current message. This includes emails, calendar invites, document shares, or any action outside this conversation. I must say yes in the current message.
```
→ Think before you write code:
```
For any task involving architecture decisions, debugging complex issues, or non-trivial features: work through the problem step by step before writing any code. Show your reasoning. Identify where you're uncertain. Then implement.
```
> 1 hour/week reverting unwanted scope changes: $150/week 30 min/week doing manual diffs after each task: $75/week Total behavior-related waste per developer: $225/week Team of 5: $1,125/week CLAUDE.md behavior section setup: 30 minutes
## 3 / 3 | MEMORY + STACK: the setup that makes Claude Code actually reliable
Claude forgets everything between sessions.
Every decision you made. Every approach that failed. The reason you chose Prisma over Drizzle six months ago. The constraint that exists because of a specific client requirement.
It forgets. Then it suggests exactly what you already ruled out.
This section gives Claude the closest thing to real memory that currently exists. And locks your tech stack so it stops proposing tools that break your existing architecture.

→ MEMORY.md decision log:
```
Maintain a file called MEMORY.md in this project. After any significant decision, add an entry: What was decided / Why / What was rejected and why. Read MEMORY.md at the start of every session. Never contradict a logged decision without flagging it first.
```
→ Session end summary:
```
When I say "session end", "wrapping up", or "let's stop here": write a session summary to MEMORY.md. Include: Worked on / Completed / In progress / Decisions made / Next session priorities.
```
→ ERRORS.md failure log:
```
Maintain a file called ERRORS.md. When an approach takes more than 2 attempts to work, log it: What didn't work / What worked instead / Note for next time. Check ERRORS.md before suggesting approaches to similar tasks.
```
→ Permanent facts list:
```
These facts are always true for this project. Apply them to every session without exception: [your permanent constraints, architectural decisions, and rules]. If any task conflicts with one of these, flag it before proceeding.
```
→ Lock your tech stack:
```
Tech stack for this project. Always use these. Never suggest alternatives unless I ask:
Language: [e.g. TypeScript]
Framework: [e.g. Next.js 14]
Package manager: [e.g. pnpm]
Database: [e.g. PostgreSQL with Prisma]
Testing: [e.g. Vitest]
Styling: [e.g. Tailwind CSS]
If something seems like the wrong tool, flag it. But use the defined stack unless I explicitly say otherwise.
```
→ Extended Thinking for hard decisions:
```
For questions involving system architecture, performance tradeoffs, database design, or long-term technical decisions: use extended thinking mode. Work through the problem step by step. Surface tradeoffs I haven't considered. Flag assumptions that might not hold at scale. Then give your recommendation.
```
→ The 4 rules that went viral:
Karpathy identified 4 behaviors that make Claude Code fail. A developer distilled them into these 4 lines. Coding accuracy went from 65% to 94%.
```
1. Ask, don't assume. If something is unclear, ask before writing a single line. Never make silent assumptions about intent, architecture, or requirements.
2. Simplest solution first. Always implement the simplest thing that could work. Do not add abstractions or flexibility that weren't explicitly requested.
3. Don't touch unrelated code. If a file or function is not directly part of the current task, do not modify it, even if you think it could be improved.
4. Flag uncertainty explicitly. If you are not confident about an approach or technical detail, say so before proceeding. Confidence without certainty causes more damage than admitting a gap.
```
> 2 hours/week recovering from forgotten decisions and wrong suggestions: $300/week per dev Wrong stack recommendations and incompatible tools: $75/week Total memory-related waste per developer: $375/week Team of 5: $1,875/week MEMORY.md + ERRORS.md + stack setup: 20 minutes
## CONCLUSION
Here's the full math.
> $375/week re-explaining context every session $225/week reverting unauthorized changes $375/week recovering from forgotten decisions Total waste per developer: $975/week
> Team of 5 developers: $4,875/week Per year: $253,500
> CLAUDE.md setup: 2 hours total Karpathy's 4 rules alone: 65% to 94% coding accuracy
One plain text file. 21 rules. Two hours of work.
The developers who set this up are working with a version of Claude that remembers decisions, stays in scope, confirms before destroying anything, never suggests a framework that breaks your architecture.
The ones who haven't are spending $975/week to repeat themselves.
p.s. start with Karpathy's 4 rules. just those 4. paste them into a new file called CLAUDE.md in your project root right now. it takes 2 minutes. add the rest one week at a time as you notice what's missing.
Bookmark this before it gets buried. If this was useful, share it with one person who needs it.
## 相关链接
- [Dep](https://x.com/0xDepressionn)
- [@0xDepressionn](https://x.com/0xDepressionn)
- [21K](https://x.com/0xDepressionn/status/2055999112470839383/analytics)
- [Upgrade to Premium](https://x.com/i/premium_sign_up)
- [9:09 PM · May 17, 2026](https://x.com/0xDepressionn/status/2055999112470839383)
- [21.1K Views](https://x.com/0xDepressionn/status/2055999112470839383/analytics)
- [View quotes](https://x.com/0xDepressionn/status/2055999112470839383/quotes)
---
*导出时间: 2026/5/18 12:42:09*
---
## 中文翻译
# Karpathy 的 CLAUDE.md 在 GitHub 上斩获第一,星标数达 82,000。大多数开发者仍未阅读此文。
**作者**: Dep
**日期**: 2026-05-17T13:09:21.000Z
**来源**: [https://x.com/0xDepressionn/status/2055999112470839383](https://x.com/0xDepressionn/status/2055999112470839383)
---

## 一个名为 CLAUDE.md 的文件登上了 GitHub 趋势榜第一。
82,000 星标。7,800 复刻。
这一切始于 Andrej Karpathy。特斯拉前 AI 总监。OpenAI 创始成员。他指出了导致 Claude Code 失败的 4 种行为,并将它们写在一个文件里。
一位开发者采纳了这 4 条规则,对其进行了扩展,并发布了该文件。它一夜爆红。
原因在于:编码准确率从 65% 提升到了 94%。
大多数每天使用 Claude Code 的开发者从未进行过此设置。他们每次会话都从零开始。重新解释相同的上下文。清理非预期的范围变更。回退没人要求做的重构。
这就是完整的文件。

## 大多数开发者错过的设置
每次你打开 Claude Code,它都是一片空白。
它不知道你的技术栈。你的标准。你的项目背景。你已经尝试过什么。你在三次会话前明确决定不做什么。
所以它开始猜测。当它猜测时,它会重构你并未要求它触碰的代码。它会建议破坏你现有架构的框架。它在未询问的情况下删除文件。它推翻你已经做出的决定。
CLAUDE.md 是一个纯文本文件,你将其放置在项目根目录。Claude Code 会在每次会话开始时自动读取它。
一次设置。零重复解释。修复了三类代价高昂的错误。
## 1 / 3 | 默认项:你每周花费 375 美元用来重复自己
平均每位开发者每天花费 30 分钟重新向 Claude 解释上下文。
技术栈。编码标准。项目背景。已经尝试过的方法。除非你一次性写下来并让 Claude 每次读取,否则这些信息都不会在会话之间保留。
每天 30 分钟,按每小时 150 美元的开发者费率计算:每周 375 美元。每位开发者。
对于一个 5 人的团队:每周损失 1,875 美元。

这 7 条规则应放在你的 CLAUDE.md 文件顶部。
→ 杜绝废话:
```
永远不要用 "Great question!"、"Of course!"、"Certainly!" 或类似的热场短语作为回复的开头。每次回复直接切入正题。不要前言,不要确认问题。
```
→ 长度与任务匹配:
```
回复长度要与任务复杂性相匹配。简单的问题得到直接、简短的回答。复杂的任务得到完整、详细的回复。绝不要用重述问题或重复刚才内容的结束语来填充回复。
```
→ 行动前先展示选项:
```
在任何重要任务之前,向我展示 2-3 种你可以完成这项工作的方法。等待我选择后再继续。
```
→ 在造成损失前承认不确定性:
```
如果你对任何事实、统计数据、日期或技术信息不确定:在包含这些内容之前明确说明。永远不要用听起来合理的推测来填补你的知识空白。如有疑问,直说。
```
→ 我是谁以及我知道什么:
```
关于我:[姓名] / 角色:[你的角色] / 背景领域:[领域]。擅长:[你了解的内容]。仍在学习:[空白]。调整每次回复的深度以匹配此信息。永远不要过度解释我已经知道的内容。永远不要跳过我需要的背景信息。
```
→ 当前项目背景:
```
我正在做的:[项目名称] / 目标:[具体结果] / 受众:[谁使用它] / 技术栈背景:[任何相关约束] / 避免事项:[列表]。将此背景应用于每个任务。当某些内容不合适时,在继续之前将其标记出来。
```
→ 锁定你的语气:
```
我的写作风格——始终匹配这一点:[描述你的语气] / 句子长度:[偏好] / 我使用的词汇:[示例] / 我从不使用的词汇:[示例] / 格式:[散文或结构化]。当代表我撰写任何内容时,请完全匹配这一点。不要默认为你自己的模式。
```
> 每天重新解释上下文花费的时间:30 分钟 按 150 美元/小时开发者费率计算:75 美元/天 每周:每位开发者 375 美元/周 5 人团队:1,875 美元/周 本部分 CLAUDE.md 设置时间:总计 45 分钟
需要避免的错误:不要从头开始编写你的 CLAUDE.md。先使用此提示词,然后编辑输出:
```
根据我告诉你的关于我自己、我的项目以及我希望如何合作的信息:为我写一个完整的 CLAUDE.md 文件。包括:我是谁、我的技术背景、我的沟通偏好以及每次会话的默认行为。要具体。纯文本。500 字以内。
```
## 2 / 3 | 行为:你未授权的每小时 150 美元的变更
你要求 Claude 修复一个函数。
它重构了三个文件,重命名了你的变量,重新组织了导入,并重写了你花时间精心编写的注释。
全都在没有询问的情况下。
审查和回退非预期变更需要 1 小时:150 美元。每周三次:每周 450 美元。每位开发者。
对于一个 5 人的团队:每周花费 2,250 美元清理未经授权的变更。

这 7 条规则放在你的 CLAUDE.md 的行为部分。
→ 保持在范围内:
```
仅修改与当前任务直接相关的文件、函数和代码行。不要重构、重命名、重组、重新格式化或“改进”任何我没有明确要求你更改的内容。如果你注意到其他地方值得修复的问题,请在最后的注释中提及。不要触碰它。永远不要。
```
→ 重大变更前先询问:
```
在进行任何显著改变我已经创建内容的更改之前(重写部分、删除段落、重组流程、改变语气):停止。准确描述你即将更改的内容以及原因。在继续之前等待我的确认。
```
→ 任何破坏性操作前都要确认:
```
在删除任何文件、覆盖现有代码、丢弃数据库记录或删除依赖项之前:停止。列出确切会受到影响的内容。请求明确的确认。只有当我在当前消息中说“是”时才继续。提到“你之前提到过这个”不算确认。
```
→ 生产环境的硬性停止:
```
以下操作需要明确的会话内确认,无一例外:部署或推送到任何环境、运行迁移或架构更改、发送任何外部 API 调用、执行任何具有不可逆副作用的命令。我必须在当前消息中说“是”。
```
→ 始终展示变更内容:
```
在任何编码任务后,以以下内容结尾:变更的文件(列出每个被触及的文件) / 修改了什么(每个文件一行) / 故意未触碰的文件 / 需要的后续跟进。
```
→ 未经明确确认绝不行动:
```
未经我在当前消息中的明确确认,永远不要代表我发送、发布、分享或安排任何内容。这包括电子邮件、日历邀请、文档共享或此对话之外的任何操作。我必须在当前消息中说“是”。
```
→ 写代码前先思考:
```
对于涉及架构决策、调试复杂问题或非平凡功能的任何任务:在编写任何代码之前逐步解决问题。展示你的推理。识别你不确定的领域。然后再实施。
```
> 每周 1 小时回退非预期的范围变更:150 美元/周 每周 30 分钟在每个任务后手动比对差异:75 美元/周 每位开发者与行为相关的总浪费:225 美元/周 5 人团队:1,125 美元/周 CLAUDE.md 行为部分设置:30 分钟
## 3 / 3 | 记忆 + 技术栈:让 Claude Code 真正可靠的设置
Claude 在会话之间会忘记一切。
你做出的每一个决定。每一个失败的方法。你六个月前选择 Prisma 而不是 Drizzle 的原因。因为特定客户要求而存在的约束。
它忘记了。然后它恰好建议了你已经排除的内容。
这一部分赋予了 Claude 目前最接近真实记忆的东西。并锁定了你的技术栈,使其停止提议破坏你现有架构的工具。

→ MEMORY.md 决策日志:
```
在此项目中维护一个名为 MEMORY.md 的文件。在任何重要决定后,添加一个条目:决定了什么 / 为什么 / 拒绝了什么以及为什么。在每次会话开始时读取 MEMORY.md。在标记之前,永远不要与已记录的决定相矛盾。
```
→ 会话结束总结:
```
当我说“会话结束”、“收尾”或“就在这停”时:向 MEMORY.md 写入一个会话总结。包括:正在进行 / 已完成 / 进行中 / 做出的决定 / 下次会话的优先事项。
```
→ ERRORS.md 失败日志:
```
维护一个名为 ERRORS.md 的文件。当一种方法需要超过 2 次尝试才能成功时,记录它:什么不起作用 / 什么起作用了 / 给下次的备注。在建议类似任务的方法之前检查 ERRORS.md。
```
→ 永久事实列表:
```
这些事实对于此项目始终为真。无一例外地将它们应用于每次会话:[你的永久约束、架构决策和规则]。如果任何任务与其中之一冲突,在继续之前将其标记出来。
```
→ 锁定你的技术栈:
```
此项目的技术栈。始终使用这些。除非我要求,否则不要建议替代方案:
语言:[例如 TypeScript]
框架:[例如 Next.js 14]
包管理器:[例如 pnpm]
数据库:[例如 PostgreSQL with Prisma]
测试:[例如 Vitest]
样式:[例如 Tailwind CSS]
如果某些东西看起来像是错误的工具,请将其标记。但除非我明确另有说明,否则使用定义的技术栈。
```
→ 针对困难决策的扩展思考:
```
对于涉及系统架构、性能权衡、数据库设计或长期技术决策的问题:使用扩展思考模式。逐步解决问题。提出我未考虑过的权衡。标记在规模上可能不成立的假设。然后给出你的建议。
```
→ 走红的 4 条规则:
Karpathy 指出了导致 Claude Code 失败的 4 种行为。一位开发者将它们提炼为这 4 行代码。编码准确率从 65% 上升到了 94%。
```
1. 询问,不要假设。如果事情不清楚,在写一行代码之前先问。永远不要对意图、架构或需求进行无声的假设。
2. 首选最简单的解决方案。始终实施可行的最简单的方法。不要添加未被明确要求的抽象或灵活性。
3. 不要触碰无关代码。如果文件或函数不是当前任务的直接组成部分,请不要修改它,即使你认为它可以被改进。
4. 明确标记不确定性。如果你对方法或技术细节没有信心,请在继续之前说明。没有把握的自信比承认无知造成的损害更大。
```
> 每周 2 小时从被遗忘的决策和错误建议中恢复:每位开发者 300 美元/周 错误的技术栈建议和不兼容的工具:75 美元/周 每位开发者与记忆相关的总浪费:375 美元/周 5 人团队:1,875 美元/周 MEMORY.md + ERRORS.md + 技术栈设置:20 分钟
## 结论
以下是完整的计算。
> 每次会话重新解释上下文浪费 375 美元/周 回退未经授权的变更浪费 225 美元/周 从被遗忘的决策中恢复浪费 375 美元/周 每位开发者总浪费:975 美元/周
> 5 人开发者团队:4,875 美元/周 每年:253,500 美元
> CLAUDE.md 设置:总计 2 小时 仅 Karpathy 的 4 条规则:65% 至 94% 的编码准确率
一个纯文本文件。21 条规则。两个小时的工作。
设置好这些的开发者正在使用一个能记住决策、保持在范围内、在破坏任何东西之前进行确认、从不建议破坏你架构的框架的 Claude 版本。
而那些没有设置的开发者每周花费 975 美元来重复自己。
p.s. 从 Karpathy 的 4 条规则开始。就这 4 条。现在就把它们粘贴到项目根目录下一个名为 CLAUDE.md 的新文件中。这需要 2 分钟。随着你注意到缺失的内容,每周添加其余部分。
在此被淹没之前将其加入书签。如果有用,请与一个需要它的人分享。
## 相关链接
- [Dep](https://x.com/0xDepressionn)
- [@0xDepressionn](https://x.com/0xDepressionn)
- [21K](https://x.com/0xDepressionn/status/2055999112470839383/analytics)
- [升级至 Premium](https://x.com/i/premium_sign_up)
- [2026年5月17日 下午9:09](https://x.com/0xDepressionn/status/2055999112470839383)
- [21.1K 观看](https://x.com/0xDepressionn/status/2055999112470839383/analytics)
- [查看引用](https://x.com/0xDepressionn/status/2055999112470839383/quotes)
---
*导出时间: 2026/5/18 12:42:09*