SKILL

context-budget

Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat and redundant components and provides prioritized token-saving recommendations.

Machine translation
Read the original Chinese text

审核Claude Code上下文窗口在代理、技能、MCP服务器和规则中的消耗情况。识别膨胀、冗余组件,并提供优先的令牌节省建议。

Target: Software development & testing. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original Chinese text

Topics in the source

  • 上下文预算
  • 使用时机
  • 工作原理
  • 阶段 1:清单
  • 阶段 2:分类
  • 阶段 3:检测问题
  • 阶段 4:报告
  • 示例

分析 Claude Code 会话中每个已加载组件的令牌开销,并提供可操作的优化建议以回收上下文空间。 会话性能感觉迟缓或输出质量下降 你最近添加了许多技能、代理或 MCP 服务器 你想知道实际有多少上下文余量 计划添加更多组件,需要知道是否有空间 运行 /context-budget 命令(本技能为其提供支持) 扫描所有组件目录并估算令牌消耗: 代理 (agents/.md) 统计每个文件的行数和令牌数(单词数 × 1.3) 提取 description 前言长度 标记:文件 >200 行(繁重),描述 >30 词(臃肿的前言) 技能 (skills//SKILL.md) 统计 SKILL.md 的令牌数 标记:文件 >400 行 检查 .agents/skills/ 中的重复副本 — 跳过相同副本以避免重复计数 规则 (rules//.md) 统计每个文件的令牌数 标记:文件 >100 行 检测同一语言模块中规则文件之间的内容重叠 MCP 服务器 (.mcp.json 或活动的 MCP 配置) 统计配置的服务器数量和工具总数 估算模式开销约为每个工具 500 令牌 标记:工具数 >20 的服务器,包装简单 CLI 命令的服务器 (gh, git, npm, supabase, vercel) CLAUDE.md(项目级 + 用户级) 统计 CLAUDE.md 链中每个文件的令牌数 标记:合并总数 >300 行 将每个组件归入一个类别: | 类别 | 标准 | 操作 | |--------|----------|--------| | 始终需要 | 在 CLAUDE.md 中被引用,支持活动命令,或匹配当前项目类型 | 保留 | | 有时需要 | 特定领域(例如语言模式),未在 CLAUDE.md 中引用 | 考虑按需激活 | | 很少需要 | 无命令引用,内容重叠,或无明显的项目匹配 | 移除或延迟加载 | 识别以下问题模式: 臃肿的代理描述 — 前言中描述 >30 词,会在每次任务工具调用时加载 繁重的代理 — 文件 >200 行,每次生成时都会增加任务工具的上下文 冗余组件 — 重复代理逻辑的技能,重复 CLAUDE.md 的规则 MCP 超额订阅 — >10 个服务器,或包装了可免费使用的 CLI 工具的服务器 CLAUDE.md 臃肿 — 冗长的解释、过时的部分、本应成为规则的指令 生成上下文预算报告: 在详细模式下,额外输出每个文件的令牌计数、最繁重文件的行级细分、重叠组件之间的具体冗余行,以及 MCP 工具列表和每个工具模式大小的估算。 基本审计 详细模式 扩容前检查 令牌估算:对散文使用 words × 1.3,对代码密集型文件使用 chars / 4 MCP 是最大的杠杆:每个工具模式约消耗 500 令牌;一个 30 个工具的服务器开销超

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
affaan-m/ECC
Source file
docs/zh-CN/skills/context-budget/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Requirements

  • Only the author’s Skill metadata is included. Read the full instructions to check dependencies, licensing and conditions of use.

A small first task

先阅读原作者说明,再决定是否在自己的 AI 工具中使用。

Instructions for your AI tool

Author documentation is not live verification by this site. Without evidence, we do not mark a resource as compatible, safe or free.

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:50.246Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.