agentleFS
kienbui1995kienbui1995/magic-powers/skills/cost-aware-routing/SKILL.md

cost-aware-routing

Skill0 starsChanged 8 months agoMITView on GitHub

Use when deciding which model or agent to use for a task - guides cost-optimized model selection based on task complexity

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Not every task needs the most expensive model.

    line 10
  2. Distinctive:

    Before: ~98% Opus = high cost

    line 94
  3. Distinctive:

    After: ~10% Opus, ~70% Sonnet, ~20% Haiku = ~75% cost reduction

    line 95

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cost-Aware Model Routing

Overview

Not every task needs the most expensive model. Route tasks to the right model based on complexity, saving cost without sacrificing quality.

The Routing Table

ModelAgentCostBest For
Opusarchitect$$$$$Complex architecture, novel design, ambiguous requirements
Sonnetdebugger, ui-designer, (default)$$Implementation, debugging, most coding tasks
Haikureviewer$Code review, verification, simple lookups, formatting

Cost ratios (approximate):

  • Opus : Sonnet : Haiku ≈ 25 : 5 : 1
  • A Haiku review costs ~1/60th of an Opus review

Decision Framework

WHEN receiving a task:

1. Can Haiku handle this? (review, verify, format, lookup)
   → YES: Use reviewer agent or --model haiku
   
2. Is this standard implementation/debugging?
   → YES: Use default Sonnet (or debugger/ui-designer agent)
   
3. Does this require deep reasoning about novel problems?
   → YES: Use architect agent (Opus)

Task → Model Mapping

Use Haiku (reviewer agent) for:

  • Code review after implementation
  • Verification checks (tests pass? linter clean?)
  • Simple refactoring (rename, reformat)
  • Documentation review
  • Checking git status/diff
  • Quick lookups in codebase

Use Sonnet (default) for:

  • Feature implementation
  • Bug fixing and debugging
  • Writing tests
  • Database migrations
  • API development
  • UI component building
  • Most day-to-day coding

Use Opus (architect agent) for:

  • System architecture design
  • Complex brainstorming with many trade-offs
  • Ambiguous requirements that need deep analysis
  • Cross-system integration planning
  • Performance optimization strategy
  • Security architecture review

Anti-Patterns

PatternProblemFix
Using Opus for everything25x cost for same resultDefault to Sonnet
Using Opus for code reviewOverkill, slowUse Haiku reviewer
Using Haiku for implementationToo many mistakesUse Sonnet
Not using agents at allMissing cost savingsDispatch to right agent

CLI Shortcuts

# Quick review with Haiku
claude -p "review the last commit" --model haiku

# Debug with Sonnet (default)
claude -p "fix the failing test in auth.py"

# Architecture with Opus
claude -p "design the caching layer" --model opus

# Budget cap
claude --max-budget-usd 0.50 -p "implement the login form"

Measuring Impact

Track your usage in Claude Code settings or Vertex AI console:

  • Before: ~98% Opus = high cost
  • After: ~10% Opus, ~70% Sonnet, ~20% Haiku = ~75% cost reduction

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.