Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
AI Brainbox logo AI Brainbox logo AI BrainBox

AI Tools | Automation | Workflows

AI Brainbox logo AI Brainbox logo AI BrainBox

AI Tools | Automation | Workflows

  • Home
  • Tutorials
  • About
  • Contact
  • Privacy Policy
  • Home
  • Tutorials
  • About
  • Contact
  • Privacy Policy
Close

Search

Trending Now:
Free AI Voice Generator Claude code for free Free AI tools Local AI models
  • FaceBook
  • X
  • LinkedIn
  • Instagram
  • YouTube
Subscribe
AI Brainbox logo AI Brainbox logo AI BrainBox

AI Tools | Automation | Workflows

AI Brainbox logo AI Brainbox logo AI BrainBox

AI Tools | Automation | Workflows

  • Home
  • Tutorials
  • About
  • Contact
  • Privacy Policy
  • Home
  • Tutorials
  • About
  • Contact
  • Privacy Policy
Close

Search

Trending Now:
Free AI Voice Generator Claude code for free Free AI tools Local AI models
  • FaceBook
  • X
  • LinkedIn
  • Instagram
  • YouTube
Subscribe
Home/AI Coding/The 12 CLAUDE.md Rules That Make Claude Code Far More Reliable
The 12 CLAUDE.md Rules That Make Claude Code Far More Reliable
AI CodingPrompt Engineering

The 12 CLAUDE.md Rules That Make Claude Code Far More Reliable

By Umair Alam
November 21, 2026 5 Min Read
0

One plain text file has become one of the most talked-about tricks for working with Claude. Developers who put the right rules inside it report far fewer mistakes from Claude Code, and the GitHub repo collecting those rules grew to well over 100,000 stars. In this post I break down what the file is, where the rules came from, all 12 of them in plain English, and a template you can copy.

The backstory

It started with Andrej Karpathy, one of the most respected AI researchers around and a co-founder of OpenAI, posting his frustrations with how Claude writes code. The complaints were specific: it made assumptions instead of asking, it overcomplicated simple things, and it touched code it wasn’t supposed to touch.

A developer named Forrest Chang turned those complaints into four rules, a cheat sheet for Claude, and published it on GitHub. It took off. Later, another engineer (who goes by Mnilax) extended the list to 12 rules aimed at how people use Claude today, including multi-agent workflows. That extended version is what went viral.

What is CLAUDE.md?

CLAUDE.md is a file you put in the root of your project. Claude Code reads it at the start of every session, before doing anything, and treats whatever is inside as ground rules. Think of it as an employee handbook that the employee rereads every morning before starting work.

Rules 1–4: the originals

1. Think before coding

No hidden assumptions. If Claude isn’t sure, it should ask, not guess. If there’s a trade-off, it should lay it out before choosing. Without this rule, Claude tends to guess and hope for the best.

2. Simplicity first

Write the smallest solution that works. No features nobody asked for, no elaborate systems for a one-off task.

3. Surgical changes

Only touch what the task requires. Don’t tidy nearby code, don’t reformat, don’t refactor things that aren’t broken. Do the task and stop.

4. Goal-driven execution

Instead of giving Claude step-by-step instructions, describe what success looks like and let it find the path.

Rules 5–12: the 2026 extensions

5. Use the model only for judgment calls

Claude shines at writing, summarizing, categorizing, and extracting meaning. For mechanical, predictable work like routing a request or handling an error code, use regular code. Don’t spend AI on something an if statement can do.

6. Treat the token budget as a hard limit

Keep a single task under about 4,000 tokens and a session under about 30,000. When it gets close, Claude should summarize and restart rather than silently blowing past the limit. This keeps it focused on long tasks.

7. When two patterns conflict, pick one and explain why

Blending two approaches is the worst outcome. Choose the newer or better-tested one, explain the choice, and flag the other for cleanup later.

8. Read before you write

Before editing a file, understand what depends on it: who calls this function, what this module exports. “Looks unrelated” is one of the most dangerous phrases in engineering.

9. Tests should verify intent, not just behavior

A test that only checks what the code does today doesn’t protect you. A good test fails when the business logic changes.

10. Checkpoint after every step

In multi-step work, Claude should summarize after each step: what it did, what it verified, and what’s left. If it can’t say that clearly, it should stop. This prevents it from confidently charging in the wrong direction.

11. Follow existing conventions

Use the project’s existing naming and patterns, even if Claude would prefer something else. Changing conventions is a separate conversation, not something to do quietly mid-task.

12. Fail loudly

My favorite. If a migration skipped 30 rows, don’t report it as complete. If a test was skipped, don’t say all tests passed. Claude should surface uncertainty instead of hiding it.

A CLAUDE.md template you can copy

Here’s a condensed version of all 12 rules. Save it as CLAUDE.md in your project root and edit it to fit your project:

# Working rules

1. Think before coding. Ask when unsure; state trade-offs before choosing.
2. Simplicity first. Smallest working solution; no unrequested features.
3. Surgical changes. Touch only what the task needs; no drive-by refactors.
4. Goal-driven. Work toward the stated success criteria.
5. Use AI judgment only where it adds value; use plain code for mechanical logic.
6. Respect token budgets: summarize and restart before context gets bloated.
7. If two patterns conflict, pick one, explain why, flag the other for cleanup.
8. Read before you write: check callers and dependencies first.
9. Tests must verify intended behavior, not just current behavior.
10. After each step: what I did, what I verified, what is left.
11. Follow the existing conventions of this codebase.
12. Fail loudly: report skipped work, failures, and uncertainty explicitly.

Why this matters even if you don’t code

Strip away the developer language and these are just good principles for working with any AI: think before acting, keep it simple, stay in your lane, verify the work, and be honest about what you don’t know. They’re the same things you’d want from a capable, trustworthy assistant. The post went viral because people recognized the problems: AI tools tend to overcomplicate, assume, and sound confident when they shouldn’t.

You can apply the same ideas in ChatGPT custom instructions or a Claude Project’s instructions. My prompt engineering guide covers more of the basics.

One warning: more rules is not better

The original research behind this noted that compliance drops off sharply past about 14 rules. Twelve is already near the edge. Keep the file short and specific, and make every rule answer one question: what exact mistake does this prevent?

FAQ

Where do I put CLAUDE.md?

In the root folder of your project. Claude Code picks it up automatically at the start of each session.

Does CLAUDE.md work with other AI coding tools?

The file name is specific to Claude Code, but the rules themselves work in any agent’s instruction file or system prompt.

Related tutorials

  • Run Claude Code on Free AI Models with OmniRoute
  • ChatGPT Prompt Engineering for Beginners
  • DeepSeek TUI (CodeWhale): A Free, Open-Source Claude Code Alternative
Author

Umair Alam

Umair Alam is a data scientist, AI educator, and the founder of AI BrainBox, which publishes step-by-step tutorials on local AI, AI automation, and AI coding tools.

Follow Me
Other Articles
How to Run DeepSeek TUI for Free with NVIDIA NIM (No Credit Card)
Previous

How to Run DeepSeek TUI for Free with NVIDIA NIM (No Credit Card)

FreeLLMAPI Tutorial: Combine 14 Free AI Provider Tiers Into One Endpoint on Windows
Next

FreeLLMAPI Tutorial: Combine 14 Free AI Provider Tiers Into One Endpoint on Windows

Recent Posts

  • How to Run ComfyUI for Free on Google Colab (No GPU Needed)
  • NotebookLM (Gemini Notebook) Complete Guide: Learn Faster From Your Own Sources
  • Ox Alpha: The Anonymous 1M-Context Model That Appeared on OpenRouter
  • Lovart AI: Build a Brand Logo, Website, and Social Posts in One Sitting
  • Kimi K3: Moonshot’s 2.8-Trillion-Parameter Open Model, Explained and Tested
Hey, I’m Umair. I’m a Data Scientist passionate about AI, exploring emerging technologies, and sharing practical tutorials that help people work smarter with AI.
  • X
  • Instagram
  • Facebook
  • YouTube
Open to AI Projects
Get In Touch

Recent Posts

  • How to Run ComfyUI for Free on Google Colab (No GPU Needed)
    How to Run ComfyUI for Free on Google Colab (No GPU Needed)
    by Umair Alam
    November 21, 2026
  • clone-voice-free-voicebox-tutorial
    Clone Any Voice for Free with Voicebox: Full 2026 Guide
    by Umair Alam
    June 26, 2026
  • chatgpt-prompt-engineering
    ChatGPT Prompt Engineering for Beginners: How to Get Better Results Every Time
    by Umair Alam
    June 27, 2026
  • how-to-run-ai-locally-ollama-guide
    How to Run AI Locally on Your PC with Ollama (No Cloud, No Subscription)
    by Umair Alam
    June 27, 2026
ai brainbox

We're exploring the latest and greatest AI tools and techniques, providing you with everything you need to know to keep up with this rapidly evolving field. Passionate about making AI accessible and understandable to everyone.

  • Facebook
  • X
  • Instagram
  • LinkedIn

Latest Posts

  • How to Run ComfyUI for Free on Google Colab (No GPU Needed)
  • NotebookLM (Gemini Notebook) Complete Guide: Learn Faster From Your Own Sources
  • Ox Alpha: The Anonymous 1M-Context Model That Appeared on OpenRouter
  • Lovart AI: Build a Brand Logo, Website, and Social Posts in One Sitting
  • Kimi K3: Moonshot’s 2.8-Trillion-Parameter Open Model, Explained and Tested

Menu

  • Home
  • Tutorials
  • About
  • Contact
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer

Contact

Email

contact@aibrainbox.io

Location

New York, USA

AI BrainBox newsletter

Get new AI tutorials in your inbox

Step-by-step guides on local AI, free AI models, and AI coding tools. No spam, unsubscribe any time.

Copyright 2026 — AI BrainBox. All rights reserved.