# Workflow Router

> Selects the best workflow-spec dynamically from the repository, computes the minimal skill chain, and emits a deterministic routing decision with confidence and fallback. Use when the orchestrator receives a pedagogical request and must choose among multiple workflows without hardcoded chains.

- Skill: `alainlebret/workflow-router` (Agent Skill)
- Install (CLI): `npx skillmds@latest add alainlebret/workflow-router`
- Raw SKILL.md: https://api.skillmd.com/api/skills/alainlebret/workflow-router/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: alainlebret (https://skillmd.com/u/alainlebret)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/alainlebret/workflow-router

---


# Workflow Router

## Goal
Map an instructor request to exactly one workflow in `workflows/*/workflow-spec.json`, with explicit rationale and fallback behavior.

## Inputs
- Instructor request (free text)
- Optional `mission.json`
- Repository workflow inventory under `workflows/`

## Produce
Write `routing-decision.json` with:
- `request_summary`
- `candidate_workflows` (ranked)
- `selected_workflow`
- `selected_reason`
- `confidence` (`high`|`medium`|`low`)
- `required_skills`
- `optional_skills_selected`
- `skip_conditions_applied`
- `human_confirmation_required` (bool)
- `fallback_workflow`

## Selection policy
1. Discover candidates by reading all `workflow-spec.json` files.
2. Score candidates on:
- intent match (create, redesign, evaluate, validate, benchmark);
- artifact intent (exam/lab/course/project/grading/figures);
- constraints (language_mode, evaluation_mode, level, duration, toolchain);
- required input availability.
3. Select the highest score only if score gap to second candidate is significant.
4. If ambiguity remains, set `human_confirmation_required: true`.

## Skill-chain policy
- Start from workflow `execution_order`.
- Apply `skip_conditions` if artifacts already exist and pass validators.
- Add optional skills only when their trigger in `optional_extensions` is satisfied.
- Never invent a skill not present in workflow spec.

## Rules
- Do not use hardcoded workflow names in logic; load from repository each run.
- Emit one selected workflow, never multiple.
- If confidence is low, provide a fallback and require confirmation before generation.
- Keep routing deterministic for same inputs and same repository state.

