tokenleak
できること
このスキルは、AIがコーディングをする際に、同じ情報や不要な情報を送らないよう、より効率的に作業する方法を教えます。これにより、時間と計算リソースを節約できます。
使う場面
- ✓大規模で複雑なプロジェクトでコーディングするとき。
- ✓コストやAIの利用上限が気になるとき。
- ✓会話の中で、AIが繰り返しの多いデータを送りすぎているとき。
スキルのリンク
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/tokenleak/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“AIにコードを書いてもらうとき、リソースの消費を抑えるにはどうすればよいですか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIは、すべてを読み込むのではなく必要な情報だけを取得し、生のデータを送る代わりに計算結果を送り、各ステップで送る内容を制限することを学びます。また、同じ作業を繰り返したり、すでに把握している情報を再度送ったりしないようになります。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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:
…
よくある質問
AIが繰り返し情報を送るのはなぜですか?
初期設定では、AIが新しい指示のたびに、以前の会話の情報を再送してしまうことがあり、その分リソースを消費します。このスキルは、AIが送る情報をより選択的に扱うよう教えます。
このスキルは、AIが書くコードの正確さに影響しますか?
いいえ。目的は、正確さを保ったままリソースの消費を減らすことです。AIは品質を落とさずに効率よく作業することを学びます。
このスキルは自動的に適用されますか?
いいえ。これはAIが従うべきルールのまとまりです。このスキルを使うことで、AIにこれらの効率化ルールを適用するよう指示することになります。
詳細
作者による元の説明
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.
人気
- GitHubのスター
- 48k
- ランキング
- #6002
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
00-andruia-consultant
48kエージェントがAIプロジェクトの立ち上げや改善を支援します。コードを分析し、ツールを提案し、スペイン語で行動計画を作成します。
007
48kエージェントがセキュリティ監査と脅威モデリングを行えるようにします。攻撃や脆弱性からプロジェクトを守るのに役立ちます。
10-andruia-skill-smith
48kエージェントがAIツールの作成や改善を支援します。ツールの動作を定義し、ドキュメントを書き、構造を検証します。
20-andruia-niche-intelligence
48kエージェントが特定の業界に関する要約を作成できるようにします。信頼できる情報源を使って、プロジェクトの背景、ルール、利用パターン、リスクを把握するのに役立ちます。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。