Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

task-complexity-router

FreeNo executable scriptsNot checked

Complexity-based task routing for optimal model selection and cost efficiency. Use when deciding which model tier to use, analyzing task complexity…

MadAppGangby MadAppGang★ 290 GitHub stars

About this skill

Task Complexity Router

Version: 1.0.0 Purpose: Intelligent task routing to optimal model tiers for cost efficiency and performance Status: Production Ready

Overview

Task complexity routing is the practice of matching tasks to appropriate model tiers based on complexity, urgency, and resource requirements. Instead of using expensive premium models for all tasks, routing directs simple tasks to fast/cheap models and reserves expensive models for complex work.

This skill provides battle-tested patterns for:

  • 4-tier routing system (Native Tools → Haiku → Sonnet → Opus)
  • Complexity detection heuristics (keyword-based + context-based)
  • Cost optimization strategies (save 60-90% on API costs)
  • Dynamic tier escalation (upgrade when task stalls or fails)
  • Routing integration (works with multi-agent-coordination, quality-gates, proxy-mode)

Well-designed routing can reduce AI costs by 60-90% while maintaining quality, since 70% of tasks can be handled by faster, cheaper models.

Why Task Routing Matters

Cost Comparison (per 1M tokens)

Model Tier Model Example Cost (Input/Output) Speed Use Case
Tier 0 Native Tools $0 Instant File operations, searches, formatting
Tier 1 Claude Haiku 4.5 $0.80 / $4.00 Fast Simple edits, docs, straightforward tasks
Tier 2 Claude Sonnet 4.5 $3.00 / $15.00 Moderate Standard dev, multi-file changes
Tier 3 Claude Opus 4.5 $15.00 / $75.00 Slower Architecture, complex debugging, audits

Example Cost Savings:

Scenario: 100 tasks per day (mix of simple and complex)

Without Routing (all Sonnet):
  100 tasks × 1000 tokens avg × $0.015 = $1.50/day
  Annual: $547.50

With Smart Routing:
  50 tasks (native tools) × $0 = $0
  30 tasks (Haiku) × $0.004 = $0.12
  15 tasks (Sonnet) × $0.015 = $0.22
  5 tasks (Opus) × $0.075 = $0.37
  Total: $0.71/day
  Annual: $259.15

Savings: $288.35/year (52% reduction) for single developer

Performance Benefits

Beyond cost savings, routing improves:

  • Speed: Fast models return results in 1-2s vs 10-15s for premium
  • Throughput: Process 5x more simple tasks in parallel
  • Resource efficiency: Save premium model quota for critical tasks
  • User experience: Instant results for simple operations

The 4-Tier Routing System

Tier 0: Native Tools (No LLM)

When to Use:

  • File operations (search, rename, move, copy)
  • Content search (grep, regex)
  • Code formatting (prettier, black, go fmt)
  • Git operations (status, log, diff)
  • Single-file edits with clear pattern

Indicators:

  • Keywords: "find", "search", "format", "rename", "list", "show"
  • Patterns: Single regex, exact string replacement, file path operations

Cost: $0 Speed: Instant (< 0.1s)

Examples:

✓ "Find all .tsx files in src/"
✓ "Search for 'TODO' comments"
✓ "Format code with prettier"
✓ "Rename Button.js to Button.tsx"
✓ "Show git status"
✓ "Replace 'oldName' with 'newName' in file.ts"

Implementation:

Task: "Find all TypeScript files"
→ Use Glob tool: *.ts
→ No LLM needed

Task: "Search for API endpoints"
→ Use Grep tool: "app\.(get|post|put|delete)"
→ No LLM needed

Task: "Format all code"
→ Use Bash: bun run format
→ No LLM needed

Tier 1: Fast Model (Haiku)

When to Use:

  • Simple code changes (add comment, fix typo, rename variable)
  • Documentation updates (README, JSDoc, inline comments)
  • Straightforward bug fixes (missing import, syntax error)
  • Code explanation (what does this function do?)
  • Simple test writing (unit test for pure function)

Indicators:

  • Keywords: "simple", "basic", "small", "quick", "minor", "add", "fix", "update"
  • Scope: Single file, < 50 lines changed
  • Complexity: No architectural decisions, clear solution

Cost: ~$0.0004 per task (1000 tokens) Speed: Fast (1-3s response time)

Examples:

✓ "Add JSDoc comment to calculateTotal function"
✓ "Fix typo in error message"
✓ "Rename getUserData to fetchUserData"
✓ "Update README with new installation steps"
✓ "Add missing import statement"
✓ "Write unit test for add(a, b) function"

Anti-Patterns (Don't Use Haiku For):

✗ "Design authentication system" (needs Opus)
✗ "Refactor entire codebase" (needs Sonnet + context)
✗ "Debug complex race condition" (needs Opus)
✗ "Architect database schema" (needs Opus)

Tier 2: Standard Model (Sonnet)

When to Use:

  • Standard feature implementation (new component, API endpoint)
  • Multi-file refactoring (rename class, extract service)
  • Integration tasks (connect frontend to backend)
  • Moderate bug fixes (logic errors, edge cases)
  • Test suites (integration tests, E2E tests)

Indicators:

  • Keywords: "implement", "create", "build", "refactor", "integrate", "develop"
  • Scope: 2-10 files, 50-500 lines changed
  • Complexity: Requires understanding context, mod
Full SKILL.md on GitHub

Install task-complexity-router in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the task-complexity-router skill do?

Complexity-based task routing for optimal model selection and cost efficiency. Use when deciding which model tier to use, analyzing task complexity, optimizing API costs, or implementing tiered routing. Trigger keywords - "routing", "complexity", "model selection", "tier", "cost optimization", "haiku", "sonnet", "opus", "task analysis".

How do I install the task-complexity-router skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the task-complexity-router skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare task-complexity-router with