Skip to main content
skill CX Codex

route · ypollak2 — Claude Code skill: what it does, how to install

Routes prompts to the right LLM based on task type and complexity. Saves Claude limits by steering light tasks to local models or cheaper APIs.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ypollak2/llm-router --skill route -a claude-code
Open on GitHub

What route does

The skill directs each request to a fitting model category, such as coding or research. Most prompts run through the UserPromptSubmit hook automatically. You do not have to type /route manually every time. It scores intent, topics, and formatting cues using fast heuristic checks.

When heuristics fall below the threshold, classification hands off to a local Ollama instance running qwen3.5:latest at http://localhost:11434. If Ollama is offline, inexpensive models like Gemini Flash or GPT-4o-mini step in. Tasks map across three complexity profiles: budget, balanced, and premium.

High-end logic routes to o3 or Gemini 2.5 Pro, while definitions go to the budget tier. Every fifth task displays estimated Claude API savings. Without Ollama running locally, the router will consume small API balances just to categorize your prompts.

What it helps with

  • offload routine prompts to low-cost or local models
  • classify task complexity using multi-layer heuristics and Ollama
  • pick specialized LLMs for research, coding, or text analysis
  • track avoided Claude API consumption and rate limits

Example prompts for the agent

  • /route Compare React vs Vue architecture for our new project
  • /route Implement a rate limiter in Python using sliding window
  • /route What are the top 3 AI startups that raised funding?

How to install route

1Skills CLI (Vercel)

npx skills add ypollak2/llm-router --skill route -a claude-code

2Manually: put the files in place

~/.claude/skills/route/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/route/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about route

How do I install route in Claude Code?

Run npx skills add ypollak2/llm-router --skill route -a claude-code in your terminal. This creates the skill definition at ~/.claude/skills/route/SKILL.md.

What does the route skill do?

It determines the complexity and intent of your prompt, passing it to models like Gemini Flash, GPT-4o, or o3. This preserves your primary model capacity for demanding jobs.

Is Ollama required to run route?

No, Ollama is optional. When the local service is unreachable, the system falls back to lightweight cloud APIs like Gemini Flash or GPT-4o-mini for task sorting.

Source text

SKILL.md · MIT
---
name: route
description: Route a task to the best LLM based on task type and complexity
trigger: /route
---

# /route — Smart LLM Task Router

Route any task to the optimal LLM automatically.

## Usage

```
/route <task description>
```

## Auto-Classification

Most prompts are classified automatically by the `UserPromptSubmit` hook — no `/route` needed. The hook uses a **multi-layer classification chain**:

1. **Heuristic scoring** (instant, free) — Three signal layers accumulate evidence:
   - Intent patterns (+3) — action verbs and task markers
   - Topic patterns (+2) — domain-specific nouns
   - Format patterns (+1) — structural and temporal cues
   - High-confidence match (score >= 4) routes immediately

2. **Ollama local LLM** (~1s, free) — When heuristics are uncertain, qwen3.5 classifies locally via the chat API with thinking disabled

3. **Cheap API model** (~$0.0001) — If Ollama is unavailable, Gemini Flash or GPT-4o-mini classifies

4. **Weak heuristic / auto fallback** — Last resort: low-confidence heuristic match or `llm_route` (full LLM classifier)

## Task Categories

The consolidated `llm(prompt=..., task=..., tier=...)` tool is the front door for all of
these — `task=` picks the specialization, `tier=` (fast/balanced/best) picks the cost tier:

| Category | Call | Signals |
|----------|------|---------|
| Research | `llm(task="research")` | Current events, news, funding, trends, market data, rankings |
| Generate | `llm(task="generate")` | Writing, drafting, brainstorming, emails, articles, translations |
| Analyze | `llm(task="analyze")` | Evaluation, debugging, comparison, trade-offs, code review |
| Code | `llm(task="code")` | Implementation, refactoring, building, bug fixes |
| Query | `llm(task="query")` (or `task="auto"`) | Simple questions, definitions, explanations |
| Image | `llm_image` | Visual generation, design, artwork |

## Complexity & Profiles

| Complexity | Profile | Model Tier |
|------------|---------|------------|
| Simple | `budget` | Gemini Flash, GPT-4o-mini |
| Moderate | `balanced` | GPT-4o, Gemini 2.5 Pro |
| Complex | `premium` | o3, Gemini 2.5 Pro |

## Savings Awareness

Every 5th routed task, the system shows estimated savings: Claude API costs avoided and rate limit capacity preserved. Run `llm_router_status(view="usage")` for a detailed breakdown.

## Examples

```
What are the top 3 AI startups that raised funding?
→ research (heuristic, score=8) → llm(task="research") → Perplexity Sonar

Write me a blog post about productivity tips
→ generate (heuristic, score=5) → llm(task="generate", tier="balanced") → Gemini 2.5 Pro

Compare React vs Vue for our new project
→ analyze (ollama, qwen3.5) → llm(task="analyze", tier="balanced") → GPT-4o

Implement a rate limiter in Python using sliding window
→ code (heuristic, score=4) → llm(task="code", tier="balanced") → GPT-4o

What is a monad?
→ query (ollama, qwen3.5) → llm(task="query", tier="fast") → Gemini Flash
```

## Configuration

Environment variables:
- `LLM_ROUTER_OLLAMA_MODEL` — Ollama model (default: `qwen3.5:latest`)
- `LLM_ROUTER_OLLAMA_URL` — Ollama server (default: `http://localhost:11434`)
- `LLM_ROUTER_OLLAMA_TIMEOUT` — Timeout in seconds (default: `5`)
- `LLM_ROUTER_CONFIDENCE_THRESHOLD` — Heuristic score cutoff (default: `4`)

© ypollak2 · MIT · ypollak2/llm-router

Similar skills

All skills for Agent setup: memory, context, orchestration →

route by other authors comes first.

From the same set4

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor