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.
View on GitHubBlockchain-Oracle/smart-router
smart-router
skills/smart-router/SKILL.md
January 21, 2026
Select agents to install to:
npx add-skill https://github.com/Blockchain-Oracle/smart-router/blob/main/skills/smart-router/SKILL.md -a claude-code --skill smart-routerInstallation paths:
.claude/skills/smart-router/# Smart Router: Context-Aware Tool Selection
## Overview
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.
## When This Skill Activates
Use this skill when:
- routing-detector hook suggests "ACTION: Use smart-router skill"
- User has multiple tools for the same capability (3+ code review agents, 2+ brainstorming skills, etc.)
- User asks "which tool should I use?" or "what's best for this?"
- Multiple capabilities detected in a single request
**Do NOT use this skill when:**
- Only one tool is available (just use it)
- User explicitly named a specific tool/plugin
- No routing-detector suggestion appeared
## Process
### Step 0: Build/Update Registry (if needed)
**Registry location:** `.claude/.cache/agent-registry.json`
Before routing, ensure registry is current:
1. **Check if registry exists:**
- If `.claude/.cache/agent-registry.json` doesn't exist → rebuild required
- If exists → check hash for cache invalidation
2. **Hash-based cache invalidation:**
- Read `.claude/.cache/plugin-hash.txt`
- Compute new hash from plugin directories' modification times
- If hashes match → registry is current, skip rebuild
- If hashes differ → plugins changed, rebuild required
3. **If rebuild needed, scan all plugin sources:**
a. **Global plugins** (`~/.claude/plugins/cache/[marketplace]/[plugin]/[version]/`)
- Scan `agents/` directory → agent files (*.md)
- Scan `skills/` directory → skill subdirectories (*/SKILL.md)
- Scan `commands/` directory → command files (*.md)
b. **Local commands** (`.claude/commands/`)
- Recursively scan up to depth 10
- Skip symlinks (prevent circular references)
c. **Global MCPs** (`~/.claude.json` mcpServers field)
- Read MCP configuration
- Map kn