lean-context
Skill0 starsChanged 2 months agoMITView on GitHub
Explore an unfamiliar or large codebase while spending the fewest possible tokens. Use when locating a bug, tracing a flow, orienting in a repo, or when context is running low. Not needed once the target file is already known.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- OrionicsLtd/claude-skillstheir own version, first seen Nov 1, 2026
- EARTH157/claude-skillstheir own version, first seen Oct 25, 2026
- liujiarui0918/claude-code-codex-strongesttheir own version, first seen Oct 13, 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
- OrionicsLtd/claude-skills★ 1same name
- EARTH157/claude-skills★ 0same name
- sayeediftekhar/lean-context★ 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 repository6 other files it gives its agents.
- context-handoffSkill
- frontend-a11ySkill
- frontend-craftSkill
- frontend-perfSkill
- lean-answerSkill
- lean-diffSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Attach a question to every read: If you cannot state the question the read answers, do not read.
- Distinctive: line 23
Never jump to step 4 because it feels safer.
- Very specific: line 40
Read build output, lockfiles, minified bundles, generated migrations, and node_modules only when the failure is literally inside them, and …
“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
Context is the scarcest resource in an agent loop. Every file you read stays in the window and is paid for on every subsequent turn. Spend reads like money.
The one rule
Attach a question to every read. If you cannot state the question the read answers, do not read. "Let me see what this file does" is not a question. "Where does --retry get parsed?" is.
Order of operations
Climb this ladder and stop at the first step that answers the question:
- Search —
rg -n '<symbol>'returns matching lines with line numbers. Usually this alone answers "where is X". - Outline — list the file's declarations without reading bodies (
rg -n '^(export |def |class |func |function |const )'or a language-aware outline). - Bracket the range — read only the region that matters:
sed -n '120,180p' file,rg -n -A 20 -B 5 '<symbol>'. - Read the file — only when you are about to rewrite it, or it is genuinely short (< ~200 lines). Check size first:
wc -l.
Never jump to step 4 because it feels safer. A 40-line targeted read beats a 900-line file in both cost and attention.
Batch, do not ping-pong
Independent lookups belong in one message as parallel tool calls. Five separate round trips cost five times the latency and repeatedly re-send the conversation prefix. Group greps, file listings, and git log calls together. Sequence only when one lookup's result determines the next.
Cap the output
Raw output becomes context; trim it at the source:
rg --files | rg 'pattern'— locate paths without contentrg -l— file lists only, no matchesrg -c— counts onlysed -n '1,80p'— first 80 lines instead ofcatgit diff --stat,git log --oneline -15— shape before detail| head -n 40— cap any command whose output size you cannot predict
Read build output, lockfiles, minified bundles, generated migrations, and node_modules only when the failure is literally inside them, and then only the relevant lines.
Do not re-read
Re-reading a file you already read, or that you just edited, is the most common waste in an agent loop. If you need a precise line, quote it from what you already have or read a narrow range. After an edit, trust the edit result rather than re-reading the file to confirm it applied.
Compress as you go
Once you have found what matters, keep only the distilled form in your working memory: path:line — what it does — why it matters. Drop the raw dump. When you are about to make a change, you should be able to say where the fix goes and who calls it, from your notes, without re-reading.
Know when to stop exploring
Stop when you can name (a) the location of the change and (b) the code that calls it. Do not survey the architecture, do not read the neighboring subsystems "for context", do not map the whole call graph. Broader understanding is only worth paying for when the task is actually broad — a refactor, a migration, a design decision.
Anti-patterns
- Recursively reading every module an entry point imports.
caton a file you have not measured.- Reading the test suite to learn a function's behavior instead of reading the function.
- Running a repo-wide
findfrom a home directory or over.git. - Asking an agent to "read the codebase and summarize it" instead of asking the specific question.
See references/commands.md for the concrete command set, including git archaeology and how to work without rg.
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.

