DEV Community

Cover image for Make Claude Code Lean: Spend Less, Move Faster, Get More Done
Manly Beach Labs for Necoz

Posted on

Make Claude Code Lean: Spend Less, Move Faster, Get More Done

Long sessions cost 30x more tokens

Four simple habits to stop wasting tokens on clutter, with a ready-to-use example for each.

Introduction: Your Window Is Already Half Full

Out of the box, Claude Code can feel heavy. It burns through tokens, talks too much, and slows down. The reason is often not the model but the context budget: the limited space in the window that everything has to share.

Before you type a single word, that space is already taken by the system prompt, tool definitions, MCP servers, skills and your memory files. The more clutter at the start, the less room for real work, and the more your rules get ignored.

The goal is a lean setup: small instructions, only the tools you use, a clean window and a habit of resetting before quality drops. Here are four ways to get there.

1. Trim Your Global CLAUDE.md

This file loads every session, so every extra line costs you every time. A long file is also less effective: the longer it gets, the more of it is ignored.
Make the replies short. Tell Claude to use plain, simplified English and report only what you need to decide. A standard like ASD-STE100 (simplified technical English) is a good model.
Keep it under about 200 lines, with just enough context. Every few months, delete it and rebuild it from scratch.
Move "never do this" rules out of prose. Sentences in CLAUDE.md get forgotten in long sessions. Permission settings are enforced every time.
Example: a lean CLAUDE.md

# CLAUDE.md
## Style
- Use simple technical English. Short sentences.
- Say only what is needed. Report only what I need to make a decision.
Enter fullscreen mode Exit fullscreen mode

Project basics

  • Build: pnpm build Test: pnpm test
  • Details live in docs/ (open only when needed).

Example: a "never" rule as a permission, not a sentence

{
  "permissions": {
    "deny": ["Read(./.env)", "Bash(rm -rf:*)", "Bash(git push --force:*)"]
  }
}
Enter fullscreen mode Exit fullscreen mode

2. Audit What Loads Before You Type

You can't cut what you can't see. Claude Code has built-in commands that show where your tokens go.

  • /context in a fresh session shows what fills the window: system prompt, tools, memory files, skills. Remove the biggest item, restart, and check again.

  • /usage shows which MCP server, skill, agent or plugin is using the most tokens.

  • /mcp lets you toggle off servers you don't use. They stay in your config for later.

  • Make rarely used skills manual-only so they cost nothing until you call them.

  • Consider CLIs for simple jobs. A command returns only the lines you ask for. Be fair to MCP, though: a well-built server can also return small results, and a CLI can dump a whole file. Check /usage to find the heavy ones before switching anything off.

Example: a manual-only skill

---
name: release-notes
description: "Draft release notes from merged PRs"
disable-model-invocation: true
---
Summarize merged PRs since the last tag into user-facing notes.
Enter fullscreen mode Exit fullscreen mode

Example: audit routine (copy this prompt habit)

1. Open a fresh session. Run /context. Note the biggest item.
2. Run /usage. Note the top token user.
3. Remove or disable that one thing. Restart. Run /context again.
4. Repeat until the starting window is small.
Enter fullscreen mode Exit fullscreen mode

3. Use Effort and Resets Wisely

How you run a session matters as much as how you set it up.

  • Save high effort for planning. For most other work, medium or low is enough.

  • Reset at checkpoints. Use /clear (fresh start) or /compact (summarize) when you finish a milestone, or once the window passes roughly 400k tokens. Quality tends to drift as sessions grow, and regular resets keep it steady.

  • Watch the meter. Add the context meter to your status line with /statusline so you can see the window filling before it hurts.

Example: an effort plan

Plan the feature         -> high effort
Write code and tests     -> medium effort
Rename, format, tiny fix -> low effort
Milestone reached        -> /compact  (or /clear if the next task is unrelated)
Enter fullscreen mode Exit fullscreen mode

Example: a status line request

/statusline show the model name, current git branch,
and a context-window usage bar
Enter fullscreen mode Exit fullscreen mode

4. Offload Heavy Work

Claude Code doesn't have to do everything in one window.

  • Send big exploration to subagents. They read in their own window, and yours only receives a summary.

  • Use other tools for what they do best, for example a separate headless worker for vision-heavy tasks, so your main window stays focused on code.

Example: a delegation prompt

Use a subagent to search the codebase for every place we handle
refunds. Have it read files in its own context and return only:
- a list of file paths
- a 5-line summary of how the flow works
Do not paste file contents back to me.
Enter fullscreen mode Exit fullscreen mode

Conclusion

A fast, cheap Claude Code isn't about a secret setting. It comes from protecting your context budget:

  • Keep CLAUDE.md short, and enforce hard rules through permissions.

  • Audit with /context and /usage, then remove the biggest item first.

  • Match effort to the task and reset at checkpoints, before the window gets bloated.

  • Offload heavy reading to subagents so your main window stays clean.

Start with one change today: run /context in a fresh session and remove the single biggest item. You'll feel the difference right away.

Top comments (13)

Collapse
 
nyaomaru profile image
nyaomaru Necoz •

Great write-up! 😸💚

I use Claude Code at work, and one challenge I've noticed when working with large development teams is that AGENTS.md inevitably tends to grow over time.

The accompanying docs, skills, and rules also gradually become outdated without anyone noticing.

Lately, I've been wondering whether documentation is becoming one of the biggest sources of technical debt in the AI-assisted development era. 😹

We try to review these files at each development phase, but there's always quite a bit that needs updating.

I completely agree that regularly reviewing our configurations, instructions, and even forgotten MCP server settings is becoming increasingly important!

Thanks for sharing these practical tips! 😸👍

Collapse
 
manlybeachlabs profile image
Manly Beach Labs Necoz •

This is my first time posting on Necoz! Happy to receive your feedback to improve! Thank you!

Collapse
 
effessdev profile image
EffessDev Necoz •

Congratulations!!! 😊

Collapse
 
_komachi-jp profile image
Komachi | AI on a Budget •

The /context audit is the part I'll actually try first — I hadn't thought of checking what loads before I type anything. My setup is Claude Pro at $20 a month, so every token that goes to a bloated CLAUDE.md or an MCP server I never use is money I can see on the bill. I keep my instructions short for the same reason, but I never measured which item was the biggest. One question: after you trimmed yours down, did you notice the savings most in long sessions, or right away in short ones too?

Collapse
 
wendelas profile image
Wendel Assis Silva •

Good framing that the window is half full before you type. One thing worth adding: measure it per session rather than trusting a one-time check. In my experience the baseline can shift between days as tools get deferred or loaded differently, so a lean setup today isn't guaranteed lean tomorrow.

Collapse
 
speedrunjaen profile image
Jaen Carrodine •

the reset buys more than the effort setting does. every tool call re-reads the whole conversation from cache, so across a week of our sessions a message sent into one already past 600k cost about 30 times one sent under 200k

Collapse
 
paullovelace profile image
Paul Lovelace •

speedrunjaen's 30x number is the one that stopped me scrolling — a message past 600k costing 30 times one under 200k makes the reset the whole game, not the effort setting. The /context audit is the part I'll actually try first, I never measured which item was biggest either. One thing I'm wondering: do you reset mid-debug when the window gets fat, or only at milestones? /clear in the middle of a bug hunt feels like throwing away the map.

Collapse
 
zhang_jimmy_54a0414571400 profile image
zhang jimmy •

第一条里“把 never 规则写成 permission 而不是句子”是最值得抄的一句,长会话里散文式规则确实会被忘。我想问第四条:把探索交给 subagent、主窗口只收摘要时,怎么保证摘要里的结论可验证?比如让 subagent 回传 file:line 引用,主会话按需再读原文,这样既省了全文、又不用盲信摘要。另外 /statusline 的 context meter 我打算今天就加上,算是成本最低的一条。

Collapse
 
nilesharma0108 profile image
Nilesh Sharma •

"Never" rules as permissions instead of sentences is the tip I'd push hardest. Claude Code's memory docs back up your 200-line target (they say to target under 200 lines per CLAUDE.md because longer files use more context and reduce adherence), and they add one more lever: move instructions that only matter for part of the codebase into path-scoped rules, which load only when Claude works with matching files. That keeps the global file lean without losing the detail.

Collapse
 
reidmarlow profile image
Reid Marlow •

For the reset at a milestone, I'd keep a small handoff alongside the clean context: the current goal, decisions made, files changed, and the next test to run. That makes /clear less likely to discard a constraint that took the previous session a while to uncover. A link to the relevant issue or commit can carry the detail without putting the whole conversation back in the window.

Collapse
 
gautamtalksdev profile image
Gautam K •

Great list. Keeping the context lean is the habit that pays off most. A short project instructions file plus starting fresh between unrelated tasks makes a big difference in both cost and quality.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.