agentsop-query-routing

agentsop-query-routing is a skill for Claude Code, Codex from agentsope/SkillAlchemy. It costs 86 tokens per session (6,374 once invoked), scanned A, original, MIT.

A method for directing each incoming question to the right search system or tool before retrieving an answer. It applies when one interface uses several handlers, such as a document summary index, a similarity-search index, or a database query engine.

In plain words
What is it for?
Designing or reviewing query-routing code in systems built with tools such as LlamaIndex, Dify, or LangGraph.
Why use it?
Different search systems are built for different kinds of questions, so using the wrong one can produce poor answers. Routing first helps the system choose a suitable handler for lookups, summaries, calculations, or comparisons.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/agentsope/skillalchemy/agentsop-query-routing
Any agent
npx skills add agentsope/SkillAlchemy --skill agentsop-query-routing
Clone the repo
git clone --depth 1 https://github.com/agentsope/SkillAlchemy

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agentsop-query-routing

README.md
[![agentmods](https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-query-routing.svg)](https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-query-routing)
Your own site
<a href="https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-query-routing"><img src="https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-query-routing.svg" alt="Measured on agentmods" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,374 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00086 $0.06374
Opus 5 $0.00043 $0.03187
Sonnet 5 $0.00017 $0.01275
Haiku 4.5 $0.00009 $0.00637

Measured yesterday against content hash 7b592da34cde, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

agentsop-query-routing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/agentsop-query-routing/SKILL.md · 489 lines

How it starts

The opening of the file, as written. The whole thing — 489 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Query-Type Routing · Enhancement Overlay

Third-person operating model for a coder agent that owns a multi-handler answering surface. Audience is the LLM agent writing/reviewing the routing code — not the end user.

One sentence: A retriever is shaped by the query type it was built for; a summary index, a vector index, and a text-to-SQL engine are not interchangeable — so classify the query and route first, then retrieve.

This is an ENHANCE overlay. It distills the cross-framework routing pattern from three source skills. For the per-framework API, cross-link the base skill: [[llamaindex]] (RouterQueryEngine), [[agentsop-dify]] (Question Classifier node), [[agentsop-langgraph]] (conditional edges).


1. 何时激活 (Activation Rules)

Activate when any of the following holds:

  1. The system has multiple indices / tools / engines behind one entry point, and a query must be dispatched to exactly one (or a few) of them.
  2. Inbound queries differ in kind — at least two of: lookup ("what does the contract say about termination"), summarize ("give me the gist of doc Y"), compute/aggregate ("how many tickets closed last week"), compare ("diff the 2024 vs 2025 policy").
  3. A VectorStoreIndex (or any single retriever) is being stretched to answer query types it was not built for, and quality is uneven across the mix.
  4. The user names a routing primitive: RouterQueryEngine, SelectorPromptTemplate, LLMSingleSelector, Dify Question Classifier, LangGraph add_conditional_edges, "intent classifier", "text-to-SQL or RAG".
  5. PR review touches a function that reads a query and returns which handler to call.

Do not activate when:

  • One index/tool serves every query correctly — routing adds an LLM hop and a failure mode for no benefit (see §6 anti-pattern A1).
  • The split is by who is asking (tenant / ACL), not what is asked — that is filtering, route to [[agentsop-multi-tenant-rag]].
  • The downstream choice is fixed (always retrieve then summarize) — that is a static edge / linear pipeline, not a router.

Read the full file on GitHub · 489 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · -16 lines · -228 tokens per session 7b592da34cde
  2. 5d ago First seen · 505 lines · 314 tokens per session scan A f1e6fd352843

Subscribe to this mod's changes

agentsop-query-routing is a skill published in the GitHub repository agentsope/SkillAlchemy (361 stars, last pushed 3d ago), licensed MIT. It adds 86 tokens to every session and 6,374 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

karpathy-llm-wiki

Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.

Astro-Han/karpathy-llm-wiki · 67 tokens

mixedbread-search

Build and query managed search indexes (Stores) using the Mixedbread Python and TypeScript SDKs. Use when creating knowledge bases, uploading documents, performing semantic or vector search, asking questions over documents, using agentic multi-step retrieval, combining store search with web results, filtering by…

mixedbread-ai/skills · 70 tokens

mxbai-cli

Use the mxbai CLI to manage stores, upload files, search documents, ask questions, and sync directories from the terminal. Use when performing Mixedbread operations via command line, setting up CI/CD pipelines with store sync, or managing API keys.

mixedbread-ai/skills · 55 tokens

ccg-docs

Generate Markdown documentation from code graphs, build RAG indexes for AI consumption, and lint documentation quality.

tae2089/code-context-graph · 23 tokens

rag-evaluator

Generates tailored giskard.checks evaluation suites for RAG (Retrieval-Augmented Generation) systems. Use whenever a user describes a Q&A bot grounded in documents, a knowledge-base chatbot, a retrieval system, or wants to evaluate answer groundedness, faithfulness, hallucination, retrieval quality, citation accuracy…

Giskard-AI/giskard-skills · 204 tokens

local-rag-mcp

Use when querying, ingesting, or maintaining a local RAG MCP corpus for semantic document retrieval with privacy controls.

yeaight7/agent-powerups · 29 tokens