
Token Budget Advisor
FreeControl response depth and token usage effectively.
Free · Opens the source repo
What Token Budget Advisor does
The Token Budget Advisor skill is designed to help users manage and optimize their interaction with AI by providing options for response depth before an answer is generated. This skill is particularly useful when users want to control how much information they receive, whether they prefer concise answers or detailed explanations. By intercepting the response process, it allows users to specify their preferences based on token usage, response length, and answer depth, ensuring they get exactly what they need without unnecessary verbosity.
When a user triggers this skill, it first estimates the number of tokens that the input prompt will consume using a heuristic approach. This estimation is based on the type of content being requested, whether it is prose or code, and applies a multiplier based on the complexity of the question. The skill categorizes the prompt into different complexity levels, ranging from simple yes/no questions to complex multi-part analyses, and provides a corresponding range of token usage for each level of detail.
Once the token estimation is complete, the skill presents the user with options for response depth, ranging from a brief answer to a comprehensive analysis. This is done through a clear and structured interface that outlines the expected token usage for each option, allowing users to make informed decisions about how much detail they want in their responses. The skill also includes a mechanism to maintain the chosen depth level throughout the session unless the user decides to change it.
Overall, the Token Budget Advisor skill is ideal for developers and designers who frequently interact with AI and need a way to manage the flow of information efficiently. It empowers users to tailor their experience according to their specific needs, making it a valuable addition to any AI coding agent's toolkit.
When to use it
Use this skill when you want to specify how detailed or concise an AI response should be, especially when token usage is a concern.
When not to use it
This skill is not suitable for situations where a straightforward answer is required without any depth control, such as simple factual queries.
What you can build with it
Requesting a Brief Answer
When a user asks for a 'short version' of a complex topic, the skill provides a concise response based on the specified depth.
Controlling Token Usage
A developer may want to know how many tokens a response will consume before asking a question, allowing them to manage their usage effectively.
Adjusting Response Detail
A designer can request a detailed analysis of a design concept and later switch to a more concise summary if needed.
How to install Token Budget Advisor
View source1. Install with the skills CLI
npx skills add affaan-m/ecc/token-budget-advisor --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by affaan-mToken预算顾问(TBA)
在Claude回答之前拦截响应流程,让用户选择回答深度。
何时使用
- 用户希望控制回答的长度或详细程度
- 用户提及token、预算、深度或回答长度
- 用户说"简短版"、"太长不看"、"简要"、"25%"、"详尽"等
- 任何用户希望预先选择深度/详细程度的情况
不要触发当:用户已在本会话中设置了级别(静默保持),或答案本身只有一行。
工作原理
第一步 — 估算输入token
使用仓库的标准上下文预算启发式方法,在脑海中估算提示词的token数量。
使用与context-budget相同的校准指南:
- 散文:
words × 1.3 - 代码密集或混合/代码块:
chars / 4
对于混合内容,使用主导内容类型并保持估算启发式方法。
第二步 — 按复杂度估算响应大小
对提示词进行分类,然后应用乘数范围获取完整响应窗口:
| 复杂度 | 乘数范围 | 示例提示词 |
|---|---|---|
| 简单 | 3× – 8× | "X是什么?",是/否问题,单一事实 |
| 中等 | 8× – 20× | "X是如何工作的?" |
| 中高 | 10× – 25× | 带上下文的代码请求 |
| 复杂 | 15× – 40× | 多部分分析、比较、架构 |
| 创意 | 10× – 30× | 故事、散文、叙事写作 |
响应窗口 = input_tokens × mult_min 到 input_tokens × mult_max(但不要超过模型配置的输出token限制)。
第三步 — 呈现深度选项
在回答之前呈现此区块,使用实际估算的数字:
分析您的提示...
输入:~[N] 个令牌 | 类型:[类型] | 复杂度:[级别] | 语言:[语言]
选择您的深度级别:
[1] 基础 (25%) -> ~[令牌数] 直接回答,无开场白
[2] 适中 (50%) -> ~[令牌数] 回答 + 背景 + 1个示例
[3] 详细 (75%) -> ~[令牌数] 完整回答及备选方案
[4] 详尽 (100%) -> ~[令牌数] 全部内容,无限制
选择哪个级别?(1-4 或说 "25% 深度", "50% 深度", "75% 深度", "100% 深度")
精确度:启发式估计约 85-90% 准确率(±15%)。
各级别token估算(在响应窗口内):
- 25% →
min + (max - min) × 0.25 - 50% →
min + (max - min) × 0.50 - 75% →
min + (max - min) × 0.75 - 100% →
max
第四步 — 按所选级别回答
| 级别 | 目标长度 | 包含内容 | 省略内容 |
|---|---|---|---|
| 25% 核心 | 最多2-4句话 | 直接回答、关键结论 | 上下文、示例、细微差别、替代方案 |
| 50% 适中 | 1-3个段落 | 答案+必要上下文+1个示例 | 深度分析、边界情况、参考文献 |
| 75% 详细 | 结构化回答 | 多个示例、优缺点、替代方案 | 极端边界情况、详尽参考文献 |
| 100% 详尽 | 无限制 | 一切内容——完整分析、所有代码、所有视角 | 无 |
快捷方式 — 跳过提问
如果用户已表明级别,立即按该级别回答,无需询问:
| 用户所说 | 级别 |
|---|---|
| "1" / "25%深度" / "简短版" / "简要回答" / "太长不看" | 25% |
| "2" / "50%深度" / "适中深度" / "平衡回答" | 50% |
| "3" / "75%深度" / "详细回答" / "全面回答" | 75% |
| "4" / "100%深度" / "详尽回答" / "完整深入分析" | 100% |
如果用户在本会话中已设置级别,后续回答静默保持该级别,除非用户更改。
精度说明
此技能使用启发式估算——非真实分词器。准确率约85-90%,偏差±15%。始终显示免责声明。
示例
触发场景
- "先给我简短版。"
- "你的回答会用多少token?"
- "按50%深度回答。"
- "我要详尽的答案,不要摘要。"
- "先给我简短版,再给详细版。"
不触发场景
- "什么是JWT token?"
- "结账流程使用了一个支付token。"
- "这正常吗?"
- "完成重构。"
- 用户已为本会话选择深度后的后续问题
来源
来自TBA — Claude Code的Token预算顾问的独立技能。 原始项目还附带了一个Python估算脚本,但本仓库保持技能自包含且仅使用启发式方法。
Frequently asked questions about Token Budget Advisor
Similar skills
Arize Prompt Optimization
Enhance LLM prompts using data-driven insights.
Prompt Optimizer
Transform vague ideas into precise LLM prompts.
Prompt Engineering Patterns
Enhance LLM prompts for better performance and reliability.
Senior Prompt Engineer
Optimize LLM performance and design advanced AI systems.
Prompt Engineer Toolkit
Transform marketing prompts into tested production assets.
Senior Prompt Engineer
Optimize prompts and evaluate LLM outputs efficiently.
