Use when multiple tools are available for a task and intelligent routing is needed. Activates when routing-detector hook suggests it, or when user asks "which tool should I use" or "what's the best plugin for this". Provides context-aware tool ranking based on file context, user preferences, and tool specialization.
This skill inherits all available tools. When active, it can use any tool Claude has access to.
When multiple plugins can handle the same task, smart routing ensures the best tool is selected based on context and user preferences. This skill loads the agent registry, analyzes the current situation, ranks available tools, and either auto-routes or presents ranked options.
Use this skill when:
Do NOT use this skill when:
Read the agent registry and user preferences:
# Registry location (auto-generated by SessionStart hook)
.claude/.cache/agent-registry.json
# User preferences (if exists)
.claude/smart-router.local.md
Registry structure:
{
"capabilities": {
"code-review": [
{
"plugin": "superpowers",
"type": "skill",
"entry": "skills/code-reviewer/SKILL.md",
"description": "...",
"source": "global"
}
]
}
}
Settings structure:
---
routingMode: auto # auto | ask | context
showReasoning: true # Show why tool was chosen
excludePlugins: # Plugins to ignore
- plugin-name
priorityOrder: # Override default ranking
- superpowers
- pr-review-toolkit
---
Based on user prompt, determine which capabilities are needed. The routing-detector hook already identified these, but validate:
Common capabilities:
code-review - Code review, PR review, code qualitybrainstorming - Design, ideation, planning, architecturetesting - Test generation, QA, test coveragedebugging - Debug, troubleshoot, fix bugsrefactoring - Code cleanup, reorganizationgame-development - Game mechanics, Unity/Unreal/Godotbackend-development - APIs, microservices, backendfrontend-development - UI, React, componentsconversation-search - Search past conversations, memoryFrom registry, collect all tools matching the identified capabilities.
Filter out:
excludePlugins settingRank tools using this priority order:
1. User Priority Order (Highest Priority)
If settings define priorityOrder, respect it first - user knows their workflow best:
priorityOrder:
- superpowers
- pr-review-toolkit
- feature-dev
Example: If user set superpowers first, always prefer superpowers tools when available.
2. Tool Specialty (High Priority)
From description field, prefer specialized tools:
Example: pr-review-toolkit (specialized for PR review) ranks higher than generic code reviewer, even if working on game files.
Why specialty matters: Specialized tools exist because they're better at specific tasks. Don't override specialty based on file context alone.
3. File Context (Medium Priority)
Analyze files in current directory and recently modified files:
# Check file types
*.cs, *.unity, *.prefab → Prefer game-development tools
*.tsx, *.jsx, *.css → Prefer frontend tools
*.py, *.go, *.ts (backend) → Prefer backend tools
*.test.ts, *.spec.js → Prefer testing tools
Example: When choosing between two game-dev tools with equal specialty, prefer the one matching file context.
4. Tool Type (Low Priority)
When tied, prefer in this order:
5. Alphabetical (Tie-Breaker)
If still tied, sort alphabetically by plugin name.
Read routingMode from settings (default: context):
autoAutomatically select the top-ranked tool and use it directly. No questions, no menu.
Output:
🎯 Smart Router: Auto-routing to [plugin-name]
Reason: [Brief explanation of why this tool was chosen]
[Proceeding with the task using this tool...]
Then: Use the Skill tool or invoke the agent/command directly.
askPresent ranked options as a numbered menu, let user choose.
Output:
🎯 Smart Router: Multiple Tools Available
Based on your task and context, here are your options (ranked):
1. ⭐ superpowers:code-reviewer (RECOMMENDED)
Type: Skill
Why: General purpose, matches your file context (TypeScript backend)
Description: Comprehensive code review with TDD focus
2. pr-review-toolkit:code-reviewer
Type: Agent
Why: Specialized for PR review workflows
Description: Multi-aspect PR analysis (comments, tests, errors)
3. feature-dev:code-reviewer
Type: Agent
Why: Feature branch focused
Description: Reviews feature branches before merge
Which tool would you like to use? (1-3)
Then: Wait for user response and use selected tool.
contextUse file context to make automatic decision, but show brief reasoning:
Output:
🎯 Smart Router: Context-aware routing
Detected context: TypeScript backend API files
Routing to: pr-review-toolkit:code-reviewer
Reason: Specialized for API code review
[Proceeding...]
Then: Use the selected tool.
Once tool is selected, invoke it using the appropriate method:
For Skills:
Skill tool: plugin-name:skill-name
For Agents:
Task tool (subagent_type): plugin-name:agent-name
For Commands:
/plugin-name:command-name
For Workflows (local):
SlashCommand: /path/to/workflow.md
When user request spans multiple capabilities (e.g., "build a game with backend API"):
If git3/parallel agent skills are available:
🎯 Smart Router: Multi-Capability Detected
Your request requires:
- game-development (bmad:game-dev)
- backend-development (backend-api-dev)
RECOMMENDATION: Use parallel agent dispatch
Would you like to:
1. Use git3 to run both specialized agents concurrently (RECOMMENDED)
2. Pick one primary tool to handle both
3. Handle them sequentially
[Explain git3 workflow if user chooses option 1]
If no parallel dispatch available, pick the primary capability:
🎯 Smart Router: Multi-Capability Request
Detected needs: game-development + backend-development
Primary capability: game-development (more specialized)
Routing to: bmad:game-dev
Note: This tool can handle backend API as well, though it's primarily game-focused.
Create .claude/smart-router.local.md in your project:
---
# Routing behavior
routingMode: auto # auto | ask | context
# auto - Always pick best automatically (fastest)
# ask - Always show menu (most control)
# context - Use file context to decide automatically (balanced)
# Display options
showReasoning: true # Show why tool was chosen
# Exclusions
excludePlugins: # Never suggest these plugins
- ralph-wiggum # Example: exclude test plugin
- old-plugin
# Priority overrides
priorityOrder: # Prefer these plugins (in order)
- superpowers # Always try superpowers first
- pr-review-toolkit # Then pr-review-toolkit
- bmad # Then BMAD tools
# Context overrides (advanced)
contextRules:
- filePattern: "*.unity"
preferPlugins: ["bmad"]
- filePattern: "*.test.ts"
preferPlugins: ["superpowers"]
---
Registry not found:
/smart-router:rebuild to force rebuild.claude/.cache/agent-registry.json existsWrong tool selected:
priorityOrder in settingsask mode to see all optionsNo tools suggested:
~/.claude/plugins/)Multiple specialists for same task:
priorityOrder to set preferenceexcludePlugins to remove unwanted optionsUser: "Review this PR"
Settings: routingMode: auto
Process:
User: "Help me brainstorm this feature"
Settings: routingMode: ask
Process:
1. ⭐ superpowers:brainstorming (RECOMMENDED)
2. bmad:core-workflows:brainstorming
User: "Build a multiplayer game with real-time backend"
Process:
🎯 Multi-Capability Detected
RECOMMENDATION: Parallel agent dispatch
- bmad:game-dev → Game mechanics
- backend-api-dev → Real-time API
Both will work concurrently on separate branches.
Smart Router is designed to work alongside your existing tools, not replace them. It simply helps you discover and select the right tool when multiple options exist.
Key principle: If you already know which tool to use, use it directly. Smart Router is for discovery and decision-making when uncertain.
For more details on registry building and capability detection, see references/ directory.