Skip to content
Back to skills

Agentic Conditional Rag

ASecurity

Route each RAG request at runtime to lexical, semantic, or hybrid retrieval, with an optional rewriter for semantic retrieval, optional reranking, and grounded generation. Use when the best retrieval strategy cannot be fixed before execution.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 1, 2026
ai-agents

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 1, 2026

npx -y skills add DocAILab/Agentic-RAG-Skill --skill agentic-conditional-rag --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Agentic Conditional Rag?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Agentic Conditional Rag
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/docailab-agentic-conditional-rag/badge)](https://www.skillsdirectory.com/skills/docailab-agentic-conditional-rag)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: agentic-conditional-rag
description: Route each RAG request at runtime to lexical, semantic, or hybrid retrieval, with an optional rewriter for semantic retrieval, optional reranking, and grounded generation. Use when the best retrieval strategy cannot be fixed before execution.
---

# Conditional RAG Agentic Skill

Route each request at runtime through exactly one of three retrieval strategies: `lexical`, `semantic`, or `hybrid`.

## Slot Binding

Bind the slots as follows:

- `classifier`: select `component-classifier`.
- `rewriter`: optionally select `component-hyde-rewriter`.
- `lexical_retriever`: select `component-bm25-retriever`.
- `semantic_retriever`: select `component-vector-retriever`.
- `reranker`: optionally select `component-bge-reranker`.
- `generator`: select `component-grounded-generator`.

Do not exchange the lexical and semantic Retriever bindings.

## Routing

Call `classifier` first with the original query and routing constraints.

- `lexical`: do not call the Rewriter. Send the original query only to `lexical_retriever`.
- `semantic`: if a Rewriter is bound, send its non-empty `rewritten_query` only to `semantic_retriever`; otherwise send the original query.
- `hybrid`: send the original query to `lexical_retriever`; send the optional rewritten query, or the original query when no Rewriter is bound, to `semantic_retriever`; fuse the two ranked lists with reciprocal rank fusion.

Reject any classifier route other than `lexical`, `semantic`, or `hybrid`.

## Evidence Safety

The Classifier result and Rewriter output control routing and retrieval only. They are never evidence documents.

Always use the original query for optional reranking and final generation. Pass only real documents returned by the Retriever slots to the Reranker and Generator.

## Execution

Run `scripts/workflow.py:run(request, components)` after every required slot is bound. Record classification, rewriting, retrieval, fusion, reranking, and generation decisions in the returned trace.

Files in this skill

  • SKILL.md2 KB
  • agents/openai.yaml275 B
  • ragskill.yaml914 B
  • scripts/workflow.py6.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.