agentleFS
mmccallammccalla/coding-agent-skill-library/skills/routing/SKILL.md

routing

Skill4 starsChanged 5 months agoApache-2.0View on GitHub

Use when implementing conditional control flow in an agent or coding workflow, including intent classification, tool selection, sub-agent selection, escalation, or language/framework-specific dispatch.

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 7

    Distinctive

    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:

    Use this skill when an agent must decide between multiple possible paths based on user intent, repository state, file type, language, …

    line 10
  2. Distinctive:

    Use deterministic routing first when criteria are explicit.

    line 12
  3. Distinctive:

    Add a fallback route for ambiguity or insufficient confidence.

    line 33
  4. Distinctive:

    Add regression tests for ambiguous and boundary cases.

    line 35
  5. Distinctive:

    Never let an LLM invent route names.

    line 39
  6. Distinctive:

    Never execute privileged tools from an uncertain route.

    line 40
  7. Distinctive:

    Keep routing separate from execution so routes are testable.

    line 42

“Common” is measured: kept by at least 6 in 10 of the 9 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

Routing

When to use

Use this skill when an agent must decide between multiple possible paths based on user intent, repository state, file type, language, confidence, policy or prior tool results.

Use deterministic routing first when criteria are explicit. Use LLM routing only when semantic judgement is genuinely required.

Objective

Select execution paths predictably using constrained route definitions, confidence thresholds, and safe fallbacks.

Routing methods

Choose the lightest reliable router:

  1. Rule-based router: keywords, file extensions, config flags, explicit metadata.
  2. Schema-based router: validated structured task type or command object.
  3. Embedding router: semantic similarity between request and capability descriptions.
  4. LLM router: nuanced classification with constrained labels.
  5. Trained classifier: repeated high-volume routing with labelled examples.

Procedure

  1. Define the allowed routes as an enum.
  2. Define route descriptions, entry conditions and prohibited cases.
  3. Make the router return only the route, confidence and rationale.
  4. Add a fallback route for ambiguity or insufficient confidence.
  5. Log route decisions and inputs used.
  6. Add regression tests for ambiguous and boundary cases.

Guardrails

  • Never let an LLM invent route names.
  • Never execute privileged tools from an uncertain route.
  • Escalate or ask for clarification when route confidence is low.
  • Keep routing separate from execution so routes are testable.

References

Verification

  • Route enum exists.
  • Fallback/clarification route exists.
  • Route confidence threshold is explicit.
  • Unit tests cover each route.
  • Logs capture routing decision, confidence and selected handler.

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.