optimize-tokens

optimize-tokens is a skill for Claude Code, Codex from huzaifa525/claude-code-optimizer. It costs 25 tokens per session (477 once invoked), scanned A, original, MIT.

A token-usage review for Claude Code, where tokens are the text units used to process requests and code.

In plain words
What is it for?
Use it to review project instructions, ignored files, rules, skills, tool definitions, thinking limits, and model settings, then produce a savings report.
Why use it?
It identifies project settings and files that may cause unnecessary processing or higher usage costs. It also researches current ways to reduce that usage.

Skill for Claude CodeCodex

Part of the claude-code-optimizer plugin — 25 skills, 4 hooks shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/huzaifa525/claude-code-optimizer/optimize-tokens
Any agent
npx skills add huzaifa525/claude-code-optimizer --skill optimize-tokens
Clone the repo
git clone --depth 1 https://github.com/huzaifa525/claude-code-optimizer

Made for: Claude Code, Codex.

Or install claude-code-optimizer, the plugin that ships this one along with the rest of its 25 skills, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for optimize-tokens

README.md
[![agentmods](https://agentmods.dev/badge/skills/huzaifa525/claude-code-optimizer/optimize-tokens.svg)](https://agentmods.dev/skills/huzaifa525/claude-code-optimizer/optimize-tokens)
Your own site
<a href="https://agentmods.dev/skills/huzaifa525/claude-code-optimizer/optimize-tokens"><img src="https://agentmods.dev/badge/skills/huzaifa525/claude-code-optimizer/optimize-tokens.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 477 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00025 $0.00477
Opus 5 $0.00013 $0.00238
Sonnet 5 $0.00005 $0.00095
Haiku 4.5 $0.00003 $0.00048

Measured 5d ago against content hash e1e78c82e699, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

optimize-tokens scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/.claude/skills/optimize-tokens/SKILL.md · 75 lines

What it actually says

Search for the latest token optimization strategies and analyze this project's setup.

Steps

1. Web Research

Search for the latest tips:

  • "Claude Code token optimization 2026"
  • "Claude Code reduce token usage"
  • "Claude Code cost saving tips"
  • "Claude Code .claudeignore best practices"

Summarize the top 5-10 NEW tips found online.

2. Analyze Current Project

Check CLAUDE.md:

  • Does it exist? How many lines?
  • Is it under 200 lines?
  • Does it have entry points, flow diagrams, decisions?

Check .claudeignore:

  • Does it exist?
  • Does it cover: node_modules, dist, lock files, binary assets?

Check .claude/rules/:

  • Are rules path-scoped?
  • Are there rules loading unnecessarily?

Check .claude/skills/:

  • Are exploration skills using context: fork?
  • Are side-effect skills using disable-model-invocation: true?

Check MCP servers:

  • How many tool definitions are loaded?
  • Any unused servers?

Check settings:

  • Is MAX_THINKING_TOKENS capped?
  • What model is being used?

3. Output Report

## Token Optimization Report

### Current Setup Score: [X/10]

### What's Good
- [things already optimized]

### Quick Wins (do now)
| Action | Estimated Savings | Effort |
|--------|------------------|--------|
| [action] | [X%] | [Low/Med/High] |

### Latest Tips from Web
- [tip 1 — source]
- [tip 2 — source]
- [tip 3 — source]

### Recommended Changes
1. [specific change with file path]
2. [specific change with file path]
3. [specific change with file path]
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 75 lines · 25 tokens per session scan A e1e78c82e699

Subscribe to this mod's changes

optimize-tokens is a skill published in the GitHub repository huzaifa525/claude-code-optimizer (9 stars, last pushed 5mo ago), licensed MIT. It adds 25 tokens to every session and 477 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

om-auto-publish-pr

Publish pkg.pr.new package previews for a same-repository Open Mercato PR by dispatching the Package Previews GitHub Actions workflow with gh. Use when a maintainer asks to publish, republish, or trigger a PR package preview. Does not publish npm snapshots.

open-mercato/open-mercato · 60 tokens

codex-skin-pack-installer

Install Codex themes and Codex skin packs with npx skills. Use this skill when a user wants Codex to find, download, validate, apply, switch, remix, or restore Codex desktop themes such as caishen-readable, caishen-lite, mythic-guardian-noir, global-founder-bright, export-night, or caishen-max. It stages verified…

hashgraph-online/awesome-codex-plugins · 125 tokens

om-code-review

Open Mercato repo-local extension of the shared om-code-review skill (installed from open-mercato/skills into .agents/skills/). Adds the Docker-vs-local gate runner detection, the template parity gate, Open Mercato layer classification, and the repo's severity taxonomy on top of the shared workflow.

open-mercato/open-mercato · 69 tokens

om-build-workflow

Build or extend standalone business workflows, activities, event triggers, durable user tasks, compensation, output paths, idempotency, and live progress. Use for "add workflow", "custom activity", "CALLAPI", "approval task", "workflow progress", or "zbuduj workflow".

open-mercato/open-mercato · 63 tokens

memstack-automation-n8n-workflow-builder

Use this skill when the user says 'n8n workflow', 'build a workflow', 'automation workflow', 'connect services', or needs visual workflow design with node mapping, data transformations, and error handling for n8n. Do NOT use for standalone webhook endpoints or cron jobs.

cwinvestments/memstack · 68 tokens

styleseed

Route a StyleSeed request to exactly one first workflow after resolving the current artifact boundary. Use when the user asks generally for StyleSeed help rather than invoking one specific ss- skill.

bitjaru/styleseed · 39 tokens