Communitygithub.com

Token Budget Advisor (TBA)

在 Claude 回答之前,提供回應深度的選擇,讓使用者掌控回覆詳細程度。

Token Budget Advisor (TBA) 是什麼?

Token Budget Advisor (TBA) 是一個專為 AI 編碼代理(如 Claude Code)設計的技能,用於在回應流程中插入一個深度選擇步驟。它通過啟發式估算輸入 token 數和回應複雜度,然後提供四個預設的詳細程度等級(25% 到 100%),讓使用者在 Claude 回答前決定要簡潔還是詳盡的回覆。此技能支援多種觸發方式,包括直接指定百分比(如「50% depth」)或自然語言短語(如「tldr」、「short version」),並且在會話中保持使用者所選的深度等級。它特別適合需要控制回應長度、節省 token 或逐步深入探討的使用場景,估算精準度約為 85-90%(±15% 變異)。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/token-budget-advisor

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Token Budget Advisor (TBA) 是做什麼的?

在 Claude 回答之前,攔截回應流程,為使用者提供選擇回應深度的選項。

使用時機

  • 使用者想要控制回應的長度或詳細程度
  • 使用者提到 token、預算、深度或回應長度
  • 使用者說「短版」、「tldr」、「簡潔」、「al 25%」、「詳盡」等
  • 任何使用者希望先選擇深度/詳細程度的時候

請勿觸發的時機:使用者已在本對話中設定過深度等級(應默默維持),或答案顯然只有一行。

運作方式

第一步 — 估算輸入 token

使用儲存庫中標準的上下文預算啟發式方法,在腦中估算提示詞的 token 數量。

使用與 context-budget 相同的校準指引:

  • 散文:單詞數 × 1.3
  • 程式碼為主或混合/程式碼區塊:字元數 / 4

對於混合內容,使用主要內容類型並維持估算的啟發式方法。

第二步 — 依複雜度估算回應大小

對提示詞進行分類,然後套用乘數範圍以獲得完整的回應區間:

複雜度乘數範圍提示詞範例
簡單3× – 8×「X 是什麼?」、是非題、單一事實
中等8× – 20×「X 是如何運作的?」
中高10× – 25×附有前後文的程式碼請求
複雜15× – 40×多部分分析、比較、架構討論
創意10× – 30×故事、散文、敘述性寫作

回應區間 = input_tokens × mult_min 到 input_tokens × mult_max(但不得超過模型設定的輸出 token 上限)。

第三步 — 呈現深度選項

在回答之前呈現此區塊,使用實際估算的數值:

分析您的提示詞...

輸入:~[N] token  |  類型:[類型]  |  複雜度:[等級]  |  語言:[語言]

選擇您的深度等級:

[1] 精華    (25%)  ->  ~[tokens]   僅直接回答,無前言
[2] 適中    (50%)  ->  ~[tokens]   回答 + 背景 + 1 個範例
[3] 詳細    (75%)  ->  ~[tokens]   完整回答,含替代方案
[4] 詳盡   (100%)  ->  ~[tokens]   全部內容,無限制

請選擇等級?(1-4 或說「25% depth」、「50% depth」、「75% depth」、「100% depth」)

精準度:啟發式估算約 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% depth" / "short version" / "brief answer" / "tldr"25%
"2" / "50% depth" / "moderate depth" / "balanced answer"50%
"3" / "75% depth" / "detailed answer" / "thorough answer"75%
"4" / "100% depth" / "exhaustive answer" / "full deep dive"100%

如果使用者在對話中已設定等級,則對後續回應默默維持該等級,直到使用者更改。

精準度說明

此技能使用啟發式估算 — 非真實 tokenizer。精準度約 85-90%,變異 ±15%。請始終顯示免責聲明。

範例

觸發情境

  • 「先給我短版。」
  • 「你的回答會用多少 token?」
  • 「以 50% 深度回應。」
  • 「我要詳盡的答案,不要摘要。」
  • 「Dame la version corta y luego la detallada.」

不觸發情境

  • 「什麼是 JWT token?」
  • 「結帳流程使用了一個付款 token。」
  • 「這正常嗎?」
  • 「完成重構。」
  • 使用者在對話中已選擇深度後的追問

來源

獨立技能,取自 TBA — Token Budget Advisor for Claude Code。 原始專案也提供了一個 Python 估算腳本,但此儲存庫保持技能自包含且僅使用啟發式方法。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相關技能