core-token-efficiency
Skill0 starsChanged 12 days agoMITView on GitHub
Keep Claude Code sessions lean without losing correctness - what loads always vs on use, targeted search and reads, bounded output, subagent fan-out, /compact, /clear, handover notes. Use when planning a long session, context is filling or auto-compacting, output is noisy, deciding whether to delegate, or trimming CLAUDE.md, skills or MCP setup.
In this repository33 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- global/CLAUDE.mdCLAUDE.md
- build-backendSkill
- build-commitsSkill
- build-containersSkill
- build-databaseSkill
- build-design-systemSkill
- build-frontendSkill
- build-iacSkill
- build-project-setupSkill
- core-documentationSkill
- core-prompt-engineeringSkill
- create-marketing-copySkill
- create-seo-contentSkill
- operate-incidentSkill
- operate-observabilitySkill
- plan-architectureSkill
- plan-campaignSkill
- plan-codebase-analysisSkill
- plan-test-strategySkill
- plan-threat-modelSkill
- review-pull-requestSkill
- review-seoSkill
- review-ui-uxSkill
- secure-code-reviewSkill
- secure-repo-governanceSkill
- secure-supply-chainSkill
- ship-ci-cdSkill
- ship-github-actionsSkill
- ship-readinessSkill
- ship-releaseSkill
- test-performanceSkill
- test-validationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use the smallest context that is still sufficient.
- Distinctive: line 13
Read ranges, not files: Use offset/limit around the relevant lines for large files.
- Very specific: line 15
Fan out with subagents: only for independent, bounded work (sweeping many files, parallel reviews, research) where you need the conclusion, …
- Very specific: line 16
Checkpoint: After discovery, write a short findings summary (facts, file:line, decisions) before implementing.
- Very specific: line 20
Read references/context-mechanics.md when deciding what to put in CLAUDE.md, skills or MCP config, tuning a long session, or writing a …
- Distinctive: line 33
Always-loaded text (CLAUDE.md, imported files, skill/agent descriptions, MCP tool definitions) costs tokens on every turn of every session: …
- Distinctive: line 36
Don't re-read a file you just edited to check it.
- Very specific: line 40
After ~3 failed attempts at the same fix, stop: summarise what was tried and why it failed, then rethink (or /clear with that summary) …
- Distinctive: line 44
Ask one clarifying question early rather than exploring three interpretations of an ambiguous request.
- Distinctive: line 45
Run long commands in the background and read the result once, instead of polling output repeatedly.
- Distinctive: line 48
Prefer exact commands and paths in instructions over prose explanations.
- Distinctive: line 51
Never skip tests, security checks, required reads or reviewing a diff to save tokens.
- Very specific: line 52
Before /compact or /clear, make sure unresolved requirements, user constraints and open risks are written down.
- Distinctive: line 53
Never paste secrets into handover notes or summaries.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Token Efficiency
Use the smallest context that is still sufficient; never trade correctness, validation or safety for tokens.
Procedure
- Pin the goal first. Restate the outcome and acceptance criteria in one or two lines before exploring; unclear goals cause the most wasted reads.
- Locate before reading. Glob for paths, Grep with
files_with_matchesorcountfirst, thencontentwith small-Ccontext on the 1-3 hits that matter. Search by symbol, route, error text, config key. - Read ranges, not files. Use offset/limit around the relevant lines for large files; read whole files only when small or when the whole file is the subject.
- Bound command output. Quiet flags,
--stat/--name-only,| tail -n 50,-q, filters on test runners (run the failing test, not the suite, while iterating; run the full suite once before declaring done). - Fan out with subagents only for independent, bounded work (sweeping many files, parallel reviews, research) where you need the conclusion, not the raw output. Give a precise brief and an output contract (see
core-prompt-engineering). - Checkpoint. After discovery, write a short findings summary (facts, file:line, decisions) before implementing. It survives compaction and makes
/compactsafe. - Manage the window.
/contextto see what is using space;/compact <what to keep>at natural breakpoints;/clear(with a handover note) when switching to an unrelated task. - Reply concisely. Lead with the result; reference
path:lineinstead of pasting code back; no recap of what the user just saw.
Read references/context-mechanics.md when deciding what to put in CLAUDE.md, skills or MCP config, tuning a long session, or writing a handover note.
Rules
| Situation | Do | Avoid |
| Find where X is handled | Grep symbol/error -> read 30-80 lines around hit | Reading every file in the folder |
| Large log or JSON | Grep/filter for the error or key; head/tail | Dumping the whole file |
| Git history | git log --oneline -n 20 -- path, git diff --stat then targeted diff | Unbounded git log -p |
| Many files to survey | One subagent returns a summary table | Reading them all in the main thread |
| 2-3 known files | Read them yourself | Spawning a subagent for a trivial lookup |
| Context > ~70% full mid-task | Write findings summary, then /compact with focus | Waiting for auto-compact at a bad moment |
| New unrelated task | /clear after saving a handover note if needed | Carrying stale context forward |
- Always-loaded text (CLAUDE.md, imported files, skill/agent descriptions, MCP tool definitions) costs tokens on every turn of every session: keep it short and move detail into on-demand files.
- Tool output stays in context until compaction: one careless 5,000-line read taxes every later turn.
- Subagents save main-context tokens but usually cost more total tokens; use them when isolation or parallelism is the point.
- Don't re-read a file you just edited to check it; the edit tool already reports failure.
- Make small changes with targeted edits; rewriting a whole file resends all of it.
- Batch independent tool calls in one turn; sequence only dependent ones.
- Plan before large multi-file changes (plan mode or a written plan); a wrong implementation is the most expensive token sink.
- After ~3 failed attempts at the same fix, stop: summarise what was tried and why it failed, then rethink (or
/clearwith that summary) instead of piling on context. - Output tokens are slower and pricier than input: no restating the question, no narrating each step, no full-file echoes.
- Skill descriptions load every turn: make them specific triggers, push detail into the body and
references/. - Disconnect MCP servers a project doesn't use; each adds tool schemas to every turn. Keep
@imports in CLAUDE.md to small files. - Ask one clarifying question early rather than exploring three interpretations of an ambiguous request.
- Run long commands in the background and read the result once, instead of polling output repeatedly.
- Send follow-ups to an existing subagent rather than spawning a new one that must rediscover the same context.
- Images, PDFs and screenshots are expensive: read only the pages or regions needed.
- Prefer exact commands and paths in instructions over prose explanations.
Safety gates
- Never skip tests, security checks, required reads or reviewing a diff to save tokens. If a budget forces a trade-off, say what was not checked.
- Before
/compactor/clear, make sure unresolved requirements, user constraints and open risks are written down; they are the first thing lost. - Never paste secrets into handover notes or summaries.
Output
Status reply:
<Result in one line>
Evidence: <path:line>, `<command>` -> <key output line>
Not checked / risks: <...>
Then: <next step or question>- Distinguish measured token numbers (from
/contextor/cost) from estimates. - Handover note (before
/clearor ending a session): goal, done (with files), decisions and why, open issues, next steps, verify commands - template inreferences/context-mechanics.md.
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.

