MCPInstall

rag-retrieval

Retrieval-Augmented Generation patterns for grounded LLM responses. Use when building RAG pipelines, embedding documents, implementing hybrid search, contextual retrieval, HyDE, agentic RAG, multimodal RAG, query decomposition, reranking, or pgvector search.

Installs
1.5K
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/yonatangross/orchestkit --skill rag-retrieval
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads rag-retrieval automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

RAG Retrieval

Comprehensive patterns for building production RAG systems. Each category has individual rule files in rules/ loaded on-demand.

House thresholds, fusion ordering, and the latency and quality budgets we assert live in House delta below. Vendor documentation is linked, not restated (see Upstream coverage).

Quick Reference

CategoryRulesImpactWhen to Use
Core RAG4CRITICALBasic RAG, citations, hybrid search, context management
Embeddings3HIGHModel selection, chunking, batch/cache optimization
Contextual Retrieval3HIGHContext-prepending, hybrid BM25+vector, pipeline
HyDE3HIGHVocabulary mismatch, hypothetical document generation
Agentic RAG4HIGHSelf-RAG, CRAG, knowledge graphs, adaptive routing
Multimodal RAG3MEDIUMImage+text retrieval, PDF chunking, cross-modal search
Query Decomposition3MEDIUMMulti-concept queries, parallel retrieval, RRF fusion
Reranking3MEDIUMCross-encoder, LLM scoring, combined signals
PGVector4HIGHPostgreSQL hybrid search, HNSW indexes, schema design

Total: 30 rules across 9 categories

Core RAG

Fundamental patterns for retrieval, generation, and pipeline composition.

RuleFileKey Pattern
Basic RAGrules/core-basic-rag.mdRetrieve + context + generate with citations
Hybrid Searchrules/core-hybrid-search.mdRRF fusion (k=60) for semantic + keyword
Context Managementrules/core-context-management.mdToken budgeting + sufficiency check
Pipeline Compositionrules/core-pipeline-composition.mdComposable Decompose → HyDE → Retrieve → Rerank

Embeddings

Embedding models, chunking strategies, and production optimization.

RuleFileKey Pattern
Models & APIrules/embeddings-models.mdModel selection, batch API, similarity
Chunkingrules/embeddings-chunking.mdSemantic boundary splitting, 512 token sweet spot
Advancedrules/embeddings-advanced.mdRedis cache, Matryoshka dims, batch processing

Contextual Retrieval

Anthropic's context-prepending technique — 67% fewer retrieval failures.

RuleFileKey Pattern
Context Prependingrules/contextual-prepend.mdLLM-generated context + prompt caching
Hybrid Searchrules/contextual-hybrid.md40% BM25 / 60% vector weight split
Complete Pipelinerules/contextual-pipeline.mdEnd-to-end indexing + hybrid retrieval

HyDE

Hypothetical Document Embeddings for bridging vocabulary gaps.

RuleFileKey Pattern
Generationrules/hyde-generation.mdEmbed hypothetical doc, not query
Per-Conceptrules/hyde-per-concept.mdParallel HyDE for multi-topic queries
Fallbackrules/hyde-fallback.md2-3s timeout → direct embedding fallback

Agentic RAG

Self-correcting retrieval with LLM-driven decision making.

RuleFileKey Pattern
Self-RAGrules/agentic-self-rag.mdBinary document grading for relevance
Corrective RAGrules/agentic-corrective-rag.mdCRAG workflow with web fallback
Knowledge Graphrules/agentic-knowledge-graph.mdKG + vector hybrid for entity-rich domains
Adaptive Retrievalrules/agentic-adaptive-retrieval.mdQuery routing to optimal strategy

Multimodal RAG

Image + text retrieval with cross-modal search.

RuleFileKey Pattern
Embeddingsrules/multimodal-embeddings.mdCLIP, SigLIP 2, Voyage multimodal-3
Chunkingrules/multimodal-chunking.mdPDF extraction preserving images
Pipelinerules/multimodal-pipeline.mdDedup + hybrid retrieval + generation

Query Decomposition

Breaking complex queries into concepts for parallel retrieval.

RuleFileKey Pattern
Detectionrules/query-detection.mdHeuristic indicators (<1ms fast path)
Decompose + RRFrules/query-decompose.mdLLM concept extraction + parallel retrieval
HyDE Comborules/query-hyde-combo.mdDecompose + HyDE for maximum coverage

Reranking

Post-retrieval re-scoring for higher precision.

RuleFileKey Pattern
Cross-Encoderrules/reranking-cross-encoder.mdms-marco-MiniLM (~50ms, free)
LLM Rerankingrules/reranking-llm.mdBatch scoring + Cohere API
Combinedrules/reranking-combined.mdMulti-signal weighted scoring

PGVector

Production hybrid search with PostgreSQL.

RuleFileKey Pattern
Schemarules/pgvector-schema.mdHNSW index + pre-computed tsvector
Hybrid Searchrules/pgvector-hybrid-search.mdSQLAlchemy RRF with FULL OUTER JOIN
Indexingrules/pgvector-indexing.mdHNSW (17x faster) vs IVFFlat
Metadatarules/pgvector-metadata.mdFiltering, boosting, Redis 8 comparison

Quick Start Example

from openai import OpenAI

client = OpenAI()

async def rag_query(question: str, top_k: int = 5) -> dict:
    """Basic RAG with citations."""
    docs = await vector_db.search(question, limit=top_k)
    context = "\n\n".join([f"[{i+1}] {doc.text}" for i, doc in enumerate(docs)])

    response = await llm.chat([
        {"role": "system", "content": "Answer with inline citations [1], [2]. Use ONLY provided context."},
        {"role": "user", "content": f"Context:\n{context}\n\nQuestion: {question}"}
    ])

    return {"answer": response.content, "sources": [d.metadata['source'] for d in docs]}

Key Decisions

DecisionRecommendation
Embedding modeltext-embedding-3-small (general), voyage-3.5 (production)
Chunk size256-1024 tokens (512 typical)
Hybrid weight40% BM25 / 60% vector
Top-k3-10 documents
Temperature0.1-0.3 (factual)
Context budget4K-8K tokens
RerankingRetrieve 50, rerank to 10
Vector indexHNSW (production), IVFFlat (high-volume)
HyDE timeout2-3 seconds with fallback
Query decompositionHeuristic first, LLM only if multi-concept

Upstream coverage (do not restate)

Fetch these from the source instead of restating them here. Where a row says the house subset stays, that named file carries only the tuned values and the reason, not a tutorial.

TopicSource
pgvector install, operators, index build syntax, "why isn't my index used"https://github.com/pgvector/pgvector; house subset (HNSW m=16, ef_construction=64, halfvec, binary quantize) stays in rules/pgvector-indexing.md and rules/pgvector-schema.md
Postgres full-text search: tsvector, tsquery, GIN, ts_rank_cdhttps://www.postgresql.org/docs/current/textsearch.html; house subset (generated STORED column) stays in rules/pgvector-schema.md
Reading query plans, confirming an index is used, VACUUM/ANALYZEhttps://www.postgresql.org/docs/current/using-explain.html
RRF mechanics: rank constant, rank window size, tie handlinghttps://www.elastic.co/docs/reference/elasticsearch/rest-apis/reciprocal-rank-fusion; house subset (k=60, 3x fetch) stays in rules/core-hybrid-search.md and rules/pgvector-hybrid-search.md
Field-weighted boosting and scoring profiles as a concepthttps://learn.microsoft.com/en-us/azure/search/index-add-scoring-profiles; our boost factors and their ordering are in House delta and rules/pgvector-metadata.md
Embedding API mechanics: batch limits, input_type, dimensions, pricinghttps://docs.voyageai.com/docs/embeddings and https://platform.openai.com/docs/guides/embeddings; model choice stays in rules/embeddings-models.md
Retrieval metric definitions (precision@k, recall@k, MRR, nDCG) and building the query setork skill golden-dataset
Search endpoint shape, pagination, error bodiesork skill api-design
Tracing and dashboarding search callsork skill monitoring-observability
Writing the integration test that runs these assertionsork skill testing-integration

Common Mistakes

  1. No citation tracking (unverifiable answers)
  2. Context too large (dilutes relevance)
  3. Single retrieval method (misses keyword matches)
  4. Not chunking long documents (context gets lost)
  5. Embedding queries differently than documents
  6. No fallback path in agentic RAG (workflow hangs)
  7. Infinite rewrite loops (no retry limit)
  8. Using wrong similarity metric (cosine vs euclidean)
  9. Not caching embeddings (recomputing unchanged content)
  10. Missing image captions in multimodal RAG (limits text search)

Evaluations

See test-cases.json for 30 test cases across all categories.

There is no pass-rate, precision, recall, or MRR floor for this skill. Earlier wording here promised those numbers; they were never measured and are written down nowhere. They are left unset rather than filled in with plausible-looking values, because a threshold nobody measured is worse than an absent one: it gets cited in review as though it means something, and passes or fails changes for no defensible reason. test-cases.json is the right substrate for establishing real ones, and a baseline run over those 30 cases would produce numbers worth asserting.

The one budget this skill does assert is latency, in House delta.

Related Skills

  • ork:langgraph - LangGraph workflow patterns (for agentic RAG workflows)
  • ork:golden-dataset - Evaluate retrieval quality
  • ork:llm-integration - Local embeddings with nomic-embed-text
  • ork:multimodal-llm - Image analysis for multimodal RAG
  • ork:database-patterns - Schema design for vector search
  • ork:performance - Caching repeated RAG responses

Capability Details

retrieval-patterns

Keywords: retrieval, context, chunks, relevance, rag Solves:

  • Retrieve relevant context for LLM
  • Implement RAG pipeline with citations
  • Optimize retrieval quality

hybrid-search

Keywords: hybrid, bm25, vector, fusion, rrf Solves:

  • Combine keyword and semantic search
  • Implement reciprocal rank fusion
  • Balance precision and recall

embeddings

Keywords: embedding, text to vector, vectorize, chunk, similarity Solves:

  • Convert text to vector embeddings
  • Choose embedding models and dimensions
  • Implement chunking strategies

contextual-retrieval

Keywords: contextual, anthropic, context-prepend, bm25 Solves:

  • Prepend context to chunks for better retrieval
  • Reduce retrieval failures by 67%
  • Implement hybrid BM25+vector search

hyde

Keywords: hyde, hypothetical, vocabulary mismatch Solves:

  • Bridge vocabulary gaps in semantic search
  • Generate hypothetical documents for embedding
  • Handle abstract or conceptual queries

agentic-rag

Keywords: self-rag, crag, corrective, adaptive, grading Solves:

  • Build self-correcting RAG workflows
  • Grade document relevance
  • Implement web search fallback

multimodal-rag

Keywords: multimodal, image, clip, vision, pdf Solves:

  • Build RAG with images and text
  • Cross-modal search (text → image)
  • Process PDFs with mixed content

query-decomposition

Keywords: decompose, multi-concept, complex query Solves:

  • Break complex queries into concepts
  • Parallel retrieval per concept
  • Improve coverage for compound questions

reranking

Keywords: rerank, cross-encoder, precision, scoring Solves:

  • Improve search precision post-retrieval
  • Score relevance with cross-encoder or LLM
  • Combine multiple scoring signals

pgvector-search

Keywords: pgvector, postgresql, hnsw, tsvector, hybrid Solves:

  • Production hybrid search with PostgreSQL
  • HNSW vs IVFFlat index selection
  • SQL-based RRF fusion

House delta

Inlined rather than placed in references/: this skill carries its house knowledge in rules/ (32 files) and has never had a references/ directory, so a lone delta file there would be the only occupant.

Embedding-model choice, chunking algorithms, vector-index tuning, reranker APIs and the query-rewriting literature are vendor and upstream territory; see Upstream coverage for where each lives. What follows is only what OrchestKit adds, contradicts, or has to warn about.

Retrieval latency budget: p95 under 500ms end to end

Source: checklists/rag-quality.md:57, the only retrieval budget this skill has ever actually asserted. It covers the whole path a user waits on (embed the query, search, rerank, assemble context), not one stage in isolation. A pipeline that clears 500ms per stage and blows it in aggregate has failed this budget.

Measure at p95, not mean. Retrieval latency is dominated by tail behaviour (cold index shards, reranker queueing), and a mean hides exactly the requests users complain about.

Corpus-specific tuning does not transfer

Fusion weights, rerank depth and hybrid alpha are properties of a corpus, not of the technique. A weighting that lifts recall on prose documentation regularly hurts it on code or tabular data, so values copied between projects are noise rather than a starting point. Re-derive them per corpus against that corpus's own eval set.

Apply metadata boosting after RRF fusion, never before

Why: boost factors multiply onto the RRF score of an already-fused result set and the list is then re-sorted, using section-title match 1.5x, section-path match 1.15x, and code block on a technical query 1.2x; boosting per-method scores before fusion destroys the property RRF depends on (it fuses by rank, not by score) and lets a lone strong keyword hit outrank a document both methods agreed on, and this exact order is what produced the +6% MRR credited to boosting in rules/pgvector-metadata.md (distilled from the retired checklists/search-implementation-checklist.md and examples/examples/orchestkit-retrieval.md; no traced incident). Upstream: https://learn.microsoft.com/en-us/azure/search/index-add-scoring-profiles

Stop raising the RRF fetch multiplier past 3x

Why: measured pass rate on the reference corpus went 87.2% at 1x, 89.5% at 2x, 91.1% at 3x, 91.3% at 4x, so the fourth multiple bought 0.2 points for a third more rows scanned per method, which is why 3x is the house default hard-coded in rules/core-hybrid-search.md and rules/pgvector-hybrid-search.md; raise it only with a golden-set number that beats this curve (distilled from the retired examples/examples/orchestkit-retrieval.md; no traced incident). Upstream: https://www.elastic.co/docs/reference/elasticsearch/rest-apis/reciprocal-rank-fusion

Gate every retrieval change on the golden-set thresholds

Why: the house bar before a retrieval change ships is pass rate at least 90% on the golden query set, precision@10 at least 0.70, recall@10 at least 0.85, and MRR at least 0.65, floors set just under the reference pipeline's observed 91.6% pass rate and 0.777 overall MRR (0.695 on the hard slice) so that a real regression trips them instead of a noisy run (distilled from the retired checklists/search-implementation-checklist.md and examples/examples/orchestkit-retrieval.md; no traced incident). Upstream: ork skill golden-dataset

Assert search latency per stage, not just end to end

Why: the integration test asserts vector search under 100ms, keyword search under 50ms, and fused hybrid under 150ms separately, against an observed 415-chunk baseline of P50 15ms / P95 32ms / P99 62ms, because a single total-latency assertion stays green while one stage silently doubles, which is precisely the shape of an index that quietly stopped being used (distilled from the retired checklists/search-implementation-checklist.md and examples/examples/orchestkit-retrieval.md; no traced incident). Upstream: https://www.postgresql.org/docs/current/using-explain.html

Budget the embedding call before tuning the index

Why: in the reference measurement the query embedding was P50 8ms of a 15ms end-to-end search against 2ms for vector search and 3ms for keyword search, and it was the throughput ceiling at roughly 120 requests per second, so cache and batch embeddings first because index tuning below that ceiling moves the total by single-digit percent (distilled from the retired examples/examples/orchestkit-retrieval.md; no traced incident). Upstream: https://docs.voyageai.com/docs/embeddings

FAQ

What does the rag-retrieval skill do?

Retrieval-Augmented Generation patterns for grounded LLM responses. Use when building RAG pipelines, embedding documents, implementing hybrid search, contextual retrieval, HyDE, agentic RAG, multimodal RAG, query decomposition, reranking, or pgvector search.

How do I install rag-retrieval?

Run npx skills add https://github.com/yonatangross/orchestkit --skill rag-retrieval in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/rag-retrieval/ (personal) or .claude/skills/rag-retrieval/ (project).

Which AI agents can use rag-retrieval?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is rag-retrieval safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains rag-retrieval?

It is published by yonatangross in yonatangross/orchestkit. It has 1,508 recorded installs.

More from yonatangross/orchestkit

View all →

devops-deployment

yonatangross/orchestkit

Use when setting up CI/CD pipelines, containerizing applications, deploying to Kubernetes, or writing infrastructure as code. DevOps & Deployment covers GitHub Actions, Docker, Helm, and Terraform patterns.

DevOps & Cloud1.6K installs

responsive-patterns

yonatangross/orchestkit

Responsive design with Container Queries, fluid typography, cqi/cqb units, subgrid, intrinsic layouts, foldable devices, and mobile-first patterns for React applications. Use when building responsive layouts or container queries.

Frontend & Design1.6K installs

architecture-decision-record

yonatangross/orchestkit

ADR templates in the Nygard format with context, decision, consequences, and alternatives. Use when writing ADRs, recording an architectural decision, or evaluating options.

ui-components

yonatangross/orchestkit

UI component library patterns for shadcn/ui and Radix Primitives. Use when building accessible component libraries, customizing shadcn components, using Radix unstyled primitives, or creating design system foundations.

Frontend & Design1.5K installs

zustand-patterns

yonatangross/orchestkit

Reference for Zustand 5.x state management including slices, middleware, Immer, useShallow, persistence, selectors, and devtools integration. Documents 7 core patterns with TypeScript examples and anti-patterns. Use when building React state management with Zustand instead of Redux.

Frontend & Design1.4K installs

agent-orchestration

yonatangross/orchestkit

Agent orchestration patterns for agentic loops, multi-agent coordination, alternative frameworks, and multi-scenario workflows. Use when building autonomous agent loops, coordinating multiple agents, evaluating CrewAI/AutoGen/Swarm, or orchestrating complex multi-step scenarios.

AI & Agents1.4K installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs