---
name: skill-router
description: "Use for every user request when SkillSpec router mode is enabled. First check the local SkillSpec router index, load the selected skill only when route decision is use_skill, and continue with normal agent behavior when the decision is bypass or ambiguous."
metadata:
  routing:
    tags: [ skills, router, discovery, codex, claude ]
    triggers:
      - choose the right skill
      - route to a skill
      - many skills installed
      - skill descriptions shortened
      - install skill router
      - disable implicit skill invocation
    negative_triggers:
      - ordinary code generation
title: skill-router
canonical_url: https://skilld.dev/gh/modiqo/skillspec/skill-router
last_updated: 2026-10-14T08:31:01.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [skill.spec.yml](https://skilld.dev/api/skills-raw/modiqo/skillspec/skill-router/skill.spec.yml).
>
> If the user asked to install this Skill, run `npx skilld install modiqo/skillspec/skill-router`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/skill-router`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/modiqo/skillspec/skill-router) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/skill-router`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/skill-router --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/skill-router --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Skill Router

This skill is a thin native harness loader for the SkillSpec router.
When router mode is enabled and the harness has been restarted, this router is
the first hop for every user request in managed skill roots. All routed skills
are explicit-only/manual-only, so check the router index before reading,
searching for, or guessing at a domain skill.

The router does not execute task work. It decides whether a local skill should
be loaded, reports confidence and candidate paths, and asks for direct or
durable execution only after a `use_skill` decision when the task will use tools
and the user has not already chosen an execution mode.

## Runtime Contract

1. For ordinary requests with prompt-hook context `first_hop_ready=true`, use the fast path: do not read `./skill.spec.yml` and do not run `skillspec router index status`.
2. Run one route query:

   ```bash
   skillspec route --index <index-file-or-router-dir> --query '<user task>' --top 5 --json
   ```

3. If route output says `decision: "use_skill"` and `selected` is non-null, read that skill's `SKILL.md` and follow it.
4. If route output says `decision: "bypass"`, do not load any candidate skill; continue with normal agent behavior for the request.
5. If route output says `decision: "ambiguous"`, do not silently choose a candidate. Ask only when the user explicitly requested skill selection; otherwise continue with normal agent behavior.
6. If route output includes `execution_mode_direct_or_durable` for a `use_skill` decision, ask the user whether to run direct or durable before tool-backed execution.
7. Load and follow `./skill.spec.yml` only for router lifecycle, repair, visibility, guard, index status, index refresh, or when guard context is missing or failed.
8. If the user chooses durable execution, hand the selected skill and task context to `durable-executor`. The router still only routes; durable-executor owns workspace evidence, rote execution policy, alignment, token stats, and final closure.

## Router Management

Use lifecycle commands for managed installation:

```bash
skillspec router install --roots <skill-root>... --index <index-file-or-router-dir>
skillspec router index status --roots <skill-root>... --index <index-file-or-router-dir> --visibility-manifest <manifest>
skillspec router index refresh --roots <skill-root>... --index <index-file-or-router-dir> --visibility-manifest <manifest>
skillspec router uninstall
```

Any index argument can be either the SQLite file itself or the router directory;
directory paths resolve to `skill-index.sqlite`.

Use visibility commands for explicit controls:

```bash
skillspec visibility plan --roots <skill-root>... --json
skillspec visibility apply --roots <skill-root>... --manifest <manifest> --json
skillspec visibility restore --manifest <manifest> --json
skillspec skills set-visibility <skill-name> manual-only --roots <skill-root>... --manifest <manifest>
skillspec skills disable <skill-name> --roots <skill-root>... --manifest <manifest>
skillspec skills enable <skill-name> --roots <skill-root>... --manifest <manifest>
```

The manifest is the rollback boundary. Do not bulk-restore visibility by inference when the manifest is missing.
