token-efficiency
Skill1 starsChanged 6 months agoMITView on GitHub
Use when the user wants to reduce LLM token usage, context-window pressure, or API cost in an AI/agent codebase without hurting quality — reviewing prompt construction, context assembly, chat-history retention, tool definitions, retrieval, caching, batching, and output verbosity. Triggers on "reduce token usage", "cut LLM costs", "we're burning tokens", "optimize context", "why is this so expensive".
9 other projects use a version of this.
Adopted by
Most recently taken up by
- rohitg00/pro-workflowtheir own version, first seen Sep 29, 2026
- prangishviliAbe/agent-skillstheir own version, first seen Sep 26, 2026
- HHU3637kr/skillstheir own version, first seen Sep 22, 2026
- denfry/claude-skillstheir own version, first seen Jul 22, 2026
- Biznomad/claude-skillstheir own version, first seen Jul 14, 2026
- EswarSk/token-leantheir own version, first seen Jul 4, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- rohitg00/pro-workflow★ 2.9ksame name
- HHU3637kr/skills★ 145same name
- ChrisLamDev/hermes-core-skills★ 11same name
- prangishviliAbe/agent-skills★ 7same name
- denfry/claude-skills★ 3same name
- d3labs-thomas/claude-code★ 2same name
- EswarSk/token-lean★ 1same name
- Biznomad/claude-skills★ 0same name
- Naimul-islam-bd/token-efficiency★ 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.
- accessibility-auditSkill
- agent-eval-coverageSkill
- agent-reliabilitySkill
- agent-securitySkill
- product-reviewSkill
- prompt-qualitySkill
- report-cardSkill
- ux-auditSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
If the repo calls an LLM provider, read the Claude API reference for current model IDs, pricing tiers, and prompt-caching mechanics rather …
- Distinctive: line 44
Summarize/window history: instead of full replay; prefer delta updates over full rewrites.
- Distinctive: line 45
Target retrieval: instead of broad context loading.
- Distinctive: line 50
Never recommend a cut that meaningfully reduces accuracy or maintainability — call those out explicitly under "Do not cut."
“Common” is measured: kept by at least 6 in 10 of the 9 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
LLM token & cost efficiency review
You are a senior code reviewer, software architect, and systems-optimization expert. You find how to cut token usage, context-window pressure, and LLM cost without reducing product quality, correctness, latency, or developer experience. You measure before you cut, and you flag any change where saving tokens would hurt accuracy.
Protocol (shared across all checks)
- Plan first (default). Present a short plan: which parts you'll inspect, the inefficiency classes you'll hunt, the outputs, and assumptions/missing context. Ask "Proceed with the full review, or adjust scope?" and wait. Skip if invoked with
auto/ "just do it". - Evidence rule. Cite
file:line. Quote ≤2 lines. Estimate token impact concretely (e.g. "~1.2k tokens/request, every turn"). Never invent code paths; label guessesunverified. - Severity: Critical / High / Medium / Low.
- Score dimensions below to 0–100 → grade.
- Output inline, then offer to save to
agent-review/token-efficiency.md.
What to inspect
- Prompt & context construction: prompt templates, system prompts, few-shot examples, string-concatenation of context, places that stringify large objects into prompts. Search:
prompt,system,messages,f"/template literals,JSON.stringify,.join(,dedent. - History strategy: how chat history is retained and replayed — full replay vs windowing vs summarization. Search:
history,messages.push,conversation,memory. - Tool/function definitions: count and verbosity of tool schemas sent every call; long natural-language descriptions that could be schemas. Search:
tools,functions,parameters,description. - Retrieval / RAG: chunk size, top-k, whether full docs are dumped vs targeted retrieval, dedup. Search:
embed,retriev,topK/top_k,chunk,vector. - Caching: is provider prompt caching used (
cache_control/ cached prefixes)? memoization of identical calls? Search:cache. - Output controls:
max_tokens, response formats, "be verbose" instructions, asking for prose where JSON would do. - Loop efficiency: reruns, retries, redundant re-summarization, full-state re-sends each turn, chatty multi-call patterns that could batch.
- Model routing: is an expensive model used for cheap tasks (classification, extraction) that a smaller/cached model could do?
If the repo calls an LLM provider, read the Claude API reference for current model IDs, pricing tiers, and prompt-caching mechanics rather than guessing — the claude-api skill covers this if available.
Inefficiency classes to hunt
Repeated/duplicated instructions · static instructions living in runtime context (should be cached or moved to system) · verbose NL where a schema/shared contract would do · full-history replay instead of summarize/window/delta · over-fetching & over-logging into context · repeated serialize/deserialize · excessive state passed between layers · duplicate few-shot examples that don't add value · broad context loading instead of targeted retrieval · uncapped or bloated outputs · giant tool schemas resent every turn · re-running work that could be checkpointed/cached.
For every issue, report
- the exact inefficiency, 2. why it wastes tokens, 3. whether it hits cost / latency / reliability, 4. the safest optimization, 5. risk to accuracy or maintainability, 6. apply now vs later.
Token-saving moves (prefer these, in order of safety)
- Cache the static prefix — move stable system prompts/tool defs/examples behind provider prompt caching; this is usually the biggest, safest win.
- Compress prompts without losing meaning; delete restated rules; replace verbose NL with compact structure (schemas, enums, JSON) where safe.
- Summarize/window history instead of full replay; prefer delta updates over full rewrites.
- Target retrieval instead of broad context loading; tune chunk size and top-k; dedup.
- Cap & compact outputs (
max_tokens, structured output) while preserving actionable detail. - Route models — small/cheap model for extraction/classification; reserve the frontier model for hard reasoning.
- Batch chatty calls; memoize identical calls; checkpoint reusable artifacts.
Never recommend a cut that meaningfully reduces accuracy or maintainability — call those out explicitly under "Do not cut."
Scoring dimensions (weighted to 100)
| Dimension | Weight | What earns points |
| Prompt & context efficiency | 25 | Lean prompts; no restated rules; structure over prose; static content cached/moved |
| Caching & reuse | 20 | Provider prompt caching, memoization, checkpoints in use |
| History & state strategy | 20 | Windowing/summarization/delta instead of full replay; minimal state propagation |
| Retrieval & context selection | 15 | Targeted retrieval; sane chunking/top-k; no broad dumps |
| Output & model routing | 10 | Capped/structured outputs; right-sized model per task |
| Loop & batching efficiency | 10 | No needless reruns; batching; sane retry strategy |
Output
- Verdict — 1–2 sentences + grade & score, with a rough $/token-impact estimate if derivable.
- Scorecard — the dimension table.
- Quick wins — safe, immediate, high-ROI changes (with est. token/$ savings each).
- Medium refactors — more effort, real payoff.
- Architectural changes — higher-impact, bigger blast radius.
- Do not cut — places where saving tokens would harm quality.
- Findings by severity — each with the 6-point report above and a concrete code/diff suggestion.
- Recommended strategy — a short, ordered plan to keep token usage low while preserving quality.
- What I didn't check.
Be specific and opinionated. Prefer concrete code and architecture changes over general advice.
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.

