agentsclimarketplace

Token miser

Skill scoobydont-666/shared-claude-skills/skills/token-miser

10 production-tested Claude Code skills — model routing, security hardening, code quality, tax advisory, cost optimization. Install: clone to ~/.claude/skills/

Install
npx -y skills add scoobydont-666/shared-claude-skills --skill token-miser

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Minimize Claude token and cost waste across ALL surfaces — Claude Code subagents, API calls in code, and artifacts. Routes subagent model selection via the Agent tool's model parameter. Recommends /model switches when the current model is overkill or underpowered. Applies to any code importing anthropic or calling /v1/messages. Trigger on: "API call", "artifact", "pipeline", "multi-agent", "LangGraph", "which model", "save tokens", "reduce cost", "claude API", "token usage", "context window", any code importing anthropic or calling /v1/messages, subagent launches, or any discussion about optimizing Claude usage or costs.

SKILL.md

8.4 KB, as published. Nobody here has run it

Token-Miser

Route every Claude interaction to the cheapest model that can handle it reliably. This applies to three surfaces:

  1. Claude Code subagents — set model param on every Agent tool call
  2. API calls in code — model selection when writing code that calls Anthropic
  3. Artifacts — model selection for API calls inside artifacts

Never mention routing decisions to the user unless asked — just apply them.


Scope

SurfaceMechanismWhat Token-Miser Does
Claude Code subagentsAgent tool model param (haiku, sonnet, opus)Route every subagent to cheapest viable model
Claude Code main modelRecommend /model switch to userFlag when current model is overkill or underpowered
API calls in codeModel string in anthropic.messages.create()Route to optimal model, escalation wrappers, batching, caching
ArtifactsModel string in browser API callsSame as API calls

Model Tiers (Verified 2026-03-17)

TierModelAgent ParamAPI StringCostContext
1 — Fast/CheapHaiku 4.5haikuclaude-haiku-4-5-20251001~1x200K
2 — BalancedSonnet 4.6sonnetclaude-sonnet-4-6~3x200K
3 — PowerfulOpus 4.6opusclaude-opus-4-6~5x200K (1M beta)

See references/model-pricing.md for detailed token pricing.


Claude Code Subagent Routing

This is the primary cost lever. Every Agent tool call accepts an optional model parameter. Always set it explicitly based on the task.

Subagent Routing Table

Subagent TaskModelRationale
File search, pattern matching (Explore)haikuRead-only, deterministic
Simple grep/glob delegationhaikuMechanical search
Code review (style, linting)haikuPattern matching, checklist
Test runner, build validationhaikuExecute + report, no reasoning
Research — single focused questionsonnetNeeds synthesis
Research — broad explorationsonnetMulti-step, judgment calls
Code generation (simple function, boilerplate)sonnetNeeds correctness
Code generation (complex, multi-file, architectural)opusHigh stakes, needs reasoning
Planning / architecture designopusOpen-ended, judgment-heavy
Debugging (root cause analysis)sonnetStart here, escalate if stuck
Writing documentationhaikuTemplated, low ambiguity
Git operations, status checkshaikuMechanical

When NOT to downgrade subagents

  • Subagent will write code that gets committed — sonnet minimum
  • Subagent needs to make judgment calls about ambiguous requirements — sonnet+
  • Subagent result feeds directly into user-facing output — match main model tier
  • Task previously failed at a lower tier — escalate, don't retry same tier

Main Model Recommendations

SituationRecommendation
User on Opus, doing simple file edits / git opsSuggest: /model sonnet would save cost
User on Haiku, attempting complex multi-file refactorSuggest: /model opus recommended
User on Sonnet, task is clearly Haiku-tierDon't mention — switching friction not worth it
User on Sonnet, task is clearly Opus-tierSuggest only if quality likely to suffer

Rule: Only recommend switches when the cost/quality delta is significant. Sonnet is always an acceptable default.


Freshness Protocol

  1. Read references/model-pricing.md header date.
  2. If <90 days old — use as-is.
  3. If >90 days old — web-search Anthropic Claude API pricing before using prices.
  4. If prices changed — update the reference file.

Skip when: applying routing table (no dollar amounts needed), subagent model selection (relative tiers don't change with pricing), token efficiency rules.


Routing Decision Framework

Step 1 — Classify the task

Task TypeDefault TierNotes
Simple Q&A, classification, extraction1Single-turn, clear answer
Summarization (short doc, <20K tokens)1
Summarization (long doc, >20K tokens)2Context pressure
Code generation (boilerplate, simple functions)1
Code generation (complex logic, multi-file)2
Code debugging / root cause analysis2Start here
Reasoning / multi-step math / analysis2Start here
Complex reasoning with ambiguous constraints3
Long-context document processing (>100K tokens)2Watch cost
Tool use — simple, single tool1
Tool use — multi-tool, agentic chains2
Tool use — autonomous, open-ended agent3
Structured output / JSON extraction1
Grading / judging other model outputs2Avoid circular bias

Step 2 — Apply modifiers

Bump up one tier if:

  • Output is user-facing AND quality-sensitive
  • Task requires multi-hop reasoning or >3 tool calls in a chain
  • Input context >100K tokens
  • Previous attempt at lower tier produced poor results

Bump down one tier if ALL of:

  • Output is intermediate (not user-facing)
  • Task is deterministic and templated
  • Correctness is cheaply verifiable

Step 3 — Fallback / escalation

  • Malformed output — retry once at same tier, then escalate
  • Logically inconsistent — escalate one tier
  • Confident and well-formed — done

Token Efficiency Rules

  1. Trim system prompts — under 500 tokens unless required.
  2. Batch — one call with 10 items beats 10 sequential calls.
  3. Cap max_tokens — set to minimum plausible output length.
  4. Cache-friendly prompts — stable content at the top.
  5. Avoid redundant context — summarize prior turns, don't echo.
  6. Structured output — JSON/tables over prose when consumer is a machine.
  7. Minimize calls per interaction — batch user inputs before calling API.

Multi-Call Pipeline Design

[Router / Planner]   → Tier 1 or 2 (classify intent, decompose task)
[Subtask Workers]    → Tier 1 (extraction, formatting, simple transforms)
[Synthesizer]        → Tier 2 (combine, reason across results)
[Quality Gate]       → Tier 1 (schema check) → escalate to Tier 2 if fail
[Final Response]     → Tier matching user-facing quality bar

General rule: cheap models do the volume work; expensive models do the judgment.


Project-Specific Routing

<your-project> (LangGraph tax pipeline)

  • Intent classification: Haiku | RAG scoring: Haiku | Tax reasoning: Sonnet/Opus
  • Response synthesis: Sonnet minimum | Security guardrails: Haiku

<internal-project-3> (guest messaging pipeline)

  • Webhook parsing: Haiku | Guest messages: Sonnet | Review responses: Sonnet

<internal-project-4> (interview pipeline)

  • Form extraction: Haiku | State transitions: Haiku | Tax calculation: Sonnet

<internal-project-1> / Infrastructure

  • No API calls — token-miser applies only to subagent routing during Claude Code sessions

Quick Reference Card

SUBAGENT ROUTING (Claude Code):
  Explore/search/grep:  haiku     Research/synthesis:   sonnet
  Code gen (simple):    sonnet    Code gen (complex):   opus
  Test/build/git:       haiku     Planning/arch:        opus
  Docs/formatting:      haiku     Debugging:            sonnet

API / ARTIFACT ROUTING:
  Task complexity:   LOW  → Haiku    MED  → Sonnet    HIGH → Opus
  Context size:      <20K → Haiku    20K-100K → Sonnet  >100K → Sonnet/Opus
  User-facing:       No   → Haiku    Yes → +1 tier if quality-sensitive
  Cost ratio:        1x         ~3x              ~5x

NOTE: Opus 4.6 at $5/$25 is only 5x Haiku (not 15x like legacy Opus 4.1).
When in doubt between Sonnet and Opus, quality wins.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.