home / skills / zpankz / mcp-skillset / agents-router

agents-router skill

/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-router

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.9 KB
---
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]
```

Overview

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.

How this skill works

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 to use it

  • Complex multi-step engineering tasks requiring decomposition or specialized skills
  • Codebase exploration or analysis for projects with many files (>20)
  • Research that needs web documentation, large-context analysis, or external investigation
  • Multi-domain workflows that must be coordinated across teams or systems
  • Long-running background jobs like deep static analysis or large-scale indexing

Best practices

  • Provide explicit context: files affected, domains, and desired thoroughness to improve routing accuracy
  • If tasks depend on each other, mark them sequential to preserve ordering and context handoff
  • Use parallel agents only for independent subtasks to reduce latency
  • Flag long-running jobs with run_in_background=true and poll TaskOutput for results
  • Prefer explicit agent requests when you need a specific capability (e.g., claude-code-guide for Claude-specific docs)

Example use cases

  • Find all occurrences of a pattern across a large repo: Explore (quick) or gemini for deep context
  • Design system architecture from a PRD: architect for decomposition, Plan for implementation mapping
  • Investigate a multi-service production bug: orchestrator to coordinate researcher, engineer, and Explore agents
  • Perform a large code review across many files: spawn multiple code-review agents in parallel with TaskOutput aggregation
  • Execute a research-to-implementation flow: researcher → Plan → engineer sequential pipeline

FAQ

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.