context-budget
Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat, redundant components, and produces prioritized token-savings recommendations.
Security Assessment
About context-budget
The context-budget skill analyzes context window consumption within a Claude Code session to help users understand and optimize token usage across loaded components. It audits agents, skills, rules, MCP servers, and CLAUDE.md files to estimate their token overhead and identify sources of unnecessary context bloat. By measuring file sizes, token estimates, duplicated content, and configuration complexity, the skill provides visibility into how much of the available context window is being consumed before actual user interactions occur. This helps prevent degraded output quality, sluggish performance, and reduced context headroom in large or heavily customized Claude Code environments.
The skill operates through multiple analysis phases. It inventories all relevant components, estimates token usage, and flags oversized or redundant files based on predefined thresholds. It classifies components into categories such as always needed, sometimes needed, or rarely needed to support optimization decisions. The skill also detects specific problem patterns including bloated agent descriptions, heavy agents, redundant skills or rules, excessive MCP server usage, and overly verbose CLAUDE.md chains. Finally, it generates a structured context budget report containing token breakdowns, issue summaries, and prioritized recommendations with estimated token savings. In verbose mode, the report can include per-file analysis, overlap detection details, and MCP tool schema estimates.
This skill is useful for developers, AI workflow maintainers, and advanced Claude Code users managing complex environments with many custom extensions. It is especially valuable for teams that rely on multiple agents, MCP integrations, or extensive rule systems and need to maintain efficient context utilization. The skill can also assist users planning to add new components by estimating available context headroom and identifying optimization opportunities before performance issues occur.
FAQ
What components does the context-budget skill analyze?
The skill analyzes agents, skills, rules, MCP server configurations, and CLAUDE.md files to estimate their contribution to context window usage.
How does the skill estimate token usage?
The skill estimates token counts using heuristics such as word counts multiplied by a token factor, file length analysis, and MCP tool schema overhead estimates.
Can the skill detect duplicate or redundant content?
Yes. It checks for overlapping rules, duplicated skills, redundant components, and identical copies of skills in mirrored directories to avoid double-counting.
Does the skill modify or remove components automatically?
No. The skill only audits and reports findings. It provides prioritized optimization recommendations but does not automatically change configurations or files.
What are the limitations of the analysis?
The skill provides estimated token usage rather than exact runtime measurements, and its recommendations are based on file structure, size thresholds, and detected overlap patterns.
Install context-budget
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
affaan-m/everything-claude-code