Skip to content
Skills Library
AI & agents · Automation

model-router

/model-router

Route every subagent to the cheapest model that can do the job (Haiku, Sonnet or Opus) and log each routing decision. Use whenever a task can be split into subtasks or would benefit from delegating work to subagents, before spawning any Agent.

Licence
MIT
Last repository change
12.11.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Route every subagent to the cheapest model that can do the job (Haiku, Sonnet or Opus) and log each routing decision. Use whenever a task can be split into subtasks or would benefit from delegating work to subagents, before spawning any Agent.

Original author description

Route every subagent to the cheapest model that can do the job (Haiku, Sonnet or Opus) and log each routing decision. Use whenever a task can be split into subtasks or would benefit from delegating work to subagents, before spawning any Agent.

How it works

  1. 1. Decide whether to delegate
  2. 2. Pick the model for each subtask
  3. 3. Log every decision
  4. 4. Review results and escalate on failure
  5. 5. User overrides
  6. 6. Never
Original SKILL.md headings · 72 lines, 616 words
SKILL.md preview
---
name: model-router
description: Route every subagent to the cheapest model that can do the job (Haiku, Sonnet or Opus) and log each routing decision. Use whenever a task can be split into subtasks or would benefit from delegating work to subagents, before spawning any Agent.
---

# Model Router

You are the orchestrator. Your job is to plan, delegate and review — not to do bulk work yourself. Send each subtask to the cheapest model that can do it well, and log every decision.

## 1. Decide whether to delegate

- **Stay inline** (no subagent) if the whole task is tiny: a one-line fix, a direct question you can answer from what is already in context, or a single small edit.
- **Delegate** everything else. Break the task into subtasks first, then route each subtask separately.

## 2. Pick the model for each subtask

Default to **Haiku**. Move up a tier only when you can name the reason.

| Tier | Use for | Examples |
|---|---|---|
| `haiku` | Mechanical work: finding, listing, counting, formatting. No judgment about code. | Find files that mention X; list a folder's structure; grep for a string; check whether a function exists; reformat a list; summarise a short, simple file |
| `sonnet` | Anything that needs understanding or writing code or prose. | Implement a function; refactor; write or fix tests; debug an error; explain how a module works; review a diff |
| `opus` | Hard reasoning where a mistake is expensive. | Architecture or design decisions; security-sensitive changes; ambiguous requirements; tricky concurrency or data-loss risks |

Rules of thumb:
- Any subtask where the agent must **understand code and decide something** about it goes to `sonnet` or higher.
- When a subtask could fit either of two tiers, choose the **lower** tier.
- Prefer handling `opus`-level reasoning yourself (you are the orchestrator) rather than spawning an Opus subagent, unless the work needs a fresh, isolated context.
- Run independent subtasks in parallel: launch several Agent calls in one message.

Always pass the model explicitly in the Agent call, for example:

```
Agent(subagent_type: "Explore", model: "haiku", description: "Find config files", prompt: "...")
Agent(subagent_type: "general-purpose", model: "sonnet", description: "Implement parser", prompt: "...")
```

Give every subagent a self-contained prompt: it cannot see this conversation. Include file paths, the goal, constraints and the exact format you want back.

## 3. Log every decision

Immediately before each Agent call, append one line to the routing log with Bash:

```bash
mkdir -p ~/.claude/model-router && echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) | $(basename "$PWD") | <model> | <short task description> | <reason>" >> ~/.claude/model-router/routing.log
```

- `<model>` is exactly `haiku`, `sonnet` or `opus`.
- `<short task description>` must match the Agent call's `description` field word for word, so the verifier can pair them.
- `<reason>` is a few words, e.g. `mechanical lookup`, `needs code comprehension`, `security-sensitive`.
- Do not use the `|` character inside the description or reason.

Also log tasks you keep inline, with model `inline`:

```bash
echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) | $(basename "$PWD") | inline | <task> | <reason>" >> ~/.claude/model-router/routing.log
```

## 4. Review results and escalate on failure

When a subagent returns:
- Check the result actually answers the subtask. Do not pass along output you have not read.
- If a `haiku` result is wrong, empty or clearly low quality, **re-run the same subtask once on `sonnet`** and log it with reason `escalated: <what went wrong>`.
- If a `sonnet` result fails, handle it yourself or ask the user. Do not loop.

## 5. User overrides

- "no routing" or "don't delegate" → do everything inline, log nothing.
- "use haiku" / "use sonnet" / "use opus" → every subagent in this task uses the named model; log the reason as `user override`.

## 6. Never

- Never change `CLAUDE_CODE_SUBAGENT_MODEL` or any settings file.
- Never write routing rules into the project's CLAUDE.md.
- Never skip the log line — the experiment depends on it.

Versions

RepositoryScoreLicence
This page · Manuele-T/claude-model-router100MIT
Navinspire-ia/navin100AGPL-3.0
ShepardVasNormandy/claude-skills100MIT
uniqaiapp/model-router100MIT
fabioc-aloha/Alex_Skill_Mall90MIT

Database snapshot: 13.11.2026 · package version 8c4aa7804a18 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100smart-model-router
    Route each coding task to the cheapest Claude model that can reliably do it (Haiku / Sonnet / Opus subagents), verify the result, and escalate only on failure. Use for any multi-step coding work, or when the user asks to save tokens/credits, route models, or "use SMR".
  • 95claude-model-router
    Use to save usage limit by routing work to the cheapest model able to do it with the same quality. Use when the user invokes /claude-model-router, before tasks with more than 5 files or more than 10 actions, when executing a plan with independent steps, when creating migrations,…
  • 100route
    Use to save usage limit by routing work to the cheapest model able to do it with the same quality. Use when the user invokes /model-router:route, before tasks with more than 5 files or more than 10 actions, when executing a plan with independent steps, when creating migrations,…
  • 100subagent-model-picker
    Pick the model for each Claude Code subagent before you spawn it. Given a list of tasks to delegate, assign every task Haiku, Sonnet, Opus or Fable with a one-line cost and quality reason, then pass that model to the Agent tool or write it into the subagent's `model:`…
  • 90model-routing
    Pick the right model per call, not per project — route Opus/Sonnet/Haiku, GPT-5/4o/mini, Gemini Pro/Flash by task, and cut cost without losing quality. Use when the user is choosing model tiers, building a router, or debating Opus-only vs mixed-tier deployments and mentions…
  • 90smart-model-router
    Route each coding task to the cheapest SMR agent that can reliably do it (smr-fast / smr-builder / smr-architect), verify the result, and escalate only on failure. Use for multi-step coding work, or when the user asks to save tokens/credits, route models, or "use SMR". Do not…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.