tokenleak
Makes your agent use less information in each step. It avoids repeating unnecessary data, making the process faster and more efficient. Good for optimizing resource use in long tasks.
What it does
This skill teaches the AI to be more efficient when coding, preventing it from sending repeated or unnecessary information. This saves time and computational resources.
When to use it
- ✓When coding on large and complex projects.
- ✓When cost or AI usage limits are a concern.
- ✓If the AI is sending too much repetitive data in a conversation.
Example of what to ask your AI
“How can I make the AI use fewer resources when writing code?”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The AI learns to fetch specific information instead of reading everything, compute results instead of sending raw data, and limit what is sent at each step. It avoids repeating tasks or sending information already known.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill tokenleakOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/tokenleak/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
tokenleak
Overview
Every tool result an agent pulls into context is re-sent on every later call until compaction, so a 6k-token log read early in a 60-call session is paid about 55 more times. These rules make the agent let in only what the next decision needs: locate before reading, compute instead of reading data, bound command output, never re-read, batch independent calls. Over 80 A/B runs in Claude Code (Sonnet 5) they cut cost by 32% with the same 40/40 pass rate; on Haiku 4.5 they only help together with the plugin's read guard (-20%). Method and raw results are in the source repo.
When to Use This Skill
- Use on coding tasks that read files, run tests, builds or installs, use git, or search a codebase.
- Use when the user wants to save tokens, reduce cost, or stay under usage limits.
- Use when a session keeps hitting compaction because tool output fills the context.
Rules
- Locate, then read. Don't know a file's size? Check it (
wc -l) along with your first search. Search (grep -n,rg -n, Grep), then read only the region you need (offset/limit,sed -n 'A,Bp'). Read a whole file only if it is short (under ~300 lines) or you truly need all of it. - Compute, don't read. For questions about data (counts, totals, filters, lookups in big data files, CSV, JSON, logs), run a short script or one-liner that prints only the answer. Never pull the data itself into context.
- Bound every command. Never let tests, builds, installs or logs stream into context unbounded.
- Quiet or failures-only modes:
pytest -q -x,vitest run --reporter=dot,go test ./... 2>&1 | grep -v '^ok',cargo test -q,npm ci --silent,make -s. - Long jobs:
L="${TMPDIR:-/tmp}/out.log"; cmd > "$L" 2>&1; echo "exit=$?"; tail -n 40 "$L". Need more?grep -n -m 20 -E 'error|FAIL|panic' "$L"on the saved log. Never re-run a job just to see more of its output. - Iterate on the one failing test, not the whole suite. Run the full suite once at the end, quietly.
- Quiet or failures-only modes:
- Never re-read what you have. A file you read or wrote is still in context. Re-read only after compaction or after something else changed it.
- Batch independent calls. Reads and searches that don't depend on each other go in one turn (parallel tool calls), and shell steps that need no judgment in between go in one command (
wc -l a b; grep -n x a | head). Each extra round-trip re-sends everything. - Diffs over files.
git status -s,git diff --statthengit diff -- <path>,git log --oneline -n 15,git show --stat <sha>. - Edit, don't rewrite. Targeted edits only. Never rewrite a whole file to change a few lines, and never paste back into chat code that is already on disk.
- Narrow searches and fetches. Scope by path and file type, cap results (
-m,head_limit,| head -n 30,-lfor names only). Pick fields from APIs and JSON (--json a,b,jq '.items[] | {id,name}',per_page). Ask a web fetch a precise question instead of dumping the page. - Delegate wide exploration. If an answer means opening 10+ files and you only need the conclusion, hand it to a subagent if your agent has them. Only its summary enters your context.
- Answer lean. Lead with the result. No step-by-step recap, no restating the diff, no closing summary of what the user can already see, no filler.
Never save tokens by
- truncating so hard you miss the real error (widen with
grep/sed -non the saved log instead); - skipping a read you need to edit correctly, or guessing file contents;
- skipping verification. Run the tests, quietly.
Limitations
- The savings depend on the workload and the model: in the benchmark a short test-fixing task gained 5%, noisy builds and multi-file features 24-51%; small models such as Haiku 4.5 barely follow the rules without the plugin's read guard.
- The benchmark covers two models and four small tasks on a synthetic repo, and runs vary 2 to 4x.
- The rules cost about 850 tokens of context themselves; on very short sessions they may not pay for themselves.
- The companion transcript audit (
tokenleak.py) lives in the source repo and is not included here.
Examples
Locate before reading, and hand the agent only what the next decision needs:
wc -l app/service.py # size, alongside the search
rg -n "def handle_" app/ # find the region first
sed -n '120,180p' app/service.py
Bound a noisy build and keep the failure visible:
…
FAQ
Why does the AI send repeated information?
By default, the AI might resend information from previous conversations with each new instruction, consuming resources. This skill teaches it to be more selective.
Does this affect the accuracy of the code the AI writes?
No, the goal is to maintain accuracy while reducing resource usage. The AI learns to be efficient without losing quality.
Is this skill automatic?
No, it's a set of rules the AI should follow. By using this skill, you are instructing the AI to apply these efficiency rules.
Details
Original description by the author
Token-lean rules for coding agents: cut the context re-sent on every later call (big reads, noisy logs, re-reads, serial calls) without losing correctness.
Popularity
- GitHub stars
- 48k
- Ranking position
- #4388
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
benchmark-optimization-loop
Has your agent improve something's speed in a measured way. It tests multiple versions and chooses the fastest one that still works correctly.
affaan-m/ECC
change-impact
Helps your agent analyze the impact of code changes before making them. It compares the planned vs. actual results afterward, covering paths, data, tests, and documentation. Useful for risky or system-wide changes.
affaan-m/ECC
click-path-audit
Lets your agent trace all user buttons and interactions to find bugs. It finds issues where functions seem to work alone but fail together. Useful when bugs persist even after debugging.
affaan-m/ECC