A compulsory guide for Claude Code users

2026/05/19 01:20
🌐en

A job description for Claude Code

A compulsory guide for Claude Code users
Original title: Karpathy's CLAUDE.md hit #1 on GitHub with 82,000 stars.
Photo by Dep

Editor presses: When many people use Claude Code, the biggest problem is not that models are not strong enough, but they start from scratch every time。

You need to tell it repeatedly about the project background, the technology vault, code specifications, where it can't move and which programmes it has tried. As long as this information is not fixed, Claude relies on guesswork, which may result in changing the non-reformable documents, reconstructing codes that do not require re-engineering and even recommending tools that are not suitable for the current project。

CLUDE.md, which is presented here, is a manual for Claude Code. All you have to do is put it in the root directory, and Claude automatically reads it every time it starts. It can tell Claude in advance how to answer, how to write the code, when to ask first, what operations cannot be executed without permission, what technology is used in the project and what important decisions have been made in the past。

In short, the role of CLAUDE.md is to reduce repetitive interpretations, limit models across borders and make AI programming more stable and manageable。

If you are using Claude Code, you can start with the 4 rule summarized by Karpathy: ask first, make the simplest solution, do not touch the irrelevant code, specify uncertainty. The inclusion of these items in the CLAUDE.md and their gradual addition to their own projects will significantly improve their use experience。

The following is the original text:

A document called CLAUDE.md is on the top of GitHub Trending。

8.2 million stars, 7,800 forks。

It started in Andrej Karpathy. He was the director of Tesla AI and one of the founding members of OpenAI. He summed up four kinds of behavior that would invalidate Claude Code and put them in a document。

Later, an developer continued to expand on the four rules and released the document publicly. Turns out it went red。

The reason is direct: the code accuracy rate has risen from 65% to 94%。

But most developers who use Claude Code every day have never actually done this. Each of their sessions started from scratch: the same context was re-explained, unnecessary scope changes were cleaned up, and reruns of uninvited reconstructions were rolled back。

The complete document follows。

Settings missed by most developers

Every time you open Claude Code, it defaults on knowing nothing。

It doesn't know your technology, it doesn't know your code code, it doesn't know your project background, it doesn't know what you've tried, and it doesn't know what you clearly decided not to do before three sessions。

So it can only guess. And once it begins to guess, it may recreate the code you did not ask for it to move, and the recommendation would undermine the framework of the existing architecture, remove the document without confirmation, or even reverse the decision you have taken earlier。

CLUDE.md is a plain text file placed under the root directory. Claude Code automatically reads it at the beginning of each session。

A one-time setup does not have to be explained repeatedly and can repair three types of costly errors。

Default Settings: You spend $375 a week, just repeat yourself

Ordinary developers take about 30 minutes a day to reinterpret the context to Claude。

The technology vault, code code, project background, the method that you've tried -- unless you write this information down once and make Claude read it automatically, they don't keep between sessions。

If calculated on the developer ' s hourly salary of $150:

• 30 minutes per day, 75 dollars

• $375 per week。

• If it was a team of five, it would be $1875 per week。

The following rule 7 should be placed at the top of the CLAUDE.md document。

Oh, fuck off

The answer is not to start with a "good question" or a "no problem" or a kind of mattress. Just give the answer. Don't chill, don't repeat the question。

→ Length of response according to task

The length of the response should match the complexity of the task. Simple questions are answered directly, briefly; complex mandates give a full and detailed description. Do not fill the space with repetitions of questions or repetitions of conclusions。

• Prior to action

Before starting any important task, give me 2-3 viable paths, and then continue until I choose。

~ Before uncertainty causes loss, admit uncertainty. ~

If you are uncertain about any facts, data, dates or technical information, please specify before quoting. Do not fill the knowledge gap with seemingly reasonable information. When you can't, just say you're not sure。

Who am I? What do I know

For me: [name] / Role: [your role] / Background: [area]。

I'm good at this:。

I am still learning: [knowledge gap]。

Please adjust the depth of each response to this information. Don't overexplain what I already know, and don't skip the background I need。

Current Project Context

I am doing: [Name of project] / Objective: [Specific results] / Audience: [who will use] / Technical warehouse background: [relevant constraints] / Need to avoid: [list]。

Please apply these contexts to each task. If a requirement does not match the context, please indicate before implementation。

♪ Lock your expression ♪

My writing style is: [Description of your expression]。

Sentence length: [preference]。

I used to use the words: [Example]。

I would never use the words: [Example]。

Format: [Spoken or structured]。

When you write anything on my behalf, you must strictly match that style and not use your own expression by default。

Time to repeat context: 30 minutes

Based on developer ' s hourly salary of $150: $75/day

Weekly: $375 per developer

5-person team: $1875 per week

CLUDE.md settings: total 45 minutes

Errors need to be avoided: Do not write CLAUDE.md from scratch. Use this program first, then edit the output:

Based on what I told you about myself, my project, and how I want to work, please write me a complete CLUDE.md. These include who I am, my technical background, my communications preferences, and the default behaviour that each session should follow. Specific, plain text, 500 words are required。

Behavior restraining: those changes you did not authorize, $150 an hour

You let Claude fix a function。

as a result, it recreated three documents, renamed variables, reorganised reports, and rewritten the notes you took your time to write。

And none of this was confirmed by you。

It may take an hour, or $150, to review and roll back these unnecessary changes. Three times a week, that's $450. For a team of five, it's $2250 a week to clean up unauthorised changes。

The following rule 7 shall be inserted in the binding part of the act of CLAUDE.md。

Strict control

Changes only the files, functions and code lines that are directly related to the current task. Do not recreate, rename, reorganize, reformulate, or "optimize" anything I do not explicitly ask you to change。

If you find other places worth repair, use the last note. Don't move it, never。

Ask before making major changes

Before making major changes to what I have created, including rewriting chapters, deleting paragraphs, restructuring structures, changing tone, etc., it is important to stop and state exactly what you intend to change and why. I'll continue until I'm sure。

~ Any destructive operation must be confirmed before

Before any document is removed, existing codes are covered, database records are removed, or reliance is removed, it is necessary to stop, to list what specifically affects and to ask me for clear confirmation. You can continue only if I say yes in the current news。

"You mentioned it earlier" is not a confirmation。

Production environment operations must be suspended

The following must be clearly confirmed in the current session, without exception:

:: Deployment or transfer to any environment

Operational migration or changes in database structure

SEND ANY EXTERNAL API CALL

Carry out any orders with irreversible side effects。

I have to say "yes" clearly in the current news。

♪ Always showing what changed ♪

Upon completion of any coding tasks, the end must include:

Document modified: Lists all documents moved

Revision: Each document is described in one sentence

Document intentionally unmodified

Follow-up matters。

{\bord0\shad0\alphaH3D}Don't act on my behalf without a clear confirmation

Nothing can be sent, published, shared or arranged on my behalf without my express confirmation in the current message. Includes mail, calendar invitations, document sharing, or any operation that occurs outside the current dialogue. I have to say yes clearly in the current news。

Well, think before you write the code

For tasks involving structured decision-making, debugging complex issues, or non-simple functional development, one step at a time, then code writing. Show your reasoning, point out the uncertainties, and then implement them。

Unnecessary range change in weekly rollback: $150

manual diff weekly inspection: $75

Wasteful behaviour per developer: 225 / week

5-person team: $1125/ week

CLUDE.md behavioral part time: 30 minutes

Memory and technology warehouse: Make Claude Code a really reliable setup

Claude will forget everything between sessions。

Every decision you've made, every formula you've failed, why you chose Prisma six months ago instead of Drizzle, and why a certain constraint comes from a particular client's needs — it's forgotten。

And then it'll reissue the formula you've already ruled out。

This part is the equivalent of providing Claude with the closest mechanism to "real memory" at the moment, while locking down your technology vault to avoid it continuing to recommend tools that could undermine existing structures。

→EMORY.md Decision Log

Maintains a file called MEMORY.md in the project. Every time an important decision is made, a new record is added:

Decision on what

• Why so

• Excludes what, why。

Read Memory.md at the beginning of each session. No conflict with a recorded decision is permitted without warning。

Summary of Sessions

When I say "session end" "wrapping up" or "let's stop here", please write a summary of the session to Memory.md, including:

• What has been dealt with this time

• What has been accomplished

What is still going on

Decisions taken

:: Priorities for the next session。

→ERRORS.md Failed Log

Maintains a file called ERRORS.md. When a programme attempts more than twice to remain unsuccessful, it is recorded that:

• What doesn't work

• What last worked

• What needs attention next time。

Check ERRORS.md before proposing programmes for similar tasks。

• Permanent list of facts

The following facts remain valid for this project and must be applied to each session without exception:

[Your permanent constraints, structural decisions and rules]

If a particular mandate conflicts with these facts, please indicate before implementation。

♪ Lock the technology vault ♪

The project ' s technology warehouse is as follows and the tools are used consistently. Unless I explicitly request, no alternative is recommended:

Languages: [e.g. TypeScript]

Frame: [e.g. Next.js 14]

package manager: [e.g. pnpm]

Database: [e.g. PostgreSQL with Prisma]

Test: [e.g. Vital]

Styles: [e.g. Taylor CSS]

If a tool does not seem appropriate, it can be pointed out. But unless I make it clear, a defined technology warehouse must be used。

~ Hard decision-making triggers extended thinking

For issues related to system architecture, performance trade-offs, database design, or long-term technical decision-making, use an extended thinking model。

A step-by-step analysis of the problem, with trade-offs that I may not have taken into account, and with assumptions that may not be valid in the event of an increase in size, will give you your advice。

Well, that's four red rules

Karpathy summed up four kinds of behavior that would make Claude Code fail. One developer refined it into four lines of rules below. So the encoded accuracy rate went from 65% to 94%。

First, don't assume。
If there is any uncertainty, ask before writing down the first line. Do not make silent assumptions about intentions, structures or needs。

First, the simplest。
The simplest way to work is always achieved. Do not add abstract layers or flexibilities that are not explicitly required。

Don't touch the irrelevant code。
Do not modify a document or function if it is not directly related to the current task. Even if you think it can be optimized, don't move。

Identify uncertainties clearly。
If you are not sure about a particular programme or technical details, please indicate before proceeding. The lack of certainty but the expression of confidence are more damaging than the recognition of knowledge gaps。

Recovery costs per week due to forgotten decisions and erroneous recommendations: $300 per developer

Mistake technology inductive and incompatible tools: $75 per week

Waste of memory per developer: $375 / week

• 5-person team: $1875/week

• MAMORY.md + ERRORS.md + Technical stacking time: 20 minutes

Conclusions

The complete cost account is as follows:

:: Repeated weekly context: $375

:: Weekly roll-backs without authorized changes: $225

:: Dealing with issues arising from forgotten decisions per week: $375

Total waste per developer per week: $975。

If 5 person development team: $4875 per week. $253,500 a year。

And the CLUDE.md settings take a total of two hours。

The four rules of Karpathy alone increase the encoded accuracy from 65% to 94%。

A plain-text document, 21 rules, two hours of work。

The developers who complete this set-up are actually using a more reliable Claude: it can remember decision-making, control mission ranges, request confirmation before destructive operations, and do not recommend frameworks that would undermine existing structures。

And those who have not yet set up are still spending $975 a week to explain themselves。

Note: Start with rule 4 of Karpathy. Just this four. Paste them now to the next new file in the root directory, called CLADE.md, for two minutes. Then it'll be replenished on a weekly basis based on the gaps you have identified。

Collect it before it gets flooded with information. If you feel useful, you can share it with someone who really needs it。

[ Chuckles ]Original Link]

QQlink

無加密後門,無妥協。基於區塊鏈技術的去中心化社交和金融平台,讓私隱與自由回歸用戶手中。

© 2024 QQlink 研發團隊. 保留所有權利.