Choose appropriate model for custom agent tasks. Use when selecting between Haiku, Sonnet, and Opus for agents, optimizing cost vs quality tradeoffs, or matching model capability to task complexity.
Selects optimal Claude models (Haiku/Sonnet/Opus) for custom agent tasks based on complexity, cost, and latency requirements. Triggers when designing agents or optimizing performance, providing decision trees and configuration examples for cost-quality tradeoffs.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install google-ecosystem@melodic-softwareThis skill is limited to using the following tools:
Choose the right model for custom agent tasks based on complexity, cost, and performance requirements.
Guide selection of appropriate Claude model (Haiku, Sonnet, Opus) for custom agent tasks to optimize cost, speed, and quality.
| Model | Speed | Cost | Quality | Use Case |
|---|---|---|---|---|
| Haiku | Fastest | Lowest | Good | Simple tasks, high volume |
| Sonnet | Fast | Medium | Very Good | Most tasks, balanced |
| Opus | Slowest | Highest | Best | Complex reasoning |
START
│
├── Is task simple transformation?
│ └── YES → Haiku
│
├── Is cost the primary concern?
│ └── YES → Haiku (if adequate) or Sonnet
│
├── Is quality critical (no room for error)?
│ └── YES → Opus
│
├── Does task require complex reasoning?
│ └── YES → Opus
│
├── Is latency critical (real-time)?
│ └── YES → Haiku
│
└── DEFAULT → Sonnet (best balance)
Best for:
# Haiku examples
model="claude-3-5-haiku-20241022"
# Echo agent - simple transformation
# Calculator - straightforward math
# Stream processor - high volume, low complexity
Best for:
# Sonnet examples
model="claude-sonnet-4-20250514"
# QA agent - codebase analysis
# Builder agent - code implementation
# General-purpose agents
Best for:
# Opus examples
model="claude-opus-4-20250514"
# Planner agent - strategic decisions
# Reviewer agent - critical validation
# Architect agent - system design
| Model | Input Tokens | Output Tokens | Relative Cost |
|---|---|---|---|
| Haiku | Low | Low | 1x |
| Sonnet | Medium | Medium | ~10x |
| Opus | High | High | ~30x |
ResultMessage.total_cost_usd# Cost tracking
async for message in client.receive_response():
if isinstance(message, ResultMessage):
print(f"Query cost: ${message.total_cost_usd:.6f}")
| Model | First Token | Total Time | Throughput |
|---|---|---|---|
| Haiku | ~500ms | Fast | Highest |
| Sonnet | ~1s | Medium | Good |
| Opus | ~2s | Slower | Lower |
| Capability | Haiku | Sonnet | Opus |
|---|---|---|---|
| Simple reasoning | ✓ | ✓ | ✓ |
| Code generation | Limited | Good | Excellent |
| Complex planning | Poor | Good | Excellent |
| Multi-step reasoning | Limited | Good | Excellent |
| Novel problems | Poor | Adequate | Excellent |
# Tier 1: Haiku for classification
classification = await classify_task(task, model="haiku")
# Tier 2: Route to appropriate model
if classification == "simple":
result = await process(task, model="haiku")
elif classification == "complex":
result = await process(task, model="opus")
else:
result = await process(task, model="sonnet")
# Planner: Opus for strategic decisions
planner_options = ClaudeAgentOptions(
model="claude-opus-4-20250514"
)
# Builder: Sonnet for implementation
builder_options = ClaudeAgentOptions(
model="claude-sonnet-4-20250514"
)
# Reviewer: Opus for critical review
reviewer_options = ClaudeAgentOptions(
model="claude-opus-4-20250514"
)
When recommending model selection:
## Model Selection
**Task:** [description]
**Recommended Model:** [Haiku/Sonnet/Opus]
### Decision Factors
| Factor | Weight | Assessment |
| --- | --- | --- |
| Complexity | [H/M/L] | [assessment] |
| Cost sensitivity | [H/M/L] | [assessment] |
| Quality requirement | [H/M/L] | [assessment] |
| Latency requirement | [H/M/L] | [assessment] |
### Rationale
[Why this model is appropriate]
### Alternatives
- If cost is concern: [alternative]
- If quality is critical: [alternative]
### Configuration
options = ClaudeAgentOptions( model="[model-id]", ... )
"Choose wisely: Claude Haiku for simple, fast tasks. Claude Sonnet for balanced performance. Claude Opus for complex reasoning."
Model selection directly impacts:
Date: 2025-12-26 Model: claude-opus-4-5-20251101
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.