Agent skill · AI & Agents

token-cost

Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement is vibes. Use when asked how many tokens is this, what does this context cost per call, is this optimization worth it, or compare these two versions' cost. Produces the estimate with both heuristics shown, the cost math at your prices across your call volume, and the before/after comparison that decides whether an optimization earned its complexity.

mohitagw15856github.com/mohitagw15856GitHub ↗
claude-codecursorships scriptsMIT
Install
npx skills add mohitagw15856/pm-claude-skills --skill token-cost --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 5 KB
Bundled scripts: yes
Path: skills/token-cost/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 1,255
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Token Cost Skill Every token optimization should start and end with the same question: *how many, at what price, how often?* — and most skip all three. This skill is the measurement layer: local token estimates (two stated heuristics, averaged, no tokenizer dependencies), cost math at *your* model's prices (supplied, never baked in — prices change faster than repos), and the before/after comparison that turns "this feels smaller" into "saves 4,200 tokens, $1.26 per hundred calls." The honest core: a 40% saving on something sent once is a rounding error; 8% on something sent every call is real money — the `--calls` flag is the whole insight. ## What This Skill Produces - **The estimate** — chars/4 and words×4/3, both shown, averaged, with the ±15% honesty label - **The cost math** — per call and across the stated call volume, at supplied prices - **The comparison** — before vs. after any optimization: tokens saved, percent, dollars at volume - **The verdict frame** — worth-it / not-worth-it, decided by volume × savings vs. the optimization's own complexity ## Required Inputs Ask for these if not provided: - **The content** — file or text to measure; for comparisons, both versions

What's inside
Steps it walks through
  1. What This Skill Produces
  2. Required Inputs
  3. Programmatic Helper
  4. Framework: The Measurement Rules
  5. Output Format
  6. Quality Checks
  7. Anti-Patterns
Ships with 1 file
  • scripts/token_cost.py
Commands it runs
python3 scripts/token_cost.py --file context.md --price-in 3 --calls 200
python3 scripts/token_cost.py --file original.json --compare crushed.json --price-in 3 --calls 200
More from pm-claude-skills
All skills →
About this skill
What does the token-cost skill do?

Measure before optimizing — estimate token counts locally with stated heuristics, price them at your model's rates, and quantify before/after savings, because token optimization without measurement is vibes. Use when asked how many tokens is this, what does this context cost per call, is this optimization worth it, or compare these two versions' cost. Produces the estimate with both heuristics shown, the cost math at your prices across your call volume, and the before/after comparison that decides whether an optimization earned its complexity.

How do I install it?

Run `npx skills add mohitagw15856/pm-claude-skills --skill token-cost --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From mohitagw15856/pm-claude-skills, a repository with 1,255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going