Topping GitHub's Trending, the Essential Guide for Claude Code Users

marsbitОпубликовано 2026-05-18Обновлено 2026-05-18

Введение

The CLAUDE.md file, trending on GitHub, is a project-level guide for Claude Code designed to dramatically improve its accuracy and efficiency. It addresses key issues like repetitive context explanations, unauthorized code changes, and forgotten decisions across sessions. By placing this plain-text file in a project root, Claude Code reads it automatically at the start of each session. The guide includes rules to eliminate redundant explanations, enforce strict behavioral constraints (e.g., no modifications outside the requested scope without confirmation), and establish a "memory" system using companion files like MEMORY.md and ERRORS.md to log past decisions and failures. It also locks in the project's specific tech stack to prevent inappropriate tool recommendations. Highlighted are four foundational rules from Andrej Karpathy that reportedly increased coding accuracy from 65% to 94%: always ask for clarity first, implement the simplest solution, never touch unrelated code, and explicitly flag uncertainties. The article quantifies significant weekly cost savings for developers and teams by eliminating wasted time on re-explaining context, rolling back unauthorized edits, and re-evaluating previously rejected solutions. The core message is that a small, upfront investment in creating a CLAUDE.md file leads to a more predictable, controlled, and cost-effective AI programming assistant.

Editor's Note: The biggest problem many people face when using Claude Code isn't that the model isn't powerful enough, but that they start from scratch every time.

You need to repeatedly tell it the project background, tech stack, code conventions, which parts must not be touched, and which approaches have already been tried. As long as this information isn't fixed, Claude will work by guessing, potentially modifying files it shouldn't, refactoring code you didn't ask it to, or even recommending tools unsuitable for the current project.

The CLAUDE.md introduced in this article is a user manual written for Claude Code. You just need to place it in your project's root directory, and Claude will automatically read it on each startup. It tells Claude in advance: how to answer, how to write code, when to ask questions first, which operations cannot be performed without permission, what tech stack the project uses, and what important decisions were made in the past.

In short, the purpose of CLAUDE.md is to: reduce repeated explanations, limit the model's overreach, and make AI programming more stable and controllable.

If you are using Claude Code, you can start with the 4 rules summarized by Karpathy: ask if unsure, do the simplest solution first, don't touch unrelated code, and clearly state uncertainty. Start by writing these rules into CLAUDE.md, then gradually add to it based on your project, and you'll see a clear improvement in your experience.

The original text follows:

A file named CLAUDE.md topped GitHub's Trending list.

82k stars, 7.8k forks.

This began with Andrej Karpathy. He is the former Head of AI at Tesla and a founding member of OpenAI. He summarized four behaviors that would cause Claude Code to fail and wrote them into a file.

Later, a developer expanded upon these four rules and publicly released this file. It quickly went viral.

The reason is straightforward: coding accuracy increased from 65% to 94%.

But most developers who use Claude Code daily have never actually set this up. They start from zero every session: re-explaining the same context, cleaning up unnecessary scope changes, rolling back unrequested refactors.

Here is the complete file.

The Setup Most Developers Miss

Every time you open Claude Code, it starts knowing nothing by default.

It doesn't know your tech stack, your coding conventions, your project background, what you've already tried, let alone decisions you explicitly ruled out three sessions ago.

So it can only guess. And once it starts guessing, it might refactor code you didn't ask to be touched, recommend frameworks that would break your existing architecture, delete files without confirmation, or even overturn decisions you've already made.

CLAUDE.md is a plain text file placed in the project's root directory. Claude Code will automatically read it at the start of every session.

Set it up once, avoid repeated explanations, and fix three types of costly errors.

Default Settings: You're Spending $375 a Week Just Repeating Yourself

The average developer spends about 30 minutes a day re-explaining context to Claude.

Tech stack, coding conventions, project background, methods already tried—unless you write this information down once and have Claude read it automatically each time, it won't persist across sessions.

At a developer's hourly rate of $150:

· 30 minutes a day is $75;

· $375 per week.

· For a 5-person team, that's $1,875 in hidden costs weekly.

The following 7 rules should be placed at the top of the CLAUDE.md file.

→ Skip the Fluff

Don't start answers with "Great question," "Sure," "No problem," or similar prefaces. Get straight to the answer. No pleasantries, no restating the question.

→ Match Answer Length to Task

Answer length should match task complexity. Simple questions get direct, short answers; complex tasks get complete, detailed explanations. Don't pad length by restating the question or adding repetitive concluding remarks.

→ Give Options Before Acting

Before starting any significant task, first present 2–3 viable paths. Wait for my selection before proceeding.

→ Admit Uncertainty Before It Costs

If you are uncertain about any fact, data, date, or technical information, explicitly say so before referencing it. Don't fill knowledge gaps with plausible-sounding information. When in doubt, simply say you're unsure.

→ Who I Am, What I Know

About Me: [Name] / Role: [Your Role] / Background: [Domain].

I'm Proficient At: [What you're familiar with].

I'm Still Learning: [Knowledge gaps].

Adjust the depth of each answer based on this information. Don't over-explain what I already know, and don't skip context I need.

→ Current Project Context

I'm Working On: [Project Name] / Goal: [Specific Outcome] / Audience: [Who will use it] / Tech Stack Context: [Relevant Constraints] / Avoid: [List].

Apply this context to every task. If a request conflicts with the context, point it out before executing.

→ Lock Down Your Writing Style

My Writing Style Is: [Describe your style].

Sentence Length: [Preference].

Words I Use Often: [Examples].

Words I Never Use: [Examples].

Format: [Prose or Structured].

When writing anything on my behalf, you must strictly match this style. Do not default to your own expressive patterns.

Daily time spent re-explaining context: 30 minutes

At $150/hour developer rate: $75 / day

Weekly: $375 per developer

5-person team: $1,875 per week

Time to set up this part of CLAUDE.md: 45 minutes total

Mistake to avoid: Don't write CLAUDE.md from scratch. Start with the prompt below, then edit the output:

Based on what I've told you about myself, my project, and how I want to work, please write a complete CLAUDE.md file for me. Include: who I am, my technical background, my communication preferences, and default behaviors to follow each session. Be specific, plain text, under 500 words.

Behavioral Constraints: Those Unauthorized $150/Hour Changes

You ask Claude to fix a function.

It ends up refactoring three files, renaming variables, reorganizing imports, and rewriting comments you spent time on.

All without your confirmation.

Reviewing and rolling back these unnecessary changes might take an hour, which is $150. Happening three times a week is $450. For a 5-person team, that's $2,250 per week spent cleaning up unauthorized changes.

The following 7 rules should go in the Behavioral Constraints section of CLAUDE.md.

→ Strict Scope Control

Only modify files, functions, and lines of code directly relevant to the current task. Do not refactor, rename, reorganize, reformat, or "optimize" anything I have not explicitly asked you to change.

If you see something else worth fixing, note it at the end. Do not touch it. Never.

→ Ask Before Major Changes

Before making significant changes to content I've already created—including rewriting sections, deleting paragraphs, restructuring, changing tone—you must pause, precisely state what you plan to change and why. Wait for my confirmation before proceeding.

→ Must Confirm Before Any Destructive Action

Before deleting any file, overwriting existing code, deleting database records, or removing dependencies, you must pause, list what will be specifically affected, and request my explicit confirmation. You may proceed only if I say "yes" in the current message.

"You mentioned earlier" does not equal confirmation.

→ Mandatory Pause for Production Operations

The following operations require explicit confirmation within the current session, without exception:

· Deploying or pushing to any environment;

· Running migrations or database schema changes;

· Sending any external API calls;

· Executing any command with irreversible side effects.

· I must explicitly say "yes" in the current message.

→ Always Show What Changed

After completing any coding task, the end must include:

Files Modified: List all touched files;

What Changed: One sentence per file;

Files Intentionally Not Modified;

Follow-Up Items.

→ Do Not Act on My Behalf Without Explicit Confirmation

Do not send, post, 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 happening outside the current conversation. I must explicitly say "yes" in the current message.

→ Think Before Coding

For tasks involving architectural decisions, complex problem debugging, or non-trivial feature development, first reason through the problem step-by-step before writing code. Show your reasoning, point out uncertainties, and then execute.

Weekly rollback of unnecessary scope changes: $150

Weekly manual diff checks: $75

Behavior-related waste per developer: $225 / week

5-person team: $1,125 / week

Time to set up CLAUDE.md Behavior section: 30 minutes

Memory & Tech Stack: The Setup That Makes Claude Code Truly Reliable

Claude forgets everything between sessions.

Every decision you've made, every approach that failed, why you chose Prisma over Drizzle six months ago, and why a particular constraint comes from a specific client requirement—it forgets it all.

Then, it re-proposes options you've long since ruled out.

This section is the closest thing to providing Claude with "real memory" for the current context, while also locking down your tech stack to prevent it from recommending tools that would break your existing architecture.

→ MEMORY.md Decision Log

Maintain a file named MEMORY.md in the project. Whenever an important decision is made, add a new entry:

· What was decided;

· Why it was decided that way;

· What was ruled out, and why.

Read MEMORY.md at the start of each session. Do not conflict with recorded decisions without prompting.

→ Session End Summary

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

· What was handled;

· What was completed;

· What is still in progress;

· What decisions were made;

· Priorities for the next session.

→ ERRORS.md Failure Log

Maintain a file named ERRORS.md. When an approach has been tried more than twice without success, record it:

· What didn't work;

· What finally worked;

· What to watch for next time.

Check ERRORS.md before proposing solutions for similar tasks.

→ Permanent Fact List

The following facts are always true for this project and must be applied to every session without exception:

[Your permanent constraints, architectural decisions, and rules]

If a task conflicts with these facts, point it out before executing.

→ Lock Down the Tech Stack

The project's tech stack is as follows. Always use these tools. Do not recommend alternatives unless I explicitly 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 a tool seems unsuitable, you can point it out. But unless I explicitly state otherwise, you must use the defined tech stack.

→ Enable Extended Thinking for Difficult Decisions

For problems involving system architecture, performance trade-offs, database design, or long-term technical decisions, use the extended thinking mode.

Analyze the problem step-by-step, point out trade-offs I might not have considered, identify assumptions that might not hold at scale, and then give your recommendation.

→ The 4 Viral Rules

Karpathy summarized 4 behaviors that cause Claude Code to fail. A developer distilled them into these 4 lines of rules. Coding accuracy increased from 65% to 94% as a result.

Ask, don't assume.
If anything is unclear, ask before writing the first line of code. Do not make silent assumptions about intent, architecture, or requirements.

Do the simplest thing first.
Always implement the simplest solution that works first. Do not add abstraction layers or flexibility not explicitly requested.

Don't touch unrelated code.
If a file or function is not directly related to the current task, don't modify it. Even if you think it could be optimized, leave it alone.

Explicitly mark uncertainty.
If you are unsure about a solution or technical detail, state it before proceeding. Acting confident without certainty causes more damage than admitting a knowledge gap.

· Weekly recovery cost from forgotten decisions and bad advice: $300 per developer

· Wrong tech stack recommendations and incompatible tools: $75 per week

· Memory-related waste per developer: $375 / week

· 5-person team: $1,875 / week

· MEMORY.md + ERRORS.md + Tech Stack setup time: 20 minutes

Conclusion

The full cost breakdown is as follows:

· Weekly cost of re-explaining context: $375

· Weekly cost of rolling back unauthorized changes: $225

· Weekly cost of handling problems from forgotten decisions: $375

· Total waste per developer per week: $975.

For a 5-person dev team: $4,875 per week. $253,500 per year.

Setting up CLAUDE.md only takes 2 hours in total.

Karpathy's 4 rules alone increased coding accuracy from 65% to 94%.

A plain text file, 21 rules, two hours of work.

Developers who complete this setup are effectively using a more reliable Claude: one that remembers decisions, controls task scope, asks for confirmation before destructive actions, and doesn't recommend frameworks that would break the existing architecture.

Those who haven't set it up are still spending $975 a week repeating themselves.

P.S.: Start with Karpathy's 4 rules. Just these 4. Paste them into a new file named CLAUDE.md in your project's root directory right now. It takes 2 minutes. Then gradually supplement it each week based on the gaps you discover.

Bookmark this before it gets lost in your feed. And if you find it useful, share it with someone who genuinely needs it.

Связанные с этим вопросы

QWhat is CLAUDE.md and what problem does it solve for Claude Code users?

ACLAUDE.md is a plain text file placed in a project's root directory. It serves as an instruction manual for Claude Code, which automatically reads it at the start of each session. It solves the problem of developers having to repeatedly re-explain project context, tech stack, code standards, previous decisions, and constraints to Claude Code in every new session. This reduces repetitive explanations, prevents the AI from making incorrect assumptions or unauthorized changes, and makes AI-assisted programming more stable and controllable.

QAccording to the article, what are the four core rules from Andrej Karpathy that significantly improve Claude Code's accuracy?

AThe four core rules from Andrej Karpathy are: 1. Ask first, don't assume: If anything is unclear, ask before writing the first line of code. Do not make silent assumptions about intent, architecture, or requirements. 2. Do the simplest thing first: Always implement the simplest solution that works. Do not add abstraction layers or flexibility that weren't explicitly requested. 3. Don't touch unrelated code: If a file or function is not directly related to the current task, do not modify it. Even if you think it could be optimized, leave it alone. 4. Explicitly mark uncertainty: If you are unsure about a solution or technical detail, state it before proceeding. Acting confidently without certainty causes more harm than admitting a knowledge gap.

QWhat is the estimated weekly financial waste per developer mentioned in the article for not using CLAUDE.md?

AThe article estimates a weekly financial waste of $975 per developer for not using CLAUDE.md. This breaks down into three categories: $375 for repeating contextual explanations, $225 for rolling back unauthorized changes, and $375 for dealing with problems caused by forgotten decisions and wrong suggestions.

QWhat specific behaviors should be prevented according to the 'Behavioral Constraints' section of an ideal CLAUDE.md file?

AAccording to the 'Behavioral Constraints' section, an ideal CLAUDE.md file should enforce rules to prevent Claude Code from: 1. Making changes outside the direct scope of the task (e.g., unauthorized refactoring, renaming, reformatting). 2. Executing significant modifications (rewrites, deletions, structural changes) without prior confirmation. 3. Performing any destructive operations (deleting files, overwriting code, database changes) without explicit, in-session confirmation. 4. Taking production environment actions (deployments, migrations, external API calls) without mandatory pause and confirmation. 5. Failing to clearly list all changes made after a coding task. 6. Acting on the user's behalf (sending emails, sharing documents) without explicit confirmation. 7. Writing code for complex tasks without first showing reasoning and identifying uncertainties.

QWhat are the MEMORY.md and ERRORS.md files used for, as suggested in the article?

AThe article suggests using MEMORY.md and ERRORS.md files to provide Claude Code with a form of 'memory'. MEMORY.md is a decision log where important project decisions (what was decided, why, and what was excluded) are recorded. Claude should read this at the start of each session and avoid conflicting with logged decisions. It should also write a session summary to this file when a session ends. ERRORS.md is a failure log. When a solution attempt fails more than twice, it should be recorded (what didn't work, what finally worked, what to watch for next). Claude should check this file before proposing solutions for similar tasks.

Похожее

"Water Scarcity": The Hidden Fatal Flaw of AI Infrastructure

“Water Scarcity: The Hidden Vulnerability of AI Infrastructure” In June 2026, SpaceX revised its IPO prospectus to highlight a core resource constraint alongside power and processors: water. This move signals a pivotal shift where water scarcity has transformed from an operational cost to a major, uncontrollable investment risk, directly threatening AI data center expansion. The scale of the problem is immense. U.S. data centers consumed an estimated 17 billion gallons of water for direct cooling in 2023, with indirect water use for power generation exceeding 211 billion gallons. Giants like Google alone use billions of gallons annually, with single sites consuming volumes equivalent to a medium-sized city. This water is largely “consumptive,” evaporated into the atmosphere and lost. This massive demand is colliding with scarcity. Tech companies are building “water tigers” in arid regions, sparking community protests in places like Mexico and Arizona, where data centers can legally use millions of gallons daily—enough for tens of thousands of residents. These conflicts are not about illegality, but about a mismatch between historic water allocation frameworks and new, colossal demand. The consequences are real. Community opposition, largely centered on water, has reportedly stalled or canceled $64 billion in U.S. data center projects over two years. Simultaneously, investors are pressuring companies for greater water footprint transparency, viewing it as a financial risk, not just an ESG metric. Technological solutions like air or liquid cooling involve trade-offs between water and electricity use, with final choices dictated by local constraints. The irony is stark: while industry leaders envision AI as a utility “like water,” its physical infrastructure is straining real-world water supplies. The race for AI supremacy may ultimately be governed not by the fastest chip, but by the slowest water meter.

marsbit23 мин. назад

"Water Scarcity": The Hidden Fatal Flaw of AI Infrastructure

marsbit23 мин. назад

Global Card Issuance Enters a Compliance-Driven Era: WasabiCard is Building the Next-Generation Payment Infrastructure

Global card issuance is entering a compliance-driven era, with WasabiCard building next-generation payment infrastructure. The platform asserts that as stablecoins increasingly enter cross-border payments, corporate settlements, and global commerce, the industry is shifting focus from "availability" and "growth-driven" models to long-term, compliant operation under global frameworks. Competition will center on sustainable compliance and global infrastructure capabilities. Stablecoins are evolving from on-chain assets into key payment tools in global business, with card issuance acting as critical infrastructure connecting digital assets to traditional payment networks like Visa and Mastercard. This expansion has revealed structural issues, including cross-regional issuance, BIN resource management, and insufficient AML and risk controls. In response, the industry is moving away from reliance on "grey efficiency" towards prioritizing compliance, risk management, and long-term operational stability. WasabiCard outlines its strategy: collaborating with licensed principals and local partners for localized operations, building robust KYC/AML systems, strictly separating commercial and consumer BIN usage, and enhancing global issuance, payment, and cross-border fund flow infrastructure. The goal is to build stable, scalable payment infrastructure amid evolving global regulations, shifting industry competition from scale to infrastructure capability. As stablecoins integrate further with global commerce, payment infrastructure will become a fundamental, embedded component of internet business. WasabiCard will continue to develop capabilities in global card issuance, stablecoin payments, cross-border fund flows, and API-driven financial workflows.

marsbit34 мин. назад

Global Card Issuance Enters a Compliance-Driven Era: WasabiCard is Building the Next-Generation Payment Infrastructure

marsbit34 мин. назад

Zhou Hang: How Much Is SpaceX Really Worth?

**Zhou Hang: How Much is SpaceX Really Worth?** SpaceX, arguably one of the greatest industrial companies of the past 50 years, is reportedly targeting a staggering $1.75 trillion valuation in its potential IPO. However, the author argues this figure is inflated by approximately $1.25 trillion when assessed through standard financial metrics. The analysis begins by acknowledging SpaceX's undeniable success: drastically reducing launch costs, achieving near-monopoly in commercial launches, and building the strategic Starlink network. Its achievement surpasses even Tesla's, given it disrupted a state-monopolized industry. Despite this greatness, a $1.75 trillion valuation places SpaceX above the combined market cap of Boeing, Lockheed Martin, Northrop Grumman, RTX, and General Dynamics. Projecting optimistic 2030 revenues of $50-80 billion and applying generous tech-sector multiples yields a "reasonable" valuation range of $500 billion to $1.2 trillion. The $1.25 trillion gap is attributed to three non-financial premiums: 1. **Long-term vision premium** for future Starship-enabled markets (e.g., space-based computing). 2. **Sovereign asset/strategic premium**, as SpaceX is deeply integrated into U.S. national security. 3. **Retail narrative/Musk cult premium**, driven by a heroic story and personal following. Post-IPO, three scenarios are outlined: valuation solidifying (25% probability), sideways volatility as narrative outpaces reality (50%), or a re-rating down to $800B-$1.2T if execution falters or Musk-related risks emerge (25%). The probability-weighted expected value is $1.3-1.5 trillion, suggesting negative expected returns for those buying at the IPO price. The conclusion advises investors to separate the company's excellence from its stock price. Buying at the IPO likely prices in excessive optimism. A more prudent strategy would be to wait for key milestones (e.g., Starship V3 stability) or a significant price correction before investing, or to treat an early purchase as a long-term, high-conviction hold with limited position size, not a short-term bet.

链捕手38 мин. назад

Zhou Hang: How Much Is SpaceX Really Worth?

链捕手38 мин. назад

Торговля

Спот
Фьючерсы

Популярные статьи

Как купить S

Добро пожаловать на HTX.com! Мы сделали приобретение Sonic (S) простым и удобным. Следуйте нашему пошаговому руководству и отправляйтесь в свое крипто-путешествие.Шаг 1: Создайте аккаунт на HTXИспользуйте свой адрес электронной почты или номер телефона, чтобы зарегистрироваться и бесплатно создать аккаунт на HTX. Пройдите удобную регистрацию и откройте для себя весь функционал.Создать аккаунтШаг 2: Перейдите в Купить криптовалюту и выберите свой способ оплатыКредитная/Дебетовая Карта: Используйте свою карту Visa или Mastercard для мгновенной покупки Sonic (S).Баланс: Используйте средства с баланса вашего аккаунта HTX для простой торговли.Третьи Лица: Мы добавили популярные способы оплаты, такие как Google Pay и Apple Pay, для повышения удобства.P2P: Торгуйте напрямую с другими пользователями на HTX.Внебиржевая Торговля (OTC): Мы предлагаем индивидуальные услуги и конкурентоспособные обменные курсы для трейдеров.Шаг 3: Хранение Sonic (S)После приобретения вами Sonic (S) храните их в своем аккаунте на HTX. В качестве альтернативы вы можете отправить их куда-либо с помощью перевода в блокчейне или использовать для торговли с другими криптовалютами.Шаг 4: Торговля Sonic (S)С легкостью торгуйте Sonic (S) на спотовом рынке HTX. Просто зайдите в свой аккаунт, выберите торговую пару, совершайте сделки и следите за ними в режиме реального времени. Мы предлагаем удобный интерфейс как для начинающих, так и для опытных трейдеров.

1.4k просмотров всегоОпубликовано 2025.01.15Обновлено 2026.06.02

Как купить S

Sonic: Обновления под руководством Андре Кронье – новая звезда Layer-1 на фоне спада рынка

Он решает проблемы масштабируемости, совместимости между блокчейнами и стимулов для разработчиков с помощью технологических инноваций.

2.3k просмотров всегоОпубликовано 2025.04.09Обновлено 2025.04.09

Sonic: Обновления под руководством Андре Кронье – новая звезда Layer-1 на фоне спада рынка

HTX Learn: Пройдите обучение по "Sonic" и разделите 1000 USDT

HTX Learn — ваш проводник в мир перспективных проектов, и мы запускаем специальное мероприятие "Учитесь и Зарабатывайте", посвящённое этим проектам. Наше новое направление .

1.8k просмотров всегоОпубликовано 2025.04.10Обновлено 2025.04.10

HTX Learn: Пройдите обучение по "Sonic" и разделите 1000 USDT

Обсуждения

Добро пожаловать в Сообщество HTX. Здесь вы сможете быть в курсе последних новостей о развитии платформы и получить доступ к профессиональной аналитической информации о рынке. Мнения пользователей о цене на S (S) представлены ниже.

活动图片