model-routing
Skill9 starsChanged 10 months agoMITView on GitHub
Detailed model routing framework. Provides task classification, bug complexity scoring, escalation triggers, and cost optimization patterns for Opus/Sonnet/Haiku tiers.
15 other projects use a version of this.
Adopted by
Most recently taken up by
- frankxai/skillstheir own version, first seen Sep 30, 2026
- aditya-deokar/software-factorytheir own version, first seen Sep 29, 2026
- lucas-Oliveira-01/agentstheir own version, first seen Sep 28, 2026
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- verivus-oss/llm-cli-gatewaytheir own version, first seen Sep 3, 2026
- gaganjainse/shesh-skillstheir own version, first seen Aug 15, 2026
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 15
- Archive228/loopkit★ 756same name
- alinaqi/maggy★ 707same name
- fal-ai-community/skills★ 249same name
- nahid-sparktales/agent-dispatcher★ 59same name
- echo-of-machines/fable-advisor★ 26same name
- cobusgreyling/agent-skills★ 18same name
- verivus-oss/llm-cli-gateway★ 17same name
- naman10parikh/agentgrid★ 9same name
- yeaight7/agent-powerups★ 6same name
- cveralyon/axel-setup★ 4same name
5 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository55 other files it gives its agents.
- backend-patternsSkill
- brainstormingSkill
- clarify-firstSkill
- clickhouse-ioSkill
- coding-standardsSkill
- continuous-learning-v2Skill
- dart-patternsSkill
- dart-testingSkill
- dispatching-parallel-agentsSkill
- django-patternsSkill
- django-securitySkill
- django-tddSkill
- django-verificationSkill
- eval-harnessSkill
- executing-plansSkill
- extract-patternsSkill
- finishing-a-development-branchSkill
- flutter-patternsSkill
- flutter-verificationSkill
- frontend-designSkill
- frontend-patternsSkill
- golang-patternsSkill
- golang-testingSkill
- iterative-retrievalSkill
- java-coding-standardsSkill
- jpa-patternsSkill
- logging-best-practicesSkill
- postgres-patternsSkill
- python-patternsSkill
- python-testingSkill
- rails-patternsSkill
- rails-securitySkill
- rails-tddSkill
- rails-verificationSkill
- receiving-code-reviewSkill
- requesting-code-reviewSkill
- ruby-patternsSkill
- ruby-testingSkill
- security-reviewSkill
- security-scanSkill
- skill-stocktakeSkill
- springboot-patternsSkill
- springboot-securitySkill
- springboot-tddSkill
- springboot-verificationSkill
- strategic-compactSkill
- subagent-driven-developmentSkill
- systematic-debuggingSkill
- test-driven-developmentSkill
- using-git-worktreesSkill
- using-sp-eccSkill
- verification-before-completionSkill
- verification-loopSkill
- writing-plansSkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
4
Distinctive
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
- Distinctive: line 21
Use Opus ONLY for:
- Distinctive: line 129
When given a complex task, decompose it:
- Distinctive: line 171
Default to Sonnet: when uncertain—it handles most tasks well at moderate cost.
- Distinctive: line 175
Avoid these costly mistakes:
“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Model Routing
Route tasks to the most cost-effective model while maintaining quality.
Model Tiers
| Tier | Model | Cost | Use For |
| Opus | claude-opus-4-6 | $$$ | Complex reasoning, architecture, planning |
| Sonnet | claude-sonnet-4-6 | $$ | Implementation, code execution, debugging |
| Haiku | claude-haiku-4-5 | $ | Simple edits, docs, formatting, boilerplate |
Task Classification
Opus Tasks (Think/Plan)
Use Opus ONLY for:
- System architecture and design decisions
- Complex algorithm design
- Multi-file refactoring strategy
- Complex bugs (see criteria below)
- Security vulnerability analysis
- Performance optimization planning
- Code review requiring deep reasoning
- Breaking down ambiguous requirements
Sonnet Tasks (Execute/Build)
Use Sonnet for:
- Writing new functions/classes/modules
- Implementing planned features
- Most debugging (start here, escalate if stuck)
- Writing tests
- Code refactoring (executing a plan)
- API integrations
- Database queries and migrations
- Most day-to-day coding work
Bug Complexity Decision
Default to Sonnet for bugs. Escalate to Opus only when needed.
Quick Bug Scoring
Count these complexity signals (+1 each):
| Signal | Example |
| Multi-file | Spans 3+ files/services |
| No stack trace | No clear error location |
| Intermittent | Doesn't always reproduce |
| Concurrency | Race conditions, async issues |
| State-dependent | Needs specific event sequence |
| Performance | Memory leak, CPU spike |
Scoring:
- 0-1 → Sonnet
- 2-3 → Sonnet first, escalate if stuck after 2-3 attempts
- 4+ → Opus
Escalation Rule
Escalate to Opus when ANY trigger fires:
| Trigger | Threshold |
| Failed fixes | ≥3 attempts didn't resolve |
| Circular investigation | Revisiting same files 2+ times |
| Scope expansion | Started with 1-2 files, now 5+ |
| Hypotheses disproven | 3+ theories tested and failed |
| Mystery fix | Fixed it but don't know why |
| Complexity discovered | Found race condition/state issue |
Self-check after each attempt:
Fixes tried: [N] | Files touched: [N] | Confidence: [H/M/L]
If confidence=LOW and fixes≥2 → OpusHaiku Tasks (Simple/Apply)
Use Haiku for:
- Adding/updating comments and docstrings
- Formatting and linting fixes
- Renaming variables/functions
- Simple boilerplate generation
- Applying documentation templates
- Repetitive mechanical changes
- Copy-paste adaptations
- Import statement organization
- Simple find-and-replace operations
- Generating standard config files
Decision Flow
┌─────────────────────────────────────┐
│ Incoming Task │
└──────────────┬──────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Does it require deep reasoning, │
│ planning, or architecture? │
└──────────────┬──────────────────────┘
│
Yes │ No
┌─────────┴─────────┐
▼ ▼
┌─────────┐ ┌─────────────────────┐
│ OPUS │ │ Is it mechanical, │
│ (Plan) │ │ repetitive, or │
└─────────┘ │ documentation-only? │
└──────────┬──────────┘
│
Yes │ No
┌─────────┴─────────┐
▼ ▼
┌─────────┐ ┌─────────┐
│ HAIKU │ │ SONNET │
│ (Apply) │ │ (Build) │
└─────────┘ └─────────┘Implementation Pattern
When given a complex task, decompose it:
1. OPUS PHASE: Analyze and plan
- Understand requirements
- Use brainstorm skill if needed to be fully aligned with the user
- Design architecture
- Create implementation steps
- Identify edge cases
2. SONNET PHASE: Execute the plan
- Write core logic
- Review code, return to previous step if found issue
- Implement features
- Review again, return to previous step if found issue, or to Write core logic if needed. make it a loop until the reviews are passed successfuly
- Write tests
- Debug issues
- again, final review
3. HAIKU PHASE: Polish and finalize
- Add docstrings
- Format code
- Update README
- Apply boilerplateCost Savings Examples
| Task | Without Routing | With Routing | Savings |
| Plan + Build feature | All Opus | Opus→Sonnet | ~60% |
| Build + Document | All Opus | Sonnet→Haiku | ~80% |
| Full workflow | All Opus | Opus→Sonnet→Haiku | ~70% |
Quick Reference
Ask yourself:
- "Do I need to THINK deeply?" → Opus
- "Do I need to BUILD something?" → Sonnet
- "Do I need to APPLY changes mechanically?" → Haiku
Default to Sonnet when uncertain—it handles most tasks well at moderate cost.
Anti-Patterns
Avoid these costly mistakes:
- ❌ Using Opus for simple code formatting
- ❌ Using Opus to add docstrings
- ❌ Using Sonnet for mechanical find-replace
- ❌ Using Haiku for complex debugging
- ❌ Using Haiku to design architecture
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
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.

