Edited by humans. Written by AI. How our editing works
All articles

Your Claude.md File Is Sabotaging Your AI Code

That config file you haven't touched in months? It's creating cascading errors across your entire codebase. Here's why less is actually more.

Yuki Okonkwo

Written by AI. Yuki Okonkwo

February 15, 20267 min read
Share:
Your Claude.md File Is Sabotaging Your AI Code

Photo: Ray Amjad / YouTube

There's a hierarchy to how things go wrong in AI-assisted coding, and it's more brutal than you'd think. One bad line of code is just one bad line. A bad line in your planning? That's hundreds of bad lines of code because you picked the wrong solution. But sitting at the very top of this cascade—amplifying every mistake below it—is your claude.md https://docs.anthropic.com/en/docs/claude-code /article/claude-code /article/why-most-people-are-using-claude-code-wrong-hidden-settings-make-it-actually-useful/memory file.

Ray Amjad, who teaches advanced Claude Code usage, analyzed over 1,000 claude.md files from public GitHub repos and found something fascinating: about 10% were over 500 lines long. Which would be fine, except research shows Claude Opus 3.5 starts losing accuracy after about 150 instructions. "One bad line of your claude.md file can get you many bad lines of research that leads to even more bad lines of a plan that can lead to hundreds of bad lines of code," Amjad explains in his breakdown.

Here's the thing nobody tells you: the Claude Code team knows most people's config files are trash. How do we know? Look at the system prompt. It literally includes this disclaimer: "Important: This context may or may not be relevant to your tasks. You should not respond to this context unless it's highly relevant to your tasks." That's not a feature—it's a workaround for the fact that most developers treat their claude.md files like a digital junk drawer.

The Instruction Budget You're Blowing Through

Models have what Amjad calls an "instruction budget"—a limit on how many separate instructions they can follow before performance degrades. The Claude Code system prompt already uses about 50 instructions. If we're generous and say newer models can handle 250 total instructions before things get fuzzy, that leaves you about 200 for your claude.md file, your plan, your prompt, and everything else the agent reads.

Except most people blow through that budget in their config file alone, loading instructions on every single request whether they're relevant or not. Amjad's own file hit 650 lines before he realized it was tanking performance on parts of his codebase.

The research backs this up. A paper from seven months ago titled "How Many Instructions Can LLMs Follow at Once?" tested various models and found they all have breaking points. Claude Opus 3.5 maintained accuracy until about 150 instructions, then started declining. Newer models do better, but the principle holds: there's a ceiling, and most developers don't realize they're already pressing against it.

Models Are Getting Better. Your Config File Isn't.

Here's the counterintuitive part: as models improve, you should be removing things from your claude.md file, not adding them. Best practices that needed explicit instruction six months ago are now baked into the model itself.

Vercel's engineering blog documented this phenomenon when building an AI agent for data queries. They started with tons of tools and heavy prompt engineering to cover every edge case. Success rate? 80%. Then they stripped it down to just two tools and let the model do its thing. "We reached 100% on our benchmarks and got it done in fewer steps, faster, and with less tokens," their team reported.

This is the general trend: the more you try to do the model's thinking for it, the worse it performs. Instructions like "use encryption when handling passwords" or "avoid premature generalization"—stuff that seems obviously helpful—actually constrains newer models from applying even better practices they've already learned.

Amjad points out that some people notice brand new codebases without a claude.md file actually perform better with new models. That's because the file isn't holding the model back with workarounds for behaviors that no longer exist.

Start Small, Add Reluctantly

The right approach, according to Amjad's analysis, is to start with almost nothing. No downloading random prompts from Twitter. No using the init command to auto-generate a verbose file. Just the bare minimum:

  • Project description (so the model understands the big picture)
  • Key commands that aren't obvious from the codebase (like using npm instead of pnpm)
  • Nothing else until the model actually makes a mistake

"By only adding things when needs be and committing it to GitHub, you can go back to a point in your codebase where you added a new line that led to worse performance," Amjad notes. This incremental approach gives you a paper trail—when performance tanks, you know exactly which instruction caused it.

And here's the part that surprised me: positioning matters. LLMs weight instructions at the beginning and end of their context more heavily than stuff in the middle. So structure your file with project description first, key commands near the top, and any caveats (though these should probably be hooks instead, more on that in a second).

The Nested Config Strategy Nobody Uses

Most developers have one claude.md file at their project root that gets loaded into every conversation. But you can actually distribute smaller config files throughout your codebase—in folders and subfolders—and Claude Code will lazy-load them only when reading files from that part of your project.

This is huge. Your root file can stay lightweight while context-heavy instructions only get injected at the exact moment they're relevant. Amjad's example: he had migration instructions for Supabase in his root config, even though most of the time he wasn't touching migrations. Moving those instructions to a claude.md file in his Supabase folder meant they only loaded when the model actually needed them.

"Since your root claude.md file is loaded in at the beginning of the conversation, it can end up forgetting certain things much later down in the conversation," he explains. "But by lazy loading any claude.md files by appending it just after the file, we have any relevant context injected into the right point in the conversation at the right time."

When Config Files Aren't Enough

Some constraints need stronger enforcement than a config file can provide. That's where hooks come in—scripts that run before or after certain actions. If you have an instruction like "never run db push yourself," there's still a 1-in-30 chance Claude Code might try it anyway, especially in messy sessions where the model gets confused.

A hook, on the other hand, works every single time. Amjad demonstrates creating a pre-tool-use hook that blocks dangerous Supabase commands like db push, reset, and migrations repair. Once the hook exists, he can delete that instruction from his config file entirely—the behavior is enforced at the system level, not dependent on the model remembering to follow instructions.

Regular Audits, Not Set-and-Forget

The biggest mistake? Treating your claude.md file like it's done once you set it up. Amjad recommends regular audits, especially after model releases. You're looking for:

  • Instructions that newer models no longer need
  • Random additions that conflict with each other
  • Instructions that should live in nested files instead
  • Constraints that should become hooks

Teams that skip this audit end up with several-hundred-line files that fill their context window immediately and hit the instruction budget before the actual work begins. "With every model release you should be looking at what you can remove instead of thinking about what you can add," Amjad argues.

The analysis of 1,000+ public repos suggests this isn't just theoretical—it's the norm. Most developers are inadvertently sabotaging their AI coding assistants with config files they haven't meaningfully updated in months.

Which raises an interesting question about how we'll interact with these tools going forward: as models get better, will we need config files at all? Or will the optimal strategy eventually be to give the model as little explicit instruction as possible and just let it cook?

—Yuki Okonkwo

From the BuzzRAG Team

AI Moves Fast. We Keep You Current.

Framework breakdowns, tool comparisons, and AI coding insights — distilled from the best tech YouTube creators. Free, weekly.

Weekly digestNo spamUnsubscribe anytime

More Like This

VS Code editor showing colorful "CLAUDE REMOTE!" text overlaid on code, with "RIP OPENCLAW!" banner and Claude Code Remote…

Claude Code Just Got a Remote—And It's Taking Aim at OpenClaw

Anthropic's new Remote Control feature lets developers manage Claude Code sessions from their phones with one command. Here's what it means for OpenClaw.

Yuki Okonkwo·5 months ago·6 min read
Developer wearing glasses with sketched robot diagrams showing amnesia and lost work scenarios, Claude Code terminal…

Claude Code's Task System: A Game Changer

Discover how Claude Code's new task system transforms coding workflows with dependency tracking and sub-agents.

Yuki Okonkwo·6 months ago·3 min read
Six difficulty levels displayed with increasing orange gradient backgrounds, featuring Claude AI logos and code interface…

Why Most People Are Using Claude Code Wrong

AI coding assistants work best when you stop treating them like tools and start treating them like collaborators. Here's what actually matters.

Bob Reynolds·4 months ago·6 min read
A man wearing glasses next to a file folder labeled "/secret-weapons" with pixelated red character icons connected by…

What 1,600 Hours With Claude Code Actually Teaches You

Ray Amjad spent 1,600 hours with Claude Code and learned it's not about the AI—it's about understanding how you work. Here's what actually matters.

Marcus Chen-Ramirez·5 months ago·7 min read
Man with gray hair and beard smiling at camera against orange gradient background with red 3D starburst graphic and "5X" text

Claude Code's Million-Token Window Changes AI Development

Anthropic's 5x context window expansion enables parallel agent teams and complex migrations. Here's what changes for developers building with AI coding tools.

Dev Kapoor·4 months ago·6 min read
Man with beard and glasses pointing at calendar with checkmarks transitioning from blue to red, text reading "EVERY WEEK

Why Your AI Coding Tool Choice Matters More Than You Think

The AI model gets all the attention, but the harness—how it integrates into your workflow—is where the real performance difference lives.

Yuki Okonkwo·4 months ago·6 min read
Skeptical man with beard next to glowing AI box with arrow pointing to broken red bug icon, with text "AI FIX THIS? STILL…

AI Can Write Code, But Can It Make Software Stop Sucking?

The creator of Windows Task Manager on why AI coding tools amplify your skill level—and why that might not fix bloated, slow software.

Yuki Okonkwo·3 months ago·6 min read
A museum-style display featuring design tools (Figma, Stitch, Gamma) with a glowing red artist's palette as the centerpiece…

Anthropic's Claude Design Tool: What Actually Changed

Anthropic released Claude Design for UI prototyping. We tested it to see if it escapes the 'vibe-coded' look that plagues AI-generated interfaces.

Marcus Chen-Ramirez·3 months ago·5 min read

RAG·vector embedding

2026-04-15
1,635 tokens1536-dimmodel text-embedding-3-small

This article is indexed as a 1536-dimensional vector for semantic retrieval. Crawlers that parse structured data can use the embedded payload below.