Refactor high-complexity React components in Dify frontend. Use when `pnpm analyze-component...
npx skills add TheSimpleApp/agent-skills --skill "auto-model"
Install specific skill from multi-skill repository
# Description
Automatic model selection based on task type. Routes planning to Opus, coding to Sonnet, simple tasks to Haiku. Optimizes cost and quality automatically.
# SKILL.md
name: auto-model
description: Automatic model selection based on task type. Routes planning to Opus, coding to Sonnet, simple tasks to Haiku. Optimizes cost and quality automatically.
license: MIT
metadata:
author: thesimpleapp
version: "1.0"
Auto Model Selection
Automatically route tasks to the optimal model based on complexity and type.
Model Hierarchy
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MODEL SELECTION β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β OPUS 4.5 (Reasoning) β
β βββ Planning & Architecture β
β βββ Complex debugging β
β βββ Multi-file refactoring β
β βββ Critical decision-making β
β β
β SONNET 4 (Balanced) β
β βββ Code generation β
β βββ Code review β
β βββ Feature implementation β
β βββ Documentation β
β β
β HAIKU (Fast) β
β βββ Simple edits β
β βββ Typo fixes β
β βββ Rename operations β
β βββ Quick questions β
β β
β GEMINI FLASH (Bulk) β
β βββ Research tasks β
β βββ Large file analysis β
β βββ Bulk operations β
β βββ High-volume queries β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Selection Rules
Use OPUS 4.5 When:
Task contains:
- "plan", "design", "architect", "strategy"
- "decide", "evaluate", "compare approaches"
- "debug complex", "trace issue", "root cause"
- "refactor entire", "restructure", "migrate"
- "security audit", "vulnerability assessment"
Scope:
- Touches 10+ files
- Affects core architecture
- Requires deep reasoning
- High-stakes decisions
Examples:
- "Plan the authentication system architecture"
- "Debug why the app crashes on startup"
- "Design the database schema for multi-tenancy"
- "Evaluate whether to use GraphQL or REST"
Use SONNET 4 When:
Task contains:
- "implement", "build", "create", "add"
- "fix", "update", "modify"
- "review", "analyze code"
- "write tests", "document"
Scope:
- 1-10 files
- Standard feature work
- Clear requirements
- Moderate complexity
Examples:
- "Implement the user profile page"
- "Add form validation to checkout"
- "Review this PR for issues"
- "Write unit tests for the auth service"
Use HAIKU When:
Task contains:
- "fix typo", "rename", "format"
- "simple", "quick", "minor"
- "update import", "change variable"
- "answer question about"
Scope:
- 1-2 files
- < 50 lines changed
- No logic changes
- Mechanical edits
Examples:
- "Fix the typo in README"
- "Rename userId to customerId"
- "Update the import path"
- "What does this function do?"
Use GEMINI FLASH When:
Task contains:
- "research", "explore", "find examples"
- "analyze all", "scan entire", "bulk"
- "summarize", "extract from"
- "compare many", "list all"
Scope:
- Read-only operations
- High token volume
- Research/exploration
- Cost-sensitive bulk work
Examples:
- "Research best practices for rate limiting"
- "Analyze all error handling in the codebase"
- "Find all TODO comments across the project"
- "Summarize the main patterns in this repo"
Detection Algorithm
def select_model(task: str, file_count: int, estimated_complexity: str):
# Opus triggers
opus_keywords = ["plan", "design", "architect", "strategy", "debug complex",
"refactor entire", "migrate", "security audit", "evaluate"]
if any(kw in task.lower() for kw in opus_keywords) or file_count > 10:
return "opus"
# Haiku triggers
haiku_keywords = ["typo", "rename", "format", "simple", "quick", "minor",
"update import", "change variable"]
if any(kw in task.lower() for kw in haiku_keywords) and file_count <= 2:
return "haiku"
# Gemini triggers
gemini_keywords = ["research", "explore", "find examples", "analyze all",
"scan entire", "bulk", "summarize", "list all"]
if any(kw in task.lower() for kw in gemini_keywords):
return "gemini-flash"
# Default to Sonnet
return "sonnet"
Claude Code Integration
In Claude Code, use the --model flag or configure defaults:
# Override for specific task
claude --model opus "Plan the new authentication architecture"
# Use default selection
claude "Implement the login form" # Auto-selects Sonnet
Settings Configuration
// ~/.config/claude-code/settings.json
{
"defaultModel": "sonnet",
"modelRules": {
"planning": "opus",
"coding": "sonnet",
"simple": "haiku",
"research": "gemini-flash"
},
"autoSelect": true
}
Cost Optimization
| Model | Relative Cost | Use For |
|---|---|---|
| Opus 4.5 | $$$$$ | 5% of tasks (critical) |
| Sonnet 4 | $$$ | 70% of tasks (standard) |
| Haiku | $ | 15% of tasks (simple) |
| Gemini Flash | $ | 10% of tasks (bulk) |
Monthly Estimate (Heavy Usage)
Without auto-selection: ~$500/month (all Opus)
With auto-selection: ~$150/month (optimized mix)
Override Patterns
Force a specific model when auto-selection isn't optimal:
"Use Opus for this: [task]" β Forces Opus
"Quick task: [task]" β Forces Haiku
"Research: [task]" β Forces Gemini Flash
"[task]" β Auto-select
Subagent Model Assignment
When spawning parallel agents:
Main Orchestrator: Opus (planning, coordination)
Feature Agents: Sonnet (implementation)
Test Agents: Sonnet (test writing)
Doc Agents: Haiku (documentation updates)
Research Agents: Gemini Flash (codebase scanning)
Monitoring
Track model usage to optimize over time:
Task: "Implement user dashboard"
Selected: Sonnet 4
Reason: "implement" keyword, 5 files, standard complexity
Result: Success
Time: 45 seconds
Integration with Other Skills
/auto-model β Model selection rules
β
/parallel-swarm β Assigns models to agents
β
/orchestrator β Routes tasks with optimal models
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.