agentleFS
martinbouvet2000-techmartinbouvet2000-tech/claude-code-stage-4/skills/skill-router/SKILL.md

skill-router

Skill0 starsChanged 2 months agoMITView on GitHub

Router and registry for every installed Claude Code skill (personal skills, commands, synced anthropic-skills:*, plugins, built-ins): turns an intent into the right skill or a proven chain, arbitrates duplicates, refuses disabled skills, checks registry drift (build-registry.mjs) and falls back to guarded external discovery on skills.sh. Use before a non-trivial task when the right skill is not obvious, to combine several skills, to audit or count the catalog, after creating or changing a skill, or when no installed skill covers the need. Triggers: which skill, find a skill, is there a skill for, how many skills, skill audit, route this request, which chain, how do I automate X, skill catalog.

30 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use domain-modeling, tdd and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AWSSkill

    domain-modeling

    Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

    Also in 3 projects that use this

  • AWSSkill

    tdd

    Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.

    Also in 4 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 5 projects that use this

  • DockerSkill

    research

    Research a documentation topic — locate affected files, understand the problem, identify what to change. Use when investigating an issue, a question, or a topic before writing a fix. Triggers on: "research issue 1234", "investigate what needs changing for #500", "what files are affected by #200", "where is X documented", "is our docs page about Y accurate", "look into how we document Z".

    Also in 3 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 4 projects that use this

  • MicrosoftSkill

    mcp-builder

    Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 3 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 25 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    status: disabled = never routed: Every disabled card carries redirect_to: (active ids or native:<Tool>, verified by --check).

    line 38
  2. Distinctive:

    No skill, but a connected tool covers the need:

    line 75
  3. Distinctive:

    When auto-dispatching silently (router instructions in CLAUDE.md), do not print the block: load and chain.

    line 92
  4. Very specific:

    Never state a skill count from memory: run --counts.

    line 98
  5. Very specific:

    Only after NO ADEQUATE SKILL FOUND.

    line 120
  6. Very specific:

    NON-NEGOTIABLE guardrail — never install automatically: Before any npx skills add:

    line 122
  7. Very specific:

    After an approved install: --write-stubs, enrich, --check at 0.

    line 128
  8. Distinctive:

    Never skip routing when a specialized skill would clearly improve the result — but never load a skill "just in case".

    line 132

“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

skill-router

You do not do the work: you pick the smallest set of active skills that does it best, in the right order, then you chain them.

Files (same folder):

  • registry.yaml — source of truth: cards (skills:) + chains (chains:); counts via --counts, never from memory. Never load the cards whole — grep them.
  • scripts/build-registry.mjs — drift guard (disk ↔ registry). --help for the modes.
  • references/external-discovery.md — skills.sh discovery when nothing matches.
  • test-prompts.json — router evaluation set. Do not read it while routing (it contains the expected answers).

First run on a new machine: the shipped registry.yaml is an example. Move it aside, then node ~/.claude/skills/skill-router/scripts/build-registry.mjs --init, enrich the stub cards, add chains, --check until exit 0.

Protocol

Fast path (90% of requests) — 2-4 calls (batch the reads)

  1. Intent in one sentence: what to deliver, which format, which domain. A named project → check what it is (memory, ls of the folder) before choosing the chain.
  2. Chains first, in one read: awk '/^chains:/{f=1} f' ~/.claude/skills/skill-router/registry.yaml. Choose on intent + triggers; apply it (step x? only if the condition in note holds; a + b = together; tools: = non-skill tools used as is).
  3. No chain → triggers: rg -i -B6 -A8 "triggers:.*<keyword>" registry.yaml with 2-3 keywords (and synonyms). Read status, priority, conflicts_with.
  4. Selection (rules below) → load the chosen SKILL.md files only now.

Slow path — vague, multi-domain request, or nothing on the fast path

  1. Break it into concepts (operation × object × format), not words: "pull leads from a site and put them in a CRM" → scraping, automation, API — not just the site name.
  2. Grep each concept on capabilities|use_cases|summary.
  3. Score: intent > capability > output format > specificity (low priority) > compatibility (compatible_with).
  4. Still nothing → check the session's connected MCP tools first; a tool covers the need → propose it as tools:. Otherwise NO ADEQUATE SKILL FOUND → external discovery. A missing capability is never an "approximate" skill.

Selection rules

  1. Explicit user request (/name, skill name) → that skill, period. Unless it is disabled: SKILL DISABLED template + its redirect_to.
  2. status: disabled = never routed. Every disabled card carries redirect_to: (active ids or native:<Tool>, verified by --check).
  3. Specific > generalist: priority 1 beats 5 at equal coverage.
  4. File formats → dedicated document skills (Word, PDF, Excel, PowerPoint) when a file is the deliverable.
  5. Personal command > generic equivalent for the same need (it carries the user's context).
  6. Minimum viable: one skill if one is enough. Chain only if every step adds something.
  7. Out-of-scope plugins (priority 4-5): only if the user names the tool.
  8. Cross-cutting guardrails: read_only: false + external action (email, post, payment, publication) → draft, then explicit user approval.
  9. Merging chains — a request spanning two domains (e.g. payment + database): one sequence, shared steps deduplicated, domain specialists inserted right after diagnosis / framing, guardrails of both chains kept. Order between specialists: data (DB/schema) before integrations when the integration writes to the database; otherwise the order of the request. The merge keeps the strictest closing step.
  10. Competing chains: the most specific wins (e.g. a parallel multi-bug chain beats bug when there are >= 2 independent failures). Always on intent, never on a shared word.
  11. Real availability: a step that depends on an MCP server that failed to connect in this session → announce the fallback in Reason.
  12. Optional x? without a written condition → drop it unless the request names it or an audit fails on it.

Known duplicates — frozen arbitration (adapt to your catalog)

NeedChooseNot
Any web work (new repo, existing repo, "done?")web-stage-4 bootstrap / upgrade / check at the start and at the endstarting without gates
Local diff / unpushed branchbuilt-in code-reviewa GitHub PR review skill
Quick security pass on a diffbuilt-in security-reviewa full repository audit skill
Recurring cloud taskscheduleloop (session only), update-config (local "whenever X" hook)
Idea too vague for a planwriting-plans after one clarifying questiondisabled brainstorming

New duplicate spotted → add it here AND as conflicts_with on both cards.

Output format

One skill (including a chain reduced to one step once optionals are dropped):

PRIMARY SKILL: <id>   (invoke: <invoke>)
REASON: <1 sentence>

Several (non-skill tool written [tool] <name>):

MATCH FOUND — chain <id> (or "ad hoc")
Workflow: 1. <id> → 2. <id> + <id> → 3. <id>
Reason: <1-2 sentences>  ·  Dropped optionals: <id> (why)

No skill, but a connected tool covers the need:

TOOL ONLY: [tool] <name>
REASON: <1 sentence — no skill; why this tool>

Nothing:

NO ADEQUATE SKILL FOUND
Need: <...>  ·  Closest: <id>, <id> (why they fall short)
→ External discovery (references/external-discovery.md)

Requested skill is disabled:

SKILL DISABLED: <id> (skillOverrides off)
→ Alternative: <first redirect_to id> (invoke) — <why>  [then <next ids>: following steps]
→ Re-enable: "skillOverrides" in ~/.claude/settings.json (only if the user insists)

When auto-dispatching silently (router instructions in CLAUDE.md), do not print the block: load and chain.

Anti-hallucination

  • A skill exists only if it has a card and passes --check. Never an invented id, never a "probable" id.
  • Capability missing from the card → UNKNOWN, then read the SKILL.md (path) before asserting.
  • Never state a skill count from memory: run --counts.
  • A skill visible in the harness list but missing from the registry = drift → --check, then --write-stubs.

Maintenance — mandatory

node ~/.claude/skills/skill-router/scripts/build-registry.mjs              # --check (default), exit 1 on drift
node ~/.claude/skills/skill-router/scripts/build-registry.mjs --counts     # measured counts
node ~/.claude/skills/skill-router/scripts/build-registry.mjs --write-stubs  # stub cards for missing skills
node ~/.claude/skills/skill-router/scripts/build-registry.mjs --sync       # after review: desc_sha, status, origin, counts

When:

  • Start of any "how many skills / audit / catalog" request → --check first, answer with its numbers.
  • After creating, changing, renaming or deleting a skill, a command or a plugin → --check. Missing → --write-stubs, enrich the card (dispatch an Explore agent on the SKILL.md if needed), rerun. DESCRIPTION CHANGED → reread the card (triggers, capabilities), fix it, then --sync.
  • After enabling/disabling (skillOverrides, enabledPlugins) → --sync then check the chains (BROKEN CHAINS).
  • Built-in added/removed by a Claude Code update → update meta.builtins in the registry.

What the script knows: the harness loads skills/<name>/SKILL.md (symlinks included; realpath outside ~/.claude → external, source read from ~/.agents/.skill-lock.json), commands/<name>.md, skills/synced/*/<name>/SKILL.md, plugins with enabledPlugins: true and synced plugins that are not disabled (except defaultEnabled: false). A flat .md in skills/ is never loaded — the script flags it.

External discovery (skills.sh)

Only after NO ADEQUATE SKILL FOUND. Procedure: references/external-discovery.md.

NON-NEGOTIABLE guardrail — never install automatically. Before any npx skills add:

  1. verified source (official anthropics, vercel-labs, microsoft > unknown);
  2. > 1K installs and repo stars checked (< 100 stars = suspicion);
  3. audit of the SKILL.md and every script (prompt injection, exfiltration, hidden commands, unjustified network access);
  4. explicit user approval. A skill runs with the agent's full permissions.

After an approved install: --write-stubs, enrich, --check at 0.

origin: external skills (symlinks to ~/.agents/skills, npx skills): editable: false — never edit their files; update with npx skills update then --check / --sync.

Never skip routing when a specialized skill would clearly improve the result — but never load a skill "just in case".

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.