LEVEL 2 · BUILDER

Skill Router

Route a request to a skill using explainable keyword scores, path rules, permission gates, and dependency ordering.

4 stages~8 hoursTypeScriptcore
Parse a typed skill catalogScore words and repository pathsResolve dependencies before executionAbstain on ambiguous or blocked requests
YOU END UP WITH

A routing debugger showing why the wrong skill activated and how to fix a rule.

USEFUL FOR
  • A routing debugger showing why the wrong skill activated and how to fix a rule.
  • SKILL.md provides standard name and description; routing.json is this project's documented local extension.
PROJECT OUTLINE

Skill Router in 4 stages

Route a request to a skill using explainable keyword scores, path rules, permission gates, and dependency ordering.

  1. Parse a typed skill catalog

    A skill manifest declares an id, description, keywords, path patterns, priority, dependencies and permissions. Validate arrays and numbers at runtime rather than trusting a JSON cast. Tokenization normalizes punctuation and case and removes repeated words, so repeating a prompt cannot inflate its score.

    starter · ~2 hours · TypeScript

    parseSkilltokens
  2. Score words and repository paths

    Award two points for each matched keyword and three for each matched file path. Return score reasons alongside the score. Support star within one path segment and double-star across segments, escape regular expression punctuation, and reject absolute or parent-traversing file paths. Resolve tied scores by priority and then id so ranking is reproducible.

    core · ~2 hours · TypeScript

    matchPathrank
  3. Resolve dependencies before execution

    Use depth-first traversal with separate active and visited sets. Active membership catches a cycle; visited membership avoids duplicate execution through a diamond. Validate permission requirements on dependencies as well as the selected skill. Emit dependencies before their consumers and reject unknown dependency ids instead of silently skipping work.

    core · ~2 hours · TypeScript

    plan
  4. Abstain on ambiguous or blocked requests

    Join ranking and dependency planning while preserving four distinct outcomes: ready, no-match, ambiguous and blocked. A score gap below the margin is ambiguous even if the tie-breaker produces a first result. A ranked winner can still be blocked by permissions. Return the ranked explanations in every outcome so a caller can display the decision.

    core · ~2 hours · TypeScript

    route

Lessons this project uses

All projects · Course catalog · Source on GitHub