agentleFS
scuensenscuensen/claude-skills-router/SKILL.md

skills-router

Skill0 starsChanged 5 months agoMITView on GitHub

Automatic skill routing hook for Claude Code. Matches user prompts to relevant skills using TF-IDF scoring, bigram matching, and configurable intent mapping. Install as a UserPromptSubmit hook to get skill suggestions on every prompt.

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. liushikuan63/Qoder-Optimization★ 2same name
    2. ShenQingchuan/skills★ 1same name
    3. 2867203296/hermes-agent★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Scores: every skill in the index using TF-IDF-weighted term matching and bigram proximity

    line 18

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Skills Router

A UserPromptSubmit hook for Claude Code that automatically matches user prompts to relevant skills using a combination of TF-IDF scoring, bigram matching, and configurable intent mapping.

How it works

  1. On every prompt, the hook receives the user's message
  2. Tokenizes the prompt (supports Latin + German umlauts/ß)
  3. Scores every skill in the index using TF-IDF-weighted term matching and bigram proximity
  4. Checks the configurable intent map for explicit trigger → skill overrides
  5. Outputs matched skills to stderr for Claude to pick up

Scoring Algorithm

SignalWeightDescription
Name exact match4× IDFToken appears in skill name
Name partial match2× IDFToken is substring of name token (min 4 chars)
Description exact match1.5× IDFToken appears in description
Description partial match0.5× IDFToken is substring of description token
Name bigram match+8 flatTwo consecutive prompt tokens match name bigram
Description bigram match+3 flatTwo consecutive prompt tokens match description bigram
Intent overrideScore 99Configurable trigger phrase → skill mapping

Scores are normalized by √(token count) to prevent long prompts from inflating scores.

Setup

# 1. Clone or copy to your machine
git clone <repo-url> ~/.claude/skills/skills-router

# 2. Build the skills index
node ~/.claude/skills/skills-router/src/build-index.js -v

# 3. Install the hook
node ~/.claude/skills/skills-router/src/install.js

# 4. (Optional) Customize config
cp ~/.claude/skills/skills-router/config.example.json ~/.claude/skills-router.config.json
# Edit ~/.claude/skills-router.config.json to add your own intents, stopwords, etc.

Configuration

Copy config.example.json to ~/.claude/skills-router.config.json and customize:

{
  "skillsDirs": ["~/.claude/skills"],
  "archiveDirs": ["~/.claude/skills-archive"],
  "indexPath": "~/.claude/skills-index.json",
  "maxResults": 5,
  "minScore": 1.5,
  "cacheTTL": 300000,
  "debug": false,
  "intents": {
    "bug": ["systematic-debugging"],
    "deploy": ["deploy-to-vercel"]
  }
}
FieldDefaultDescription
skillsDirs["~/.claude/skills"]Directories containing active skills
archiveDirs["~/.claude/skills-archive"]Directories containing archived skills
indexPath~/.claude/skills-index.jsonWhere the built index is stored
maxResults5Maximum skills to suggest per prompt
minScore1.5Minimum TF-IDF score to include a skill
cacheTTL300000Cache lifetime in ms (5 min default)
debugfalseLog debug info to stderr
intents{}Trigger phrase → skill name mapping
stopwords{en: [...], de: [...]}Words to ignore during scoring

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.