lean-context
Skill1 starsChanged 21 days agoMITView on GitHub
Practices for keeping the context window lean while working. Apply at the START of any task that involves exploring, understanding, editing, or debugging a codebase, and BEFORE reading files or running commands that dump large output. Scout with search instead of reading whole files, delegate broad multi-file exploration to subagents, read only the slices you need, never re-read what's already in context, filter command output, and offload intermediates to the filesystem.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- EARTH157/claude-skillstheir own version, first seen Oct 25, 2026
- liujiarui0918/claude-code-codex-strongesttheir own version, first seen Oct 13, 2026
- wangxiaohuiboy/lean-agent-skillstheir own version, first seen Sep 10, 2026
- sayeediftekhar/lean-contexttheir own version, first seen Jul 28, 2026
- Kevinchamplin/claude-skillstheir own version, first seen May 23, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- Kevinchamplin/claude-skills★ 3same name
- liujiarui0918/claude-code-codex-strongest★ 1same name
- EARTH157/claude-skills★ 0same name
- sayeediftekhar/lean-context★ 0same name
- wangxiaohuiboy/lean-agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository8 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- clarify-firstSkill
- coding-standardsSkill
- dependency-safetySkill
- docs-maintenanceSkill
- security-advisoriesSkill
- spec-writingSkill
- writing-claude-mdSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 8 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Every files, commands etc you pull in stays in the window, dilutes attention, and buries the few lines that actually matter.
- Distinctive: line 22
Don't read whole files or directories to "get oriented." Locate first, then read only the relevant span:
- Distinctive: line 27
Read a function or section, not the 800-line file, when you know what you need.
- Distinctive: line 33
When answering means sweeping many files ("how does X work?", "where is Y handled?", naming conventions across the tree), spawn an Explore …
- Distinctive: line 42
Don't re-open files already in context, and don't re-run a search whose answer you already have.
- Distinctive: line 52
If output is large but you might need parts later, redirect it to a file and read only the slice you need, when you need it.
- Distinctive: line 57
Use files as memory instead of the context window.
- Distinctive: line 72
When you catch yourself scrolling back through the whole transcript to reconstruct context, that's the signal to distill it into a few …
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lean context
Every files, commands etc you pull in stays in the window, dilutes attention, and buries the few lines that actually matter. The goal is to hold the minimum needed to act correctly, not everything that might be relevant. Optimize for signal, not coverage.
Scout, then read the slice
Don't read whole files or directories to "get oriented." Locate first, then read only the relevant span:
grep/Glob to find the symbol, definition, or call site; then Read withoffset/limitaround it.- Read a function or section, not the 800-line file, when you know what you need.
- Skim structure (signatures, a grep of function names) before committing to a full read.
Delegate broad exploration to a subagent
When answering means sweeping many files ("how does X work?", "where is Y handled?", naming conventions across the tree), spawn an Explore or general-purpose subagent. It reads the files in its own context and returns just the conclusion — the file dumps never touch your window. This is the single biggest lever for keeping the main thread lean; use it liberally for open-ended searches, and keep only the summary.
Don't re-read
Don't re-open files already in context, and don't re-run a search whose answer you already have.
Filter output; never dump
A command's full output is rarely the thing you need:
- Pipe through
grep/head/tail/field-selection; ask for the specific line, count, or status — not the whole log/dataset. - Strip known noise (build chatter, warnings) so it doesn't crowd the signal.
- If output is large but you might need parts later, redirect it to a file and read only the slice you need, when you need it.
Offload to the filesystem
Use files as memory instead of the context window. Write scratch scripts, intermediate results, and long artifacts to a scratchpad/temp path; reference them by path and re-read just the relevant slice later. A path is cheap to carry; a pasted 500-line blob is not.
Load just-in-time, not just-in-case
Pull in a file, doc, or reference at the moment the task reaches it — not speculatively at the start. Most "let me load everything first" reads are never used and just add noise. Fetch on demand.
On long/multi-step tasks, keep a compact working state
As a session grows, track a short running state — what's done, what's next, key decisions and values — rather than re-deriving it from the full history each turn. When you catch yourself scrolling back through the whole transcript to reconstruct context, that's the signal to distill it into a few lines instead.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

