Token 知識庫

額度什麼時候重置、怎麼省 token?依目錄查閱各個主題,Codex 和 Claude 分開說明,附官方原文和連結。

skill 和外掛每輪占多少 token?

每輪帶上的只是每個 skill 的名稱和描述,不是全文;實測一個帶 6 個 skill 的外掛每輪約 221 token。全文在用到那個 skill 時才讀進來。Claude Code 的 /usage 會依外掛列出每輪占用,Codex 機制相同,但沒有依 skill 拆分的數字。

Codex

機制相同:開頭只帶每個 skill 的名稱、描述和檔案路徑,全文選中才讀;Codex 不會依 skill 顯示 token 占用。

Codex 的初始 skill 清單最多占上下文視窗的 2%(視窗大小未知時為 8,000 個字元)。裝得多時先縮短描述,再多就直接不列一部分 skill,並提出警告。選中某個 skill 後,Codex 照樣會讀它的 SKILL.md 全文。Codex CLI 的 /usage 只依日、週、累計顯示 token,不會拆到 skill;想少帶,就在 ~/.codex/config.toml 裡把不用的 skill 關掉。

官方原文

Skills use progressive disclosure to manage context efficiently. ChatGPT and Codex start with each skill's name and description, then load the full SKILL.md instructions when they decide to use that skill. In Codex, the initial list also includes each skill's file path.
OpenAI docs · Build skills
To avoid crowding out the rest of the prompt, this list uses at most 2% of the model's context window, or 8,000 characters when the context window is unknown. If many skills are installed, Codex shortens skill descriptions first. For large skill sets, Codex may omit some skills from the initial list and show a warning.
OpenAI docs · Build skills
/usage — View account token usage or use a rate-limit reset. Inspect daily, weekly, or cumulative ChatGPT token activity from inside the TUI.
OpenAI docs · Developer commands

Claude

每輪只帶每個 skill 的名稱和描述;/usage 裡能看到每個外掛每輪加了多少 token。

Claude Code 把所有 skill 的名稱和描述列成一張清單放進系統提示,每則訊息都帶著它,用不用都算;第一輪之後依快取價重讀。這張清單有上限:上下文視窗的 1%,單一 skill 的描述最多 1,536 個字元,超過就從最少用的 skill 開始砍描述。SKILL.md 全文只在 skill 被呼叫時讀進來,讀進來之後留在對話裡,後面每一輪跟著一起重讀。

官方原文

In a regular session, skill descriptions are loaded into context so Claude knows what's available, but full skill content only loads when invoked.
Claude Code docs · Extend Claude with skills
Every skill in the skill listing adds to your context on every turn, whether or not Claude ever uses it. Run /skill-doctor to see what each of your skills costs and how often it gets used, so you can decide which ones to turn off.
Claude Code docs · Extend Claude with skills
The budget scales at 1% of the model's context window. When the listing overflows, Claude Code drops descriptions starting with the skills you invoke least, so the skills you use most keep their full text.
Claude Code docs · Extend Claude with skills
Skills load on-demand only when invoked, so moving specialized instructions into skills keeps your base context smaller.
Claude Code docs · Manage costs effectively

在 /usage 裡看每個外掛的占用

在 Claude Code 裡執行 /usage,找到 Plugin skill-listing footprint 這一欄。它依外掛列出「幾個 skill、每輪約多少 token」,例如:diagram-design 6 skills · ~221 tok/turn。這個數字是一個外掛的實測例子,不是平均值。

這一欄在 /usage 面板上的說明是:每個外掛的 skill 描述替系統提示加了多少(第一輪之後依快取輸入計算),agent 和 MCP 工具暫未計入。英文原句:What each plugin's skill descriptions add to the system prompt (cached input after the first turn). Agents and MCP tools not yet counted. 這句話來自 /usage 面板,不是官方文件。外掛裡自帶的 agent 和 MCP 工具要在這個數字之外另外算。

怎麼關掉不用的 skill

關掉之後,這個 skill 的描述就不再每輪帶上。怎麼關,要看它是從哪裡來的。

  1. Claude Code,外掛自帶的 skill:執行 /plugin disable 外掛名@市集名,或在 /plugin 的 Installed 頁裡操作。外掛自帶的 skill 只能這樣關。

  2. Claude Code,自己裝的 skill:打開 /skills,選取後按空白鍵切換狀態、按 Esc 儲存。name-only 只留名稱,off 完全隱藏。

  3. Claude Code,只想手動觸發的 skill:在 SKILL.md 開頭加 disable-model-invocation: true,它的描述就不再每輪帶上。

  4. Codex:在 ~/.codex/config.toml 裡加一段 [[skills.config]],寫上 path = "/path/to/skill/SKILL.md" 和 enabled = false,改完重新啟動 Codex。

官方原文

Plugin skills are not affected by skillOverrides. Manage those through /plugin instead.
Claude Code docs · Extend Claude with skills
Use [[skills.config]] entries in ~/.codex/config.toml to disable a skill without deleting it
OpenAI docs · Build skills

常見誤解

  • 裝了 50 個 skill,每輪就要多讀 50 份全文

    不會。每輪帶的只是名稱和描述,實測 6 個 skill 合計約 221 token;全文只有那個 skill 被用到時才讀進來。

  • skill 的描述寫得越詳細越好

    不是。描述是每輪都帶的那部分,而且會被截斷:Claude Code 每條最多 1,536 個字元、整張清單最多占上下文的 1%,Codex 整張清單最多 2%。把最關鍵的用途和觸發詞放在最前面,寫短。

  • skill 用完就不占 token 了

    不是。skill 全文讀進來後就留在對話裡,之後每一輪都跟著重讀;Claude Code 壓縮工作階段後,每個呼叫過的 skill 還會保留前 5,000 token(合計最多 25,000)。換任務就開新的工作階段。

建議

  • Claude Code:執行 /usage,看 Plugin skill-listing footprint 這一欄,先找每輪 token 最多的外掛。
  • Claude Code:執行 /skill-doctor(需要 v2.1.252 以上),它會標出從來沒被呼叫過的 skill 和最近沒用過的外掛;/context 的 Skills 一行是整張清單目前的大小。
  • 呼叫過 skill 之後要換任務,就 /clear(Codex 用 /new):讀進來的 skill 全文會一直留在這段工作階段裡。

Codex 重置公告與紀錄 · Claude 重置公告與紀錄