home / skills / zpankz / mcp-skillset / agents-router
This skill routes tasks to the appropriate Task tool subagents for parallel or specialized execution, accelerating complex workflows.
npx playbooks add skill zpankz/mcp-skillset --skill agents-routerReview the files below or copy the command above to add this skill to your agents.
---
name: agents-router
description: Routes tasks to appropriate Task tool agents (subagents). Triggers on complex multi-step tasks, research, code review, exploration, or any task benefiting from specialized agent execution. Matches intent to agent types.
---
# Agents Router
Routes tasks to appropriate Task tool subagent types for parallel or specialized execution.
## Available Agent Types
| Agent | Purpose | Best For |
|:------|:--------|:---------|
| **general-purpose** | Multi-step research | Complex questions, code search |
| **Explore** | Codebase exploration | Find files, understand patterns |
| **Plan** | Implementation planning | Architecture, strategy |
| **claude-code-guide** | Claude Code help | Feature questions, how-to |
| **orchestrator** | Multi-domain coordination | Complex multi-agent workflows |
| **strategy-analyzer** | Deep strategic analysis | Refactoring, optimization |
| **architect** | Recursive decomposition | Complex system design |
| **gemini** | Long context analysis | Large codebases, multi-file bugs |
| **researcher** | Web research | Finding answers, investigating |
| **engineer** | Professional implementation | PRD execution, debugging |
## Trigger Conditions
Activate when task involves:
- Complex multi-step operations
- Research requiring web/documentation search
- Code review or analysis
- Codebase exploration (files > 20)
- Multi-domain tasks (domains > 2)
- Long-running background operations
## Routing Logic
```yaml
# Complexity scoring
complexity_factors:
files_affected: weight 0.3
domains_involved: weight 0.25
steps_required: weight 0.25
research_needed: weight 0.2
# Thresholds
spawn_agent_if:
complexity >= 0.7 OR
files > 20 OR
domains > 2 OR
explicit_request
```
## Decision Tree
```
Task Complexity Assessment
│
├── Exploration needed?
│ ├── Quick search? → Explore (quick)
│ ├── Pattern finding? → Explore (medium)
│ └── Deep analysis? → Explore (very thorough)
│
├── Implementation?
│ ├── From PRD? → engineer
│ ├── Architecture? → architect
│ └── Strategy? → strategy-analyzer
│
├── Research?
│ ├── Web search? → researcher
│ ├── Claude Code docs? → claude-code-guide
│ └── Codebase context? → gemini
│
├── Multi-domain?
│ └── orchestrator
│
└── Code review?
└── superpowers:code-reviewer (via skill)
```
## Agent Selection Matrix
| Task Type | Primary Agent | Alternatives |
|:----------|:--------------|:-------------|
| Find files by pattern | Explore | general-purpose |
| Search code for keyword | Explore | gemini |
| Plan implementation | Plan | architect |
| Deep strategic analysis | strategy-analyzer | architect |
| Large codebase analysis | gemini | Explore |
| Web research | researcher | general-purpose |
| Multi-agent coordination | orchestrator | general-purpose |
| PRD implementation | engineer | general-purpose |
| Claude Code help | claude-code-guide | - |
## Usage Patterns
### Parallel Agents
When tasks are independent:
```
Task tool (agent1) + Task tool (agent2) in parallel
```
### Sequential Agents
When tasks depend on each other:
```
Task tool (research) → Task tool (implement)
```
### Background Agents
For long-running tasks:
```
Task tool with run_in_background=true
→ TaskOutput to retrieve results
```
## Integration
- **Task tool**: Primary agent spawning
- **TaskOutput**: Result retrieval
- **orchestrator agent**: Multi-agent coordination
- **meta-router**: Parent routing
## Quick Reference
```yaml
# Quick codebase search
agent: Explore
thoroughness: quick
# Deep implementation planning
agent: Plan
complexity: high
# Large codebase bug
agent: gemini
context: 2M tokens
# Professional implementation
agent: engineer
from: PRD
# Multi-domain coordination
agent: orchestrator
domains: [frontend, backend, database]
```
This skill routes tasks to the most appropriate Task tool subagents to enable parallel, sequential, or background execution. It detects complex, multi-step, research, code review, and multi-domain work and matches intent to specialized agent types for faster, higher-quality outcomes. It is built for JavaScript-based integrations and focuses on practical routing logic.
The router assesses task complexity using signals like files affected, domains involved, steps required, and whether external research is needed. It applies thresholds to decide when to spawn dedicated subagents and selects agent types (Explore, engineer, gemini, orchestrator, etc.) based on a decision tree and selection matrix. It supports parallel, sequential, and background execution patterns and returns TaskOutput for result retrieval.
When will the router spawn a subagent instead of handling the task itself?
It spawns when computed complexity >= 0.7, files > 20, domains > 2, or when explicitly requested. Complexity uses weighted factors: files, domains, steps, and research need.
How do I run long-running analyses?
Mark the task run_in_background=true so a background agent executes the job and produces a TaskOutput you can poll to retrieve results.