skill-router

Your skill first, the process skill second, gates and memory on the card — before any tool fires.
A hook-driven router for Claude Code. It indexes every skill you have installed by when it applies, ranks them against each prompt in ~80 ms, asks a small model only when the ranking is unsure, and injects a route card before Claude’s first action. Enforcement is tiered: hard where a wrong skill is expensive, soft everywhere else. The route follows every sub-agent you dispatch.
Live dashboard
See routing decisions, loaded skills, ignored suggestions and suggested next steps in one local view.

Watch or download the 11-second dashboard video (MP4).
The recording shows one local setup; its counts are observations, not a performance benchmark.
Run from the repository root:
python3 scripts/cli.py dashboard
Open http://127.0.0.1:8790. The dashboard reads local logs and refreshes as you work.
Optional model-based routing has its own data flow; see Jev and privacy.
> my macbook restarted again last night, can you check why
[skill-router] This is a BROKEN task — 2-step chain.
[skill-router] Chain: mac-doctor → superpowers:systematic-debugging
[skill-router] Invoke step 1/2 now:
▶ mac-doctor (inherit, in-session)
▶ superpowers:systematic-debugging (inherit, in-session)
[skill-router] Memory: mac_crash_root_cause (read from ~/.claude/projects/.../memory/)
[skill-router] IRON RULE: call Skill(skill="mac-doctor") before any Edit/Write/Task.
Every line is [skill-router]-prefixed, so grep '\[skill-router\]' on a transcript shows exactly what was routed.
Why (v4, September 2026)
An audit of this machine after five months of use:
| Finding |
Number |
| Skills installed / ever invoked / invoked last month |
291 / 80 / 32 |
| Tokens the skill listing cost every session start |
~22,600 |
| Skills the v3 routing table could name |
~20 (all process skills) |
| Real prompts the v3 router answered with silence |
4 of 10 |
writing-plans announced / followed |
6 / 1 |
| Months routing was dead without anyone noticing |
2 |
The routing table could never enumerate the domain skills — they change weekly — and hard-blocking edits on a process skill the model does not value produced workarounds, not compliance. v4 replaces the table with an index, and replaces uniform enforcement with tiers. Full evidence and design: docs/v4-design.md.
How it decides
prompt ──► project route (SKILL.personal.md) deterministic, wins outright
──► Jev over the whole index (jev_choose.py) ~0.4 s, two Choice questions, no pre-filter;
≥ 0.8 route · below: silent (0.5–0.8 suggestion line is opt-in)
──► on Jev failure / 1.2 s timeout:
enriched index rank (skill_index.json) ~80 ms, name · use_when · keywords · project aliases
small-model tie-break (Gemini Flash-Lite) only below 35 % margin, ~1 s, cached
──► path (BROKEN / BUILD / OPERATE) + process leg from the table
──► route card: domain skill · process skill · gates · memory · tier
- Index.
build_index.py reads every invokable SKILL.md, extracts “use when” triggers and keywords, and a one-time small-model pass adds more — cached per file hash, so the bill grows only when a skill changes. Third-party skill files are never edited.
- Routing descriptions.
references/routing-descriptions.json supplies concise, source-hash-pinned summaries and reviewed kind corrections after index enrichment. Upstream skill files stay intact. Rebuilds skip stale rules with warnings; all skills remain available. The JEV confidence threshold remains 0.8.
- Projects. A
projects: block maps names to skills, memory files and completion gates. “push deenunlock to testflight” no longer lands on the scrollbook deploy skill because both ship to TestFlight.
- Precision. A winner needs real evidence: a project hit, or a distinctive non-generic token in its name, triggers or keywords. “flow” alone never picks
ux-flow.
- Tiers. Hard (edit block until the skill loads) on the BROKEN path and on project routes with gates. Soft elsewhere: the Stop hook asks once, and the answer teaches the router.
- Sub-agents. A
PreToolUse hook on Task appends the parent’s route to every dispatched prompt; SubagentStart briefs the agent with its paired skills.
Pipeline detail: docs/how-it-works.md.
Jev: the one model on the hot path
Jev (jev-1.13.0, TypeSafe System One) is a chooser: it picks from options you give it and returns a confidence. It cannot write text, and its answers are opaque keys mapped back to skills the router already knows.
- Chooses the skill over your whole index in one ~0.4 s call. Routes only at confidence ≥ 0.8 (32 of 34 right in the author’s set); below that the router is silent.
- Chooses the model for sub-agents.
light work dispatches on Haiku, standard on Sonnet, heavy and unsure inherit your session model. An explicit model= always wins. The main session is never switched.
- Optional and fail-safe. No
TYPESAFE_API_KEY, SKILL_ROUTER_JEV=0, a 1.2 s timeout or any error falls back to local ranking. A slow API never blocks a prompt.
- Disclosed. With a key set, each uncached prompt (plus skill summaries) goes to
api.typesafe.ai, ~$0.0005. Nothing is sent without a key.
Full detail, data flow and knobs: docs/jev.md.
When nothing installed fits, the router can point at a popular, audit-screened skill from skills.sh, with install count and audit status on the line. Opt-in cache (python3 scripts/skills_sh_catalog.py), public pages only, no prompt data sent, never installs. Top skills per category: docs/skills-sh-top.md. Detail: docs/skills-sh.md.
Install
skill-router is a Claude Code plugin (it ships its own marketplace):
claude plugin marketplace add hussi9/skill-router
claude plugin install skill-router@skill-router
or inside a session: /plugin install skill-router --marketplace hussi9/skill-router.
Restart Claude Code (or run /reload-plugins). The hooks load from the plugin’s
hooks/hooks.json; nothing is written into settings.json. The catalog, index,
usage ranking and external-skill cache rebuild in the background at session start.
Working on the router itself? Point the marketplace at your checkout instead; a
marketplace added from a local path loads the plugin in place, so edits apply at
the next session start:
claude plugin marketplace add ~/devpro/skill-router
claude plugin install skill-router@skill-router
Optional, for Jev: export TYPESAFE_API_KEY=.... For the fallback small-model stage: put GEMINI_API_KEY (or ANTHROPIC_API_KEY) in the environment, or in Doppler (shared/prd) and let scripts/refresh_env.py cache it. Without a key the router is lexical-only and still routes.
Your project routes (SKILL.personal.md) live outside the plugin, at
~/.claude/skill-router/SKILL.personal.md, so plugin updates never touch them
($SKILL_ROUTER_PERSONAL_FILE overrides the path). Learned data stays where it
always was, in ~/.claude/skill_router_*.
Migrating from the symlink install (v2.3 and earlier)
The old install was a checkout symlinked to ~/.claude/skills/skill-router plus
hooks merged into ~/.claude/settings.json. Keeping both would run every hook
twice, so after installing the plugin:
cp ~/.claude/settings.json ~/.claude/settings.json.bak
mkdir -p ~/.claude/skill-router
cp ~/.claude/skills/skill-router/SKILL.personal.md ~/.claude/skill-router/ 2>/dev/null
python3 ~/.claude/skills/skill-router/scripts/install_hooks.py --remove # old hooks out of settings.json
rm ~/.claude/skills/skill-router # the symlink only, not its target
python3 "$(claude plugin list --json | python3 -c 'import json,sys;print(next(p["installPath"] for p in json.load(sys.stdin) if p["id"].startswith("skill-router@")))')/scripts/doctor.py"
doctor.py reports hooks wired once (plugin); if it finds router hooks left in
settings.json it says so. install_hooks.py refuses to add hooks while the
plugin is enabled. The legacy layout still works: the root SKILL.md is
generated from skills/skill-router/SKILL.md for it.
How discovery works
One route card, two layers:
- Your skills, ranked by your usage (
scripts/preference.py). Every Skill
call — from the router log, skill_usage.log, and an incremental backfill of
Claude Code transcripts (~/.claude/projects/**/*.jsonl, skill names and
timestamps only) — goes into ~/.claude/skill_router_usage.json. Score =
recency-weighted frequency (30-day half-life) × test outcomes after the skill
loaded, plus optional pins in ~/.claude/skill_router_prefs.json
({"pin": ["code-craft"], "demote": ["old-skill"], "boost": {"x": 0.5}}).
The ranker applies it as a tie-break worth at most ±8 % of a skill’s score, so
a clearly better match always wins. preference.py --show prints the ranking.
- Skills you do not have (
scripts/external_discovery.py). A background
SessionStart job refreshes the online catalogs weekly (antigravity, the
Anthropic marketplace mirror, the skills.sh leaderboard) and builds an offline
BM25 index of uninstalled skills, screened with risk heuristics adapted from
surenode-ai/skill-discovery
(environment dumps, bytecode loading, reviewer-directed prompt injection,
registry tampering, pipe-to-shell). On a work prompt where no installed domain
skill cleared the routing bar, and an uninstalled one scores clearly higher than
your best installed match, the card adds at most two Consider installing
lines with the source URL and install command. Jev-confirmed and project-route
cards never get one; risky candidates are never shown; a name is not repeated
within a session; nothing is ever installed automatically.
external_discovery.py "<prompt>" shows what would be suggested and why.
Housekeeping that uses the same data:
scripts/skill_safety.py --dupes — skill folders that are byte-identical across
~/.claude/skills, ~/.agents/skills, ~/.agent/skills, Cursor, Codex and other
agents’ folders (order-independent SHA-256 fingerprints). The catalog also marks
content-identical entries with duplicate_of.
scripts/listing_plan.py — Claude Code lists skill descriptions within a budget
(1 % of the context window; about 40,000 characters on a 1M-token model). With
hundreds of skills most descriptions are dropped. The plan keeps the router and
your most-used skills described and collapses the long tail to "name-only" via
skillOverrides (still invocable, still routed). It prints the plan by default;
--apply writes it after backing up settings.json.
Verify
python3 ~/.claude/skills/skill-router/scripts/doctor.py # legacy install
# plugin install: python3 <installPath>/scripts/doctor.py (see `claude plugin list --json`)
Twelve checks: hooks wired (plugin or settings.json, and not both), scripts present, no route names an uninstalled skill, catalog and index fresh, model stage status, sub-agent hand-off hook, no expired demotions, agents follow the session model, learned overlay fresh, smoke prompts routed. Then type any non-trivial task in a new session and look for [skill-router] before the first tool call.
A route looked wrong? See the ranking and why:
python3 ~/.claude/skills/skill-router/scripts/index_match.py --all "the prompt"
Measured
tests/calibration.py, 109 curated prompts, lexical stage only (Jev and the small model are off for determinism; cases whose expected skill is not installed on your machine are skipped and counted):
|
v3 (2026-09-07 morning) |
v4 |
| Path accuracy |
95.4 % |
99.1 % |
| Skill accuracy (when path correct) |
64.2 % |
100 % |
| Silent on 10 real prompts from one week |
4 |
0 |
| Lexical stage, end to end |
— |
80 ms |
SKILL.md loaded per invocation |
2,388 words |
483 words |
The calibration set is curated and encodes the author’s expectations; read 99.1 % as “the regressions are gone”, not as a field rate. The field number is the follow rate the learner computes over live sessions, baseline 17 % on writing-plans under v3.
Routing eval (v2.4)
python3 scripts/eval/run_eval.py sends 139 labelled prompts through the real hook in a
throwaway HOME and writes a markdown + JSON scorecard. It runs on every pull request.
The calibration above checks the triage path; this eval checks which skill the hook
shows. It is the harder number. Deterministic path only (Jev, the small model and the
embedder are off). The labels were written by an AI agent from skill descriptions and
have not been reviewed by a person yet. Details: scripts/eval/README.md.
Public fixture (309 public skills), before → after the v2.4 eval-driven fixes:
|
before (916c3d5) |
after |
| Routing top-1 (first skill the hook shows is right) |
43.0 % |
55.1 % |
| Routing top-3 |
46.7 % |
59.8 % |
| Silent although an installed skill fits |
34.6 % |
15.0 % |
| Silent on chat and questions |
93.8 % |
100 % |
| “Consider installing” when an installed skill fits (false) |
12.1 % |
3.7 % |
| “Consider installing” precision |
37.5 % |
57.1 % |
| “Consider installing” useful when nothing installed fits |
56.2 % |
50.0 % |
| Hook latency p50 / p95 |
80 / 90 ms |
82 / 90 ms |
Layer 1 (usage preference) moves routing top-1 by under one point either way
(55.1 % on vs 54.2 % off here; 36.4 % vs 37.0 % on the author’s live setup), which is
what a bounded tie-breaker should do. The ranker alone has the right skill in its top three
81 % of the time, so the card logic, not the index, is where the next gains are.
Scorecards: before, after.
Customize
- Project routes and projects —
SKILL.personal.md: routes: (name → skill, tier, gates) and projects: (aliases, skills, memory files, gates). Prove a route fires: python3 scripts/router.py <<< "your prompt".
- Agent pairings —
agent_skills.json, validated against the index at brief time.
- Synonyms and phrases —
scripts/index_match.py (SYNONYMS, PHRASES, GENERIC).
- Escape hatches — the user writes
[no-router]; the model runs scripts/router_override.py "<reason>" --session-id "<current session id>".
docs/customizing.md has the long form.
It learns
scripts/learn.py regenerates ~/.claude/skill_router_learned.json every session start — never the repo, never your personal file:
| Learned |
Surfaces as |
| Follow rates (announced vs invoked, joined by prompt id) |
skills you routinely ignore stop leading routes |
| Keyword → skill triggers |
Learned from your history: prompts with testflight usually use scrollbook-deploy |
| Handovers and chains |
After writing-plans you usually run test-driven-development |
| Soft-skips per skill (v4) |
demotion signal for soft routes |
| Skills unused for 90 days (v4) |
the next archive pass |
Prompt keywords are logged, never prompt text. SKILL_ROUTER_NO_LEARN=1 logs nothing. Details: docs/self-improvement.md.
Common questions
Will this slow Claude Code down? The lexical stage is ~80 ms. The model stage fires on low-confidence prompts only, ~1 s, cached by prompt hash. Hook timeout is 12 s so a slow network degrades to lexical rather than to a blocked prompt.
Why Gemini inside a Claude tool? claude -p inside a hook re-enters every hook and MCP server on the machine — measured at 3.5 minutes. The classification is ~60 tokens. Provider order is Anthropic Haiku → Gemini Flash-Lite; whichever key works first answers.
Can I turn it off? For one message, write [no-router]. For good, python3 scripts/install_hooks.py --remove.
What about my custom skills? They are exactly what v4 is for. Anything under ~/.claude/skills/, ~/.claude/commands/, project .claude/skills/, and every installed plugin is indexed. Non-invokable catalogs (~/.agent/skills, ~/.composio-skills) are install candidates only.
Where does it log? ~/.claude/skill_usage.log (every Skill call) and ~/.claude/skill_router_log.jsonl (announcements, prompts as keywords, invocations, soft-skips). Both feed the learner; both are hook-mode only, so tests and probes never teach the router.
Integrated manual external discovery: search skills.sh, inspect pinned sources, and optionally rank with JEV. It returns candidates for review and does not install or invoke them. Supplied-candidate ranking remains available. Fresh conversation-context results show no specialist-routing gain at the unchanged 0.8 threshold.
Skill doctor
python3 scripts/cli.py audit reports what your installed skills cost and which look like dead
weight, with a 0-100 score. It only recommends. Details: docs/skill-audit.md.
MCP server
python3 mcp/server.py serves route, find_skill, audit_skills and listing over stdio MCP for Codex, Cursor, Gemini CLI or Claude Code. Read-only; setup snippets in mcp/README.md.
Per-project visibility
python3 scripts/cli.py visibility plan (a dry run) shows whether setting unused skills name-only
would keep a project’s own skills described in the capped listing. Measured on the three most active projects (sub-agent use included), the plan reaches the 80% bar in only one
of three, and only under the optimistic names-free model with 93 overrides;
archiving unused skills and the budget fraction may help. Details: docs/visibility.md.
Documentation
| Doc |
What you’ll learn |
| docs/skill-audit.md |
The skill audit: numbers, score formula, what is not tracked, privacy |
| docs/skills-sh.md |
The skills.sh cache: sources, screening, categories, limits |
| docs/jev.md |
What Jev decides, the 0.8 gate, model-per-tier, what leaves your machine |
| docs/v4-design.md |
The audit that motivated v4, the design, the deliverables |
| docs/how-it-works.md |
The pipeline, ranking rules, tiers, sub-agent hand-off |
| docs/customizing.md |
Personal routes, projects, named chains |
| docs/self-improvement.md |
What the learner computes and how it surfaces |
| references/routing-tables.md |
The process tables, announcement format, dispatch protocol |
| docs/proof.md |
Real-session screenshots |
skill-router and surenode-ai/skill-discovery
They do different jobs and work fine side by side.
surenode-ai/skill-discovery is an
inventory and security tool. It walks the skill folders of every coding agent on a
machine (Claude Code, Codex, Cursor, OpenCode, Antigravity, Windsurf, Copilot, Kiro),
fingerprints each skill, flags secrets and malicious-skill patterns, and reports the
result to a person, a CI job or a governance server. It answers “what is installed here,
and is any of it risky?”
skill-router is a routing and discovery tool for Claude Code. On every prompt it picks
which installed skill to load first, puts gates and memory on the card, learns from what
you actually use, and — only when nothing installed fits — suggests a vetted outside skill.
It answers “which skill should this prompt use, and is there a better one I don’t have?”
What skill-router borrowed, with credit (Apache-2.0, see
third_party/skill-discovery): the list of agent skill
roots, the order-independent SHA-256 skill fingerprint used for duplicate detection, and
several risk heuristics (environment-variable exfiltration, bytecode tampering,
prompt injection aimed at scanners, registry tampering) now used to screen outside
suggestions. If you need an audit trail or fleet-wide inventory, use skill-discovery for
that; skill-router does not report anywhere.
Works with
| Source |
Skills |
How the router uses it |
| superpowers |
process discipline |
the process leg of every route |
Claude Code plugins (~/.claude/plugins) |
frontend-design, supabase, vercel, … |
indexed, invokable |
your ~/.claude/skills/ |
whatever you build |
indexed, invokable, project-aware |
| Antigravity, Composio |
2,300+ |
install candidates only |
Project
评论