Skip to content

Context Engineering for Claude 5: The New Rules (Guide)

Anthropic just dropped new context engineering rules for Claude 5. Here's a hands-on tutorial to audit your CLAUDE.md and cut the token bloat.

7 min readBeginner

Here’s the contrarian take: the worst thing you can do this week is swap your claude-3-5-sonnet string for an Opus 5 model ID and call it a migration. You’ll pay premium prices to solve problems that no longer exist – because your 4,000-line CLAUDE.md is still fighting a 2024 war.

The new context engineering rules for Claude 5 dropped on July 24, 2026 – the same day Opus 5 launched. Anthropic’s Thariq posted the thread. The community’s reaction? Half celebration, half quiet panic – because most teams built their agent scaffolds around the opposite advice.

What actually changed

Four-fifths of Claude Code’s system prompt – gone. Anthropic reports they removed over 80% of it for Opus 5 and Fable 5 (as named in their July 2026 announcement) with no measurable loss on coding evals. Dead weight, all of it, that the newer models simply don’t need.

Three shifts explain why. First: rules give way to judgment. Stop writing “never do X” unless you have a documented failure mode the model can’t reason out of on its own. Second: examples give way to interface design. Showing Claude how to use your tools constrains it to a narrow exploration space – encode constraints in typed parameters and enums instead. Third: everything-upfront gives way to progressive disclosure. You don’t need every instruction in the system prompt because Claude Code now supports skills that load when relevant, not at startup.

If a constraint in your CLAUDE.md exists because Claude made the same mistake twice in early 2025, test whether Opus 5 still needs that guardrail. Half of them are historical baggage.

The hands-on audit: pruning your CLAUDE.md in 20 minutes

Open your repo’s CLAUDE.md next to this guide. Top to bottom.

Step 1: Run the built-in diagnostics

In Claude Code, run /doctor – a diagnostics command that surfaces prompt sections it suspects are redundant. (This feature rolled out with the July 2026 update; check your Claude Code version if the command isn’t recognized.) Don’t blindly accept every suggestion. Read each one, apply it or annotate why you’re keeping it. Compliance rules stay. “Please use 2-space indentation” probably doesn’t.

Step 2: Kill the obvious stuff

Anthropic’s guidance is direct: briefly describe what your repo is for, then spend the remaining tokens on actual codebase gotchas – the weird stuff Claude can’t infer from your file tree. Lines like these are candidates to cut:

  • “This is a TypeScript project.” – Claude can see your tsconfig.json.
  • “Run tests with npm test.” – it’s in package.json.
  • “Do not delete files without asking.” – Opus 5 already defaults cautious on destructive operations.

Step 3: Convert rules into interface design

This is the shift people miss. Instead of a rule in CLAUDE.md, encode the constraint in the tool signature:

// BEFORE - rule in CLAUDE.md
// "When updating a task, status must be one of:
// pending, in_progress, or completed. Never use
// other values like 'done' or 'wip'."

// AFTER - encoded in the tool schema
{
 name: "update_task",
 input_schema: {
 type: "object",
 properties: {
 status: {
 type: "string",
 enum: ["pending", "in_progress", "completed"]
 }
 }
 }
}

The enum tells Claude everything the paragraph did – and it can’t be forgotten mid-context.

Step 4: Move recurring instructions into Skills

Turns out the token math here is compelling. Per the State of Context Engineering 2026 report: a skill’s name and description load at startup – around 80 tokens. The full instruction body (275-8,000 tokens) loads only when the model decides it’s relevant. If your CLAUDE.md has 400 lines on “how to write a migration,” that’s a skill, not a system prompt entry.

The pitfalls nobody’s talking about

Pitfall 1 – the model-ID-only migration. Swap the model ID, keep the giant CLAUDE.md, and you get the worst of both worlds. Opus 5’s stronger reasoning (an inference from its benchmark profile, not a documented spec) may mean it follows conflicting rules more diligently – which is genuinely worse than a less capable model quietly ignoring them. You’re paying Opus 5 rates to fight friction that shouldn’t exist.

Pitfall 2 – treating 200K context as free space. Claude Opus 4.5 – and the 5-gen models built on similar architecture – supports 200,000 input tokens and 64,000 output tokens per Vertex AI’s model docs. That sounds generous. It’s a trap. A mid-2025 Chroma Research technical report found that dumping full conversation history (~113k tokens) drops accuracy by ~30% compared to a focused 300-token input. More tokens in the window ≠ more understanding in the response.

Pitfall 3 – over-pruning regulated domains. Anthropic’s “no measurable loss” claim is on their coding evals. If you run in finance, healthcare, or anything audited, some hard rules must stay – not because Opus 5 can’t reason them out, but because your auditor needs to see them documented. Keep them. Annotate why, so the next engineer doesn’t re-prune in six months.

The performance math

Every token in your CLAUDE.md ships on every request. Cut from 8,000 tokens to 1,500 and you save 6,500 tokens per turn. Across a 200-turn agent session: 1.3 million tokens you’re no longer paying for.

The upside isn’t only cost. Docs say the benchmark gains are real – Arize AI hit +10% on SWE-Bench by optimizing only the system prompt, zero architecture changes, zero fine-tuning. The best model with a bloated prompt loses to the same model with a lean one.

Change Effort Typical impact
Swap model ID only 1 minute Marginal – sometimes worse
Prune CLAUDE.md obviousness 20 minutes 10-30% fewer wasted tokens
Convert rules → tool schemas 1-2 hours Fewer schema violations
Move sections → Skills Half a day Faster start, cleaner context

Which raises an honest question worth sitting with: if prompt engineering alone can close a 10% benchmark gap, how much of the “Opus 5 is better” story is actually about the model weights – and how much is just Anthropic having cleaned up their own prompts? The answer probably matters for how you set expectations with your team.

When NOT to apply this

The new rules aren’t universal. Skip the “unhobble everything” advice if:

  • You ship into a regulated environment where deleting a rule requires a compliance review.
  • You have no eval use of your own – Anthropic’s “no measurable loss” is on their coding evals, not yours.
  • Your team is already productive on Claude 4-era prompts and the migration cost outweighs the token savings.

Solo developer using Claude Code casually? Most of this is overkill. Delete the obvious stuff and move on.

What the community’s actually saying

Agent-framework authors are quietly rewriting scaffolds. Enterprise teams with six-month-old CLAUDE.md files are running noise-tests before they touch anything. And there’s a vocal minority arguing this is Anthropic marketing – a way to make Opus 5 look better by comparing it to a deliberately overbuilt baseline.

That critique has some merit. But “both things are true” isn’t a comfortable position to hold, so people pick a camp. The prompt-diet works – Arize’s SWE-Bench number is real. The framing also helps Anthropic. Test on your own eval set and stop waiting for the community to settle it.

FAQ

Do these rules apply to Claude via API, or only Claude Code?

Both. Same model, same behavior. Claude Code is just where Anthropic tested and published the pruned prompt – the three shifts apply directly to any agent use you build.

Should I delete my CLAUDE.md entirely?

No. Thin it, don’t kill it. The goal is to keep codebase-specific gotchas – “types live in one monolithic file,” “migrations require this specific CLI tool” – and cut everything Claude can figure out from your file tree. One useful test: paste a line into Claude and ask if it could have inferred that from ls -la. If yes, cut it. Revisit Step 2 above for the full criteria.

Is Opus 5 actually worth switching to?

Here’s what gets missed in the excitement: Opus 5 launched at roughly half the price of Claude’s previous frontier model – so even if performance were identical, the economics shift. But independent testers are still split on real-world task quality versus Anthropic’s benchmarks. Run it on your own eval use for a week. That’s the only benchmark that will tell you anything useful about your specific product.

Your next step: open your CLAUDE.md right now and delete every line that describes something Claude can see in your file system. That’s the 10-minute version of this entire guide.