token-optimization

Reduce Claude Code token consumption through cache management, context forking, and output filtering.

Updated Aug 16, 2026
One-click install
npx skills add https://github.com/three1324/yeonjinautomotive --skill token-optimization-three1324
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: token-optimization
Source: https://github.com/three1324/yeonjinautomotive/tree/main/.claude/skills/token-optimization
Command: npx skills add https://github.com/three1324/yeonjinautomotive --skill token-optimization-three1324

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyyaml, and includes scripts (resource) and references (resource) components.

What problem does it solve? Claude Code sessions often consume far more tokens than necessary due to cache invalidation, bloated context windows, oversized reasoning effort, and verbose CLI or browser output, driving up costs and slowing sessions. ## Core Features & Use Cases - Session Audit and Cache Management: Diagnose loaded MCPs and plugins, prevent mid-session cache invalidation, and keep base sessions under 5,000 tokens. - Context Forking and Model Selection: Delegate web research and long tasks to isolated subagents, size the context window to the codebase, and match reasoning effort to task complexity. - Input Filtering: Use Stagehand for DOM-based browser automation and RTK to filter verbose git and CLI output before it enters context. - Use Case: A team spending $750/month on Claude Code applies the audit, disables unused MCPs, adds concise-response CLAUDE.md directives, and cuts costs to roughly $100/month. ## Quick Start Ask the assistant to audit your current Claude Code session for token optimization opportunities and apply the recommended fixes.

Frequently Asked Questions about token-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce token costs in Claude Code?

Run a session audit with /context and /plugin, disable unused MCPs, add concise-response directives to CLAUDE.md, and filter verbose CLI output with RTK. Documented results show reductions from $750/month to $100/month.

What invalidates the prompt cache in Claude Code?

Adding MCPs or tools mid-session, modifying CLAUDE.md, or editing earlier messages invalidates the cache and re-bills affected tokens. Configure everything before starting, and use /compact plus a new session if changes are required.

How do I stop Claude Code agents from consuming too many tokens?

Spawn agents with context forking so they work in isolated windows and return only results, not full history. Spawn them early while the parent context is still light, and delegate web research and transcription tasks to subagents.

What is RTK and how does it save tokens?

RTK is a CLI output filter installed via npx rtk init --global that strips verbose command output before it enters context. It reduces commands like git status from roughly 50 lines to about 5, saving around 80-90% on those calls.

Should I use the 1M token context window in Claude Code?

Only for very large codebases. For small to medium projects, set contextWindow to around 200,000 in settings.json, since a constrained window enforces better context discipline and reduces bloat.

Why is my Claude Code session slow and bloated?

Common causes are too many loaded MCPs, screenshot-based browser automation, verbose command output, and missing context forking for agents. Run /context to identify the source, then apply the skill's phased optimization steps.