task-complexity-router
БесплатноБез исполняемых скриптовНе проверенComplexity-based task routing for optimal model selection and cost efficiency. Use when deciding which model tier to use, analyzing task complexity…
от MadAppGang★ 290 звёзд на GitHubОб этом скилле
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
Установить task-complexity-router в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл task-complexity-router?
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".
Как установить скилл task-complexity-router?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл task-complexity-router запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic