← Browse all topicsGetting started

Token Optimization Skills for AI Agents

Token optimization is the practice of using less model context for the same job: retrieve only what is needed, compress what remains, cache what repeats, and measure what you spend. Skills in this topic tend to work on one of six things — prompt shape, context selection, compression of earlier turns, caching a stable prefix where the API allows it, routing turns to smaller models, and counting tokens so you can tell whether any of it helped. Read the ranked list as a set of candidates for a specific bottleneck, not as a stack to install end to end. Find the sub-topic that matches your problem, compare the entries under it, and pick one to try before adding another. If you cannot say which of the six you are fixing, start with measurement.

8 to start with18 top options

Start with these.

Token optimization is using less model context for the same job: retrieve only what is needed, compress, cache, and measure.

These are the closest matches for this work. Start with the first one and open it to install.

What you put in the prompt is the first budget item.Do not paste the whole repo if three files would do.Shrink earlier turns so later ones still fit.Pay once for the stable prefix if the API allows it. A sub-problem of this domain with no skills yet.Not every turn needs the largest model. A sub-problem of this domain with no skills yet.If you do not count tokens, you are not optimizing them.

18 top options

  1. Rank 04
    Direct

    prompt-engineer

    Writes, refactors, and evaluates LLM prompts, covering prompt patterns, optimization for token efficiency, evaluation frameworks, structured outputs, system prompts, and context management.

    • Prompt shape
    • Context selection
    • Compression
    5,250 · popularity
    View Agent Skill
  2. Rank 05
    Direct

    principle-guard-the-context-window

    Principle for guarding the finite context window: route large payloads to subagents, read selectively, keep frequently used content inline, and cap scope per phase.

    • Context selection
    • Measurement
    3,659 · popularity
    View Agent Skill
  3. Rank 06
    Direct

    smart-explore

    Token-optimized structural code search using tree-sitter AST parsing, replacing full-file reads with search, outline, and unfold steps to explore codebases efficiently.

    • Prompt shape
    6,991 · popularity
    View Agent Skill
  4. Rank 07
    Direct

    qwenchance

    Keeps long tasks on track by breaking loops, bounding reasoning, watching the context budget, and triggering a clean handoff before the context window fills.

    • Context selection
    2,323 · popularity
    View Agent Skill
  5. Rank 08
    Direct

    skill-progressive-disclosure-design

    Decides how to split skill content between SKILL.md and reference files for context efficiency, covering progressive disclosure, triggering, and reference-file structure.

    • Context selection
    • Measurement
    2,560 · popularity
    View Agent Skill
Explore 10 more Agent Skills
  1. Rank 09
    Possible

    azure-aigateway

    Official

    description: "Configure Azure API Management as an AI Gateway for AI models, MCP tools, and agents. WHEN: semantic caching, token limit, content safety, load balancing, AI model governance, MCP rate limiting, jailbreak detection, add Azure OpenAI backend, add AI Foundry model, test AI gateway, LLM policies, configure AI backend, token metrics, AI cost control, convert API

    • Measurement
    514,751 · popularity
    View Agent Skill
  2. Rank 10
    Possible

    claude-api

    Official

    |- Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).

    • Context selection
    • Compression
    View Agent Skill
  3. Rank 11
    Possible

    gemini-api-dev

    Skill for writing Gemini API code covering text, chat, multimodal, image/video/speech generation, streaming, function calling, structured output, and model migration in Python and TypeScript.

    • Measurement
    23,448 · popularity
    View Agent Skill
  4. Rank 12
    Possible

    saga

    Runs an autonomous spec-driven development saga with an orchestrator agent delegating to worker subagents, keeping the orchestrator's context window clean via on-disk state.

    • Context selection
    • Compression
    19,670 · popularity
    View Agent Skill
  5. Rank 13
    Possible

    agent-memory-systems

    Covers agent memory architecture including short-term context window, long-term vector stores, and cognitive architectures for organizing and retrieving memory.

    • Context selection
    1,966 · popularity
    View Agent Skill
  6. Rank 14
    Possible

    planning-with-files-es

    Persistent file-based planning for multi-step agent tasks, keeping task_plan.md, findings.md, and progress.md on disk with lifecycle hooks injecting selected planning context.

    6,413 · popularity
    View Agent Skill
  7. Rank 15
    Possible

    session-handoff

    Creates handoff documents for AI agent session transfers, capturing state so fresh agents can continue work when the context window approaches capacity.

    • Context selection
    4,150 · popularity
    View Agent Skill
  8. Rank 16
    Possible

    gemini

    Runs the Gemini CLI for code review, plan review, and large-context (>200k token) processing, with model selection and approval-mode guidance.

    • Measurement
    3,931 · popularity
    View Agent Skill
  9. Rank 17
    Direct

    caveman

    Notable

    Ultra-compressed communication mode that cuts output tokens while keeping technical accuracy. Levels: lite, full, ultra and the wenyan variants. Use for /caveman, "caveman mode", "talk like caveman", "be brief" or "less tokens".

    • Prompt shape
    • Measurement
    View Agent Skill
  10. Rank 18
    Direct

    context-mode

    Notable

    Use context-mode tools (ctx_execute, ctx_execute_file) instead of Bash/cat when processing large outputs. Triggers: "analyze logs", "summarize output", "process data", "parse JSON", "filter results", "extract errors", "check build output", "analyze dependencies", "process API response", "large file analysis", "page snapshot", "browser snapshot", "DOM structure", "inspect page", "accessibility tree", "Playwright snapshot", "run tests", "test output", "coverage report", "git log", "recent commits", "diff between branches", "list containers", "pod status", "disk usage", "fetch docs", "API reference", "index documentation", "call API", "check response", "query results", "find TODOs", "count lines", "codebase statistics", "security audit", "outdated packages", "dependency tree", "cloud resources", "CI/CD output". Also triggers on ANY MCP tool output that may exceed 20 lines. Subagent routing is handled automatically via PreToolUse hook.

    • Compression
    View Agent Skill
What this topic covers

What this topic covers

Each sub-topic groups Agent Skills for a specific situation.

Prompt shape
What you put in the prompt is the first budget item.
Context selection
Do not paste the whole repo if three files would do.
Compression
Shrink earlier turns so later ones still fit.
Caching
Pay once for the stable prefix if the API allows it.
Routing
Not every turn needs the largest model.
Measurement
If you do not count tokens, you are not optimizing them.
Frequently asked questions

Frequently asked questions

Where should a beginner start?
Start with measurement: if you do not count tokens, you are not optimizing them. Once you can see where context is going, prompt shape and context selection are the cheapest things to change, since what you put in the prompt is the first budget item and three files often do the job of a whole repo.
How is this list ordered?
It is ranked by observed search demand, with direct matches to the topic placed first and a cap on how many entries any single publisher can occupy. Work down the list until you find a skill that addresses your bottleneck.
Do I need all six sub-topics covered?
No. Compression, caching, and routing each solve a different problem, and caching only applies if the API you use allows a stable prefix to be paid for once. Pick the sub-topic that matches what is actually overflowing your context.
Can I combine several of these skills?
You can, but each one changes how context is assembled, so add them one at a time and re-measure. A compression skill and a context selection skill can interact, and you will not see which one helped unless you count tokens before and after.

How to install an Agent Skill

Start with the first skill on this page. Claude Code reads a SKILL.md once it is in the skills directory:

  • Claude Code — copy the SKILL.md for token-efficiency into ~/.claude/skills/token-efficiency/ for yourself, or .claude/skills/token-efficiency/ to share it with a project.
  • From the registry — run npx skills add delphine-l/claude_global@token-efficiency.
  • Or download token-efficiency from its source and place that SKILL.md in the directory above.

How to choose Check the source and the skill’s own instructions before you install. Official and Notable describe where a skill comes from.