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에이전트가 신뢰할 수 있는 자료를 바탕으로 특정 산업의 맥락, 규칙, 사용 패턴, 위험을 정리한 요약을 만들도록 돕습니다.