agentleFS
jamal-gmljamal-gml/anthropica/skills/core-token-efficiency/SKILL.md

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.

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
  1. Distinctive:

    Use the smallest context that is still sufficient.

    line 8
  2. Distinctive:

    Read ranges, not files: Use offset/limit around the relevant lines for large files.

    line 13
  3. Very specific:

    Fan out with subagents: only for independent, bounded work (sweeping many files, parallel reviews, research) where you need the conclusion, …

    line 15
  4. Very specific:

    Checkpoint: After discovery, write a short findings summary (facts, file:line, decisions) before implementing.

    line 16
  5. Very specific:

    Read references/context-mechanics.md when deciding what to put in CLAUDE.md, skills or MCP config, tuning a long session, or writing a …

    line 20
  6. Distinctive:

    Always-loaded text (CLAUDE.md, imported files, skill/agent descriptions, MCP tool definitions) costs tokens on every turn of every session: …

    line 33
  7. Distinctive:

    Don't re-read a file you just edited to check it.

    line 36
  8. Very specific:

    After ~3 failed attempts at the same fix, stop: summarise what was tried and why it failed, then rethink (or /clear with that summary) …

    line 40
  9. Distinctive:

    Ask one clarifying question early rather than exploring three interpretations of an ambiguous request.

    line 44
  10. Distinctive:

    Run long commands in the background and read the result once, instead of polling output repeatedly.

    line 45
  11. Distinctive:

    Prefer exact commands and paths in instructions over prose explanations.

    line 48
  12. Distinctive:

    Never skip tests, security checks, required reads or reviewing a diff to save tokens.

    line 51
  13. Very specific:

    Before /compact or /clear, make sure unresolved requirements, user constraints and open risks are written down.

    line 52
  14. Distinctive:

    Never paste secrets into handover notes or summaries.

    line 53

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Token Efficiency

Use the smallest context that is still sufficient; never trade correctness, validation or safety for tokens.

Procedure

  1. Pin the goal first. Restate the outcome and acceptance criteria in one or two lines before exploring; unclear goals cause the most wasted reads.
  2. Locate before reading. Glob for paths, Grep with files_with_matches or count first, then content with small -C context on the 1-3 hits that matter. Search by symbol, route, error text, config key.
  3. 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.
  4. 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).
  5. 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).
  6. Checkpoint. After discovery, write a short findings summary (facts, file:line, decisions) before implementing. It survives compaction and makes /compact safe.
  7. Manage the window. /context to see what is using space; /compact <what to keep> at natural breakpoints; /clear (with a handover note) when switching to an unrelated task.
  8. Reply concisely. Lead with the result; reference path:line instead 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

SituationDoAvoid
Find where X is handledGrep symbol/error -> read 30-80 lines around hitReading every file in the folder
Large log or JSONGrep/filter for the error or key; head/tailDumping the whole file
Git historygit log --oneline -n 20 -- path, git diff --stat then targeted diffUnbounded git log -p
Many files to surveyOne subagent returns a summary tableReading them all in the main thread
2-3 known filesRead them yourselfSpawning a subagent for a trivial lookup
Context > ~70% full mid-taskWrite findings summary, then /compact with focusWaiting for auto-compact at a bad moment
New unrelated task/clear after saving a handover note if neededCarrying 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 /clear with 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 /compact or /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 /context or /cost) from estimates.
  • Handover note (before /clear or ending a session): goal, done (with files), decisions and why, open issues, next steps, verify commands - template in references/context-mechanics.md.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.