Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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 decid
.claude/skills/mohitagw15856-token-cost/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 42% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 45% | 0% |
| case-12 | ✗→✓ | ▲ Improved | -6% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 25% | 0% |
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.
Ask for these if not provided:
bashpython3 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
Deterministic, stdlib-only. Two heuristics (≈4 chars/token, ≈0.75 words/token) averaged and labeled as estimates — real tokenizers vary by model and content type, and the script says so on every run rather than cosplaying as one.
Script output: both heuristics, the estimate, the cost lines]
Comparison mode: the before/after with savings at volume]
The verdict: worth-it / not-worth-it, in one sentence with the reasoning] Estimates ±15%; prices supplied by you, dated today; exact counts need the provider's tokenizer.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 60,070 | 17,229 | -71% | 1 | 1 | 0% | 8,290 | 1,522 | -82% | 0 | 0 | — |
case-02 | fail→pass | 25,502 | 24,518 | -4% | 1 | 1 | 0% | 3,001 | 4,256 | +42% | 0 | 0 | — |
case-03 | fail→fail | 24,144 | 24,877 | +3% | 1 | 1 | 0% | 2,621 | 2,529 | -4% | 0 | 0 | — |
case-04 | pass→pass | 19,423 | 22,443 | +16% | 1 | 1 | 0% | 2,321 | 3,715 | +60% | 0 | 0 | — |
case-05 | pass→pass | 31,062 | 33,876 | +9% | 1 | 1 | 0% | 3,889 | 5,275 | +36% | 0 | 0 | — |
case-06 | pass→fail | 18,983 | 18,288 | -4% | 1 | 1 | 0% | 2,382 | 3,641 | +53% | 0 | 0 | — |
case-07 | fail→pass | 14,409 | 10,931 | -24% | 1 | 1 | 0% | 1,882 | 2,215 | +18% | 0 | 0 | — |
case-08 | fail→pass | 15,834 | 18,985 | +20% | 1 | 1 | 0% | 2,232 | 3,230 | +45% | 0 | 0 | — |
case-09 | fail→fail | 13,005 | 7,676 | -41% | 1 | 1 | 0% | 1,427 | 2,912 | +104% | 0 | 0 | — |
case-10 | pass→pass | 10,943 | 11,651 | +6% | 1 | 1 | 0% | 1,279 | 2,407 | +88% | 0 | 0 | — |
case-11 | pass→pass | 15,568 | 15,082 | -3% | 1 | 1 | 0% | 2,151 | 2,599 | +21% | 0 | 0 | — |
case-12 | fail→pass | 17,632 | 12,120 | -31% | 1 | 1 | 0% | 2,585 | 2,419 | -6% | 0 | 0 | — |
case-13 | fail→fail | 12,477 | 15,607 | +25% | 1 | 1 | 0% | 1,463 | 2,590 | +77% | 0 | 0 | — |
case-14 | pass→pass | 15,829 | 9,330 | -41% | 1 | 1 | 0% | 2,117 | 2,858 | +35% | 0 | 0 | — |
case-15 | fail→fail | 10,896 | 12,379 | +14% | 1 | 1 | 0% | 1,243 | 2,690 | +116% | 0 | 0 | — |
case-16 | pass→fail | 10,943 | 12,396 | +13% | 1 | 1 | 0% | 1,037 | 1,486 | +43% | 0 | 0 | — |
case-17 | fail→pass | 15,812 | 11,922 | -25% | 1 | 1 | 0% | 1,982 | 2,477 | +25% | 0 | 0 | — |
case-18 | pass→pass | 8,360 | 9,333 | +12% | 1 | 1 | 0% | 657 | 1,915 | +191% | 0 | 0 | — |
case-19 | pass→pass | 15,084 | 16,104 | +7% | 1 | 1 | 0% | 1,952 | 2,444 | +25% | 0 | 0 | — |
case-20 | fail→pass | 18,815 | 12,675 | -33% | 1 | 1 | 0% | 2,995 | 2,795 | -7% | 0 | 0 | — |
case-21 | pass→pass | 15,422 | 15,709 | +2% | 1 | 1 | 0% | 1,543 | 2,420 | +57% | 0 | 0 | — |
case-22 | fail→fail | 13,147 | 15,410 | +17% | 1 | 1 | 0% | 2,387 | 2,907 | +22% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted, and 19 counted toward the lift figure. The other 3 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +18 percentage points is the difference between those two pass rates over the 19 comparable cases. 3 cases got worse with the skill loaded, and they are included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.