CLAUDE.md Guide: 21 Instructions to Lock In Preferences and Context
Most Claude users don't know about CLAUDE.md — a plain-text file placed in a project folder that Claude reads automatically at the start of every session, permanently setting your preferences, context, and behavioral rules. This guide provides 21 concrete instructions across five parts: communication style (no filler, admit uncertainty, match length to task), behavior (ask before big changes, only change what was requested, summarize changes), user context (background, project, writing voice), memory & continuity (log decisions in MEMORY.md, session summaries, track failures), and developer-specific rules including Andrej Karpathy's 4 golden rules (don't assume, simplest solution, don't touch unrelated code, flag uncertainty), which reportedly boosted coding accuracy from 65% to 94%. For anyone who wants to stop repeating themselves and get more consistent, on-brand output from Claude.
You've been using Claude wrong this whole time. CLAUDE.md fixes everything. Here's how. 👇
By @TheAIWorld22 · 2026-05-27T09:38:30.000Z

Most people using Claude have never heard of it.
The ones who have don't know what to actually put in it.
And that gap is costing people hours every single week. ⏰
Here's the truth — every time you open a new Claude session, it starts with zero memory.
It doesn't know your name. It doesn't know your work. It doesn't know your preferences or how you like things done.
So you spend the first few minutes re-explaining everything from scratch. Or you don't — and Claude gives you something that doesn't fit how you actually work at all.
CLAUDE.md fixes this permanently. 💡
Here are all 21 instructions you need to set it up properly. 👇
大多数人使用 Claude 时从未听说过它。
听说过的也不知道该往里面放什么。
这个差距每周都在浪费人们数小时。⏰
真相是——每次你打开一个新的 Claude 会话,它都是从零记忆开始的。
它不知道你的名字。不知道你的工作。不知道你的偏好或者你喜欢怎样做事。
所以你要花前几分钟从头重新解释一切。或者你不解释——那么 Claude 给你的东西完全不符合你的工作方式。
CLAUDE.md 永久解决了这个问题。💡
以下是正确设置所需的全部 21 条指令。👇
First — this is NOT just a developer tool. 🔥
Writers use it to lock in their voice so Claude never sounds like someone else. Marketers use it to define their audience so Claude stops writing generic copy. Researchers use it to set how they want information structured. Business owners use it to give Claude full company context so every output fits their reality.
Without CLAUDE.md — you start from zero every single session. You repeat yourself. You correct the same mistakes. You explain your preferences for the hundredth time.
CLAUDE.md is the very first thing you should set up before any serious work with Claude. 🎯
How to create it in 2 minutes ⚡
Open your project folder and create a new file. Name it exactly "CLAUDE.md" — capital letters, no spaces.
Open it in any text editor — Notepad, TextEdit, VS Code, whatever you use. Paste your instructions directly into this file in plain text.
Start with 3 or 4 instructions that solve your biggest frustrations first. Save the file. Claude reads it automatically every time you open a session in that folder.
No setup. No extra steps. It just works from the very first message. 💡
两分钟创建方法 ⚡
打开你的项目文件夹,创建一个新文件。命名为 "CLAUDE.md" ——大写字母,无空格。
用任何文本编辑器打开——记事本、TextEdit、VS Code,随便你用。将指令直接以纯文本粘贴到这个文件里。
先从 3 到 4 条最能解决你最大烦恼的指令开始。保存文件。每次你在这个文件夹中打开会话时,Claude 会自动读取它。
无需设置。无需额外步骤。从第一条消息开始就能正常工作。💡
⚡ PART 1: How Claude Talks to You
- Kill the filler forever. 🚫
Claude's default is to open every single response with — "Great question!" "Of course!" "Certainly!" "Absolutely!"
Phrases that add absolutely nothing and waste your time every single day.
One instruction eliminates this permanently. Every response starts directly with the answer. No warmup. No performance of helpfulness. Just what you asked for — immediately.
"Never open responses with filler phrases like 'Great question!', 'Of course!', 'Certainly!', or similar warmups. Start every response with the actual answer. No preamble. Just the information."
⚡ 第一部分:Claude 如何与你交流
- 永久消除废话开头。🚫
Claude 的默认行为是以“好问题!”“当然!”“没问题!”“绝对!”开头——每个回复都这样。
这些短语毫无意义,每天浪费你的时间。
一条指令就能永久消除这种行为。每个回复直接从答案开始。没有热身。没有装模作样的帮助。直接给你要的东西——立刻。
“永远不要以‘好问题!’、‘当然!’、‘没问题!’或类似开场白开头。每个回复直接从实际答案开始。没有前言。只有信息。”
- Always show options before acting. 🎯
Claude picks one approach and runs with it by default.
You ask it to rewrite a paragraph and it changes the entire tone of the piece. You ask it to restructure a document and it reorganizes things in a way that doesn't match how you think at all.
Now you're correcting something you never asked to change. 😤
This instruction fixes that completely. Before any significant task, Claude shows you 2-3 ways it could approach the work. You choose the direction. What follows is exactly what you wanted.
"Before any significant task, always show me 2-3 possible approaches first. Wait for my choice before proceeding."
- 行动前总是展示选项。🎯
Claude 默认会选择一个方法并直接执行。
你让它重写一段,它却改变了整篇文章的语气。你让它重组文档,它以一种完全不符合你思维的方式重新组织。
现在你需要纠正你从未要求改变的东西。😤
这条指令完全解决了这个问题。在任何重要任务之前,Claude 会展示 2-3 种可能的方法。你选择方向。后续产出正好是你想要的。
“在任何重要任务之前,总是先展示 2-3 种可能的方法。等我的选择后再继续。”
- Be honest when you don't know. 🔍
Claude will give you a confident, detailed, completely wrong answer before it ever admits uncertainty.
It fills gaps with plausible-sounding information — dates, statistics, quotes, facts — that feel true but simply aren't. You use that information and the problem shows up later when it matters most.
This instruction changes that behavior permanently.
"If you are uncertain about any fact, statistic, date, or quote — say so explicitly before including it. 'I'm not certain about this' is always better than presenting a guess as a fact. Never fill gaps with plausible-sounding information."
- 不知道时要诚实。🔍
Claude 在承认不确定之前,会给你一个自信、详细但完全错误的答案。
它会用听起来合理的信息填补空白——日期、统计、引文、事实——这些感觉真实但实际上并非如此。你使用了那些信息,问题在关键时刻出现。
这条指令永久改变了这种行为。
“如果你对任何事实、统计、日期或引文不确定——在包含之前明确说明。‘我不确定这个’总比把猜测当作事实好。永远不要用听起来合理的信息填补空白。”
- Match length to what's actually needed. 📏
Ask Claude a simple question and it writes four paragraphs. Ask it something complex and it gives you a skeleton that looks complete but isn't.
Neither is useful. Response length should match what the task actually requires.
"Match response length to task complexity. Simple questions get short direct answers. Complex tasks get full detailed responses. Never pad responses with restatements or closing sentences that repeat what you just said."
- 回复长度匹配实际需求。📏
问 Claude 一个简单问题,它写了四段。问它复杂的东西,它给你一个看似完整实则骨架的东西。
两者都没用。回复长度应该匹配任务的实际需求。
“回复长度与任务复杂度匹配。简单问题得到简短直接的答案。复杂任务得到完整详细的回复。永远不要用重复你刚才所说内容的总结句或结尾来填充回复。”
⚡ PART 2: How Claude Behaves
- Ask before making big changes. ✋
You ask Claude to fix one paragraph and it rewrites the entire document. You ask it to shorten something and it removes sections you actually needed.
Every time — you lose something you didn't want to lose.
"Before making any change that significantly alters content I've already created — stop completely. Describe exactly what you're about to change and why. Wait for my confirmation before proceeding. 'I think this would be better' is not permission to change it."
⚡ 第二部分:Claude 的行为方式
- 重大更改前先询问。✋
你让 Claude 修复一段,它却重写了整个文档。你让它缩短内容,它删除了你实际需要的部分。
每次——你都会失去不想失去的东西。
“在做出任何会显著改变我已创建内容的更改之前——完全停下来。准确描述你要更改什么以及为什么。等我的确认后再继续。‘我认为这样更好’不是更改它的许可。”
- Stay focused on what was asked. 🎯
Ask Claude to fix one thing and it will "improve" five others while it's in there — adjusting your phrasing, reorganizing your structure, rephrasing sentences you were completely happy with.
Now you have to sort through everything just to find what actually changed. 😤
"Only change what I specifically asked you to change. Do not rewrite, rephrase, or 'improve' anything I didn't ask about — even if you think it would be better. If you notice something worth improving elsewhere, mention it at the end. Do not touch it unless I explicitly ask."
- 只关注被要求的内容。🎯
让 Claude 修改一件事,它在修改过程中会“改进”其他五处——调整你的措辞、重组结构、改述你本来完全满意的句子。
现在你必须仔细检查所有内容才能找出实际变化。😤
“只修改我特别要求你修改的内容。不要重写、改述或‘改进’任何我没要求的东西——即使你认为这样更好。如果你注意到其他地方有值得改进的地方,在最后提一下。除非我明确要求,否则不要动它。”
- Always tell me what you changed. 📋
Claude finishes a task and you're left scanning the output trying to figure out what's different from what you had before.
Which sections changed? Did it cut anything? Did it add something you never asked for?
"After completing any editing or writing task, always end with a brief summary: What was changed. What was left untouched. What needs my attention. Keep it short — this is a status update, not a recap."
- 始终告知你改了哪些内容。📋
Claude 完成任务后,你只能扫描输出,试图找出与之前有什么不同。
哪些部分变了?它删了东西吗?它加了你从未要求的东西吗?
“完成任何编辑或写作任务后,务必以简要总结结尾:什么被改了。什么没动。什么需要我注意。保持简短——这是状态更新,不是回顾。”
- Never take actions on my behalf without asking. 🚨
As AI tools become more connected — to your email, calendar, social accounts, documents — the risk of Claude taking an action you didn't fully intend grows with every new integration.
Sending a message. Posting content. Scheduling something. These actions have real consequences and they happen fast.
"Never send, post, publish, share, or schedule anything on my behalf without my explicit confirmation in the current message. 'You mentioned wanting to do this' is not confirmation. I must say yes in the current message."
- 未经允许不要代我执行操作。🚨
随着 AI 工具与你的邮件、日历、社交账户、文档等连接越来越紧密,Claude 执行你并未完全同意的操作的风险随着每次新集成而增加。
发送消息。发布内容。安排事务。这些操作都有实际后果且发生迅速。
“未经当前消息中的明确确认,永远不要代表我发送、发布、公开、分享或安排任何事情。‘你提过想这样做’不是确认。我必须在当前消息中说‘是’。”
⚡ PART 3: Your Context
- Tell Claude who you are and what you know. 👤
Claude doesn't know if you're an expert or a beginner, a founder or a freelancer, someone who wants technical depth or plain language.
Without that context — it guesses. And it's wrong as often as it's right.
"About me: Name. Role. Background. Strong in [topics you know well]. Still learning [areas where you need more context]. Adjust the depth of every response to match this background. Never over-explain what I already know."
⚡ 第三部分:你的背景
- 告诉 Claude 你是谁、你知道什么。👤
Claude 不知道你是专家还是新手、创始人还是自由职业者、想要技术深度还是平实语言。
没有这些背景——它会猜。而且对错各半。
“关于我:姓名。角色。背景。擅长 [你熟悉的话题]。正在学习 [你需要更多背景的领域]。调整每个回复的深度以匹配这个背景。永远不要过度解释我已经知道的内容。”
- Give Claude the context of what you're working on. 📌
Every session Claude starts with no idea what you're working on, who it's for, or what actually matters.
It gives you generic output because it has no other choice.
"What I'm working on: Project. Goal. Audience. Tone. What to avoid. Apply this context to every task. When something doesn't fit this picture — flag it before proceeding."
- 给 Claude 你正在做的事情的背景。📌
每轮会话 Claude 都不知道你在做什么、为谁做、什么才是重要的。
它只能给你通用输出,因为它别无选择。
“我正在做的:项目。目标。受众。语气。避免什么。将这一背景应用于每个任务。当有些内容不符合这个场景时——在继续之前标记出来。”
- Lock in your voice and style. ✍️
Claude has a default writing style. It's fine. It's also not yours.
Every time you use Claude to write something — you end up editing it back toward your voice anyway.
Define your voice once and Claude writes in it from the very first draft.
"My writing style — always match this: Voice. Sentence length. Words I use. Words I never use. Format preference. When writing anything on my behalf, match this style exactly. Do not default to your own patterns."
- 锁定你的声音和风格。✍️
Claude 有默认的写作风格。还不错。但那不是你的风格。
每次你用 Claude 写东西——你最终还是要把它改回自己的风格。
一次性定义你的风格,Claude 从第一稿起就用这种风格写作。
“我的写作风格——始终匹配:语气。句子长度。我使用的词语。我从不使用的词语。格式偏好。当代表我写任何内容时,精确匹配这种风格。不要默认使用你自己的模式。”
⚡ PART 4: Memory and Continuity
- Make Claude keep a memory file. 🧠
Claude forgets everything between sessions. Every conversation starts completely fresh.
But Claude can write files — and files persist.
This instruction tells Claude to maintain a MEMORY.md file with every important decision you make together — what was decided, why, and what alternatives were rejected.
"Maintain a file called MEMORY.md. After any significant decision — add an entry with what was decided, why, and what was rejected. Read MEMORY.md at the start of every session before doing anything."
- End-of-session summary — never lose progress again. 📝
You close the session. You come back two days later. You spend 15 minutes reading old messages trying to remember where you were and what you finished.
This is completely avoidable waste that happens to almost everyone who uses Claude regularly.
"When I say 'session end' or 'let's stop here' — write a session summary to MEMORY.md: What we worked on. What's completed. What's in progress. What decisions were made. What to pick up next session."
- 会话结束摘要——再也不丢失进度。📝
你关闭会话。两天后回来。你花 15 分钟阅读旧消息试图回忆你在哪里、完成了什么。
这种完全可避免的浪费几乎发生在每个经常使用 Claude 的人身上。
“当我说‘会话结束’或‘我们停在这里’时——将会话摘要写入 MEMORY.md:我们做了什么。什么完成了。什么进行中。做了哪些决定。下次会话继续什么。”
- Log what didn't work — stop solving the same problem twice. 🔄
You try a prompt approach. It takes four attempts to get something usable. Three weeks later you're back with a similar task and Claude starts over with the exact same bad suggestions.
Same trial and error. Same wasted time. From the beginning. Every time.
"Maintain a file called ERRORS.md. When an approach takes more than 2 attempts to work — log what didn't work, what worked, and what to remember next time. Check ERRORS.md before suggesting approaches to similar tasks."
- Give Claude a list of facts that never change. 📌
Every project has permanent facts — constraints from past decisions, rules that exist for important reasons, things that are always true about your work regardless of the specific task.
Without this — Claude casually suggests things that completely contradict your reality.
"These facts are always true. Apply them to every session without exception: [Your permanent facts here]. If any task conflicts with one of these — flag it before proceeding."
- 给 Claude 一份永不改变的事实清单。📌
每个项目都有永久事实——来自过去决策的约束、因重要原因存在的规则、无论具体任务如何对你工作总是成立的事情。
没有这个——Claude 会随意建议完全违背你现实的事情。
“这些事实总是成立的。无例外地将它们应用于每次会话:[你的永久事实列表]。如果任何任务与其中一条冲突——在继续之前标记出来。”
⚡ PART 5: For Developers
- Stay in scope — touch nothing you weren't asked about. 🔒
Ask Claude to fix one bug and it will refactor three files, rename your variables, reorganize your imports, and "improve" code you've been working with for months — all without asking.
Some of those changes break things. Some introduce subtle differences that take days to track down.
"Only modify files, functions, and lines of code directly related to the current task. Do not refactor, rename, or 'improve' anything I did not explicitly ask you to change. If you notice something worth fixing elsewhere — mention it. Do not touch it. Ever."
⚡ 第五部分:面向开发者
- 保持范围——没让你碰的别碰。🔒
让 Claude 修复一个 bug,它会重构三个文件、重命名变量、重组导入,并“改进”你用了几个月的代码——全都不问。
其中一些修改会破坏东西。有些引入微妙差异,需要几天才能追踪到。
“只修改与当前任务直接相关的文件、函数和代码行。不要重构、重命名或‘改进’任何我没有明确要求你修改的内容。如果你注意到其他地方有值得修复的东西——提一下。不要碰它。永远不要。”
- Confirm before anything destructive. ⚠️
Claude Code will delete files, overwrite functions, and drop database tables without hesitation — because you told it to, even if you didn't fully realize what you were telling it.
One misread instruction and hours of work are completely gone with no undo.
"Before deleting any file, overwriting existing code, dropping database records, or making any change that cannot be trivially undone — stop completely. List exactly what will be affected. Ask for explicit confirmation. Only proceed after I say yes in the current message."
- 破坏性操作前先确认。⚠️
Claude Code 会毫不犹豫地删除文件、覆盖函数、删除数据库表——因为你让它这么做,即使你并未完全意识到你让它在做什么。
一个误读的指令就会让数小时的工作完全消失,无法撤销。
“在删除任何文件、覆盖现有代码、删除数据库记录或做出任何无法轻易撤销的更改之前——完全停下来。列出将受影响的精确内容。请求明确确认。只有在当前消息中我说‘是’之后才能继续。”
- Hard stops — actions that never happen without permission. 🚨
Deploying to production. Running migrations on a live database. Sending API calls to external services.
These are not "be careful" situations. These are full stops.
"The following actions require explicit in-session confirmation before executing — no exceptions: Deploying to any environment. Running migrations on any database. Sending any email or external API call. Executing any command with irreversible external side effects."
- 硬性停止——未经许可绝不发生的动作。🚨
部署到生产环境。在活动数据库上运行迁移。向外部服务发送 API 调用。
这些不是“小心点”的情况。这是完全停止。
“以下操作在执行前需要会话中的明确确认——无例外:部署到任何环境。在任何数据库上运行迁移。发送任何邮件或外部 API 调用。执行任何具有不可逆外部副作用的命令。”
- Lock your tech stack. 🔧
Without a defined stack — Claude will suggest whatever framework it considers most popular, whatever library it's seen most often, and whatever package manager it defaults to.
Often not what you use, not what your team knows, and not compatible with what you've already built.
"Tech stack — always use these, never suggest alternatives unless I ask: Language. Framework. Package manager. Database. Testing. Linting. If something seems like the wrong tool — flag it. But use it anyway unless I say otherwise."
- 锁定你的技术栈。🔧
没有定义好的技术栈——Claude 会推荐它认为最流行的框架、它最常见的库、以及它默认的包管理器。
这些往往不是你在用的、不是你团队熟悉的、也不兼容你已经构建的东西。
“技术栈——始终使用这些,除非我问否则不要建议替代方案:语言。框架。包管理器。数据库。测试。Linting。如果某个东西看起来像是错误的工具——标记出来。但除非我另有说明,否则仍使用它。”
- Always show exactly what changed. 📊
Claude finishes a coding task and you're left scanning the output trying to figure out what's different.
Which files changed? Did it touch anything else? Did it leave something unfinished?
"After completing any coding task, always end with: Files changed. What was modified — one line per file. Files intentionally not touched. Follow-up needed. Keep it short — this is a status update, not a recap."
- 始终展示确切的改动内容。📊
Claude 完成编码任务后,你只能扫描输出试图找出有什么不同。
哪些文件变了?它动过其他东西吗?有没有留下未完成的部分?
“完成任何编码任务后,务必以以下内容结尾:更改的文件。每行一个文件说明修改了什么。有意未动的文件。需要跟进的内容。保持简短——这是状态更新,不是回顾。”
- The 4 rules that made Andrej Karpathy's CLAUDE.md go viral. 🔥
Andrej Karpathy — former Director of AI at Tesla, founding member of OpenAI — identified 4 specific behaviors that make Claude Code fail at coding tasks.
A developer distilled them into 4 instructions. That file hit #1 on GitHub Trending and improved coding accuracy from 65% to 94%. 😱
Here they are:
-
Ask, don't assume — if something is unclear, ask before writing a single line. Never make silent assumptions.
-
Simplest solution first — always implement the simplest thing that could work. Don't add abstractions that weren't requested.
-
Don't touch unrelated code — if a file is not directly part of the current task, do not modify it. Ever.
-
Flag uncertainty explicitly — if you're not confident about an approach, say so before proceeding. Confidence without certainty causes more damage than admitting a gap.
- 让 Andrej Karpathy 的 CLAUDE.md 爆红的 4 条规则。🔥
Andrej Karpathy——特斯拉前 AI 总监、OpenAI 创始成员——识别出 Claude Code 在编码任务中失败的 4 种特定行为。
一位开发者将其提炼为 4 条指令。那个文件登上了 GitHub Trending 第一,将编码准确率从 65% 提升到 94%。😱
规则如下:
-
询问,不要假设——如果某件事不清楚,在写任何代码之前先问。永远不要默默地做假设。
-
最简单的方案优先——始终实现最简单可行的东西。不要添加未被要求的抽象。
-
不要动无关代码——如果一个文件不是当前任务的直接部分,就不要修改它。永远不要。
-
明确标记不确定性——如果你对某个方法没有信心,在继续之前说出来。没有把握的自信比承认不足造成更大的损害。
The bottom line. 💎
CLAUDE.md is not just a developer tool.
It is a permanent instruction file that anyone who uses Claude seriously should set up before their very first real session.
Instructions 1-4 fix how Claude communicates. Instructions 5-8 stop it from changing things you didn't authorize. Instructions 9-11 give it context to produce output that fits your actual work. Instructions 12-15 give it the closest thing to real memory that currently exists. Instructions 16-21 make Claude Code behave like a precise tool instead of an unpredictable one.
Create the file. Paste in 3 instructions. Add more as you go.
The difference in output quality will be immediate and obvious from the very first session. 🚀
Follow for more systems that actually change how you work with AI. 💯
总结。💎
CLAUDE.md 不仅仅是开发者的工具。
它是一个永久指令文件,任何认真使用 Claude 的人都应该在第一次真正会话之前设置好。
指令 1-4 修复 Claude 的沟通方式。指令 5-8 阻止它更改未经授权的内容。指令 9-11 提供背景,使其输出符合你的实际工作。指令 12-15 赋予它当前最接近真实记忆的能力。指令 16-21 让 Claude Code 表现得更像精确工具而非不可预测之物。
创建文件。粘贴 3 条指令。慢慢加。
输出质量的差异从第一次会话起就会立即且明显。🚀
关注我,获取更多真正改变你与 AI 协作方式的系统。💯