rag-design-patterns

Standardizes chunking, vector database integration, embedding management, and retrieval reranking for RAG pipelines.

2|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/ricardoroche/ricardos-claude-code --skill rag-design-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rag-design-patterns
Source: https://github.com/ricardoroche/ricardos-claude-code/tree/main/.claude/skills/rag-design-patterns
Command: npx skills add https://github.com/ricardoroche/ricardos-claude-code --skill rag-design-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires numpy, pydantic.

What problem does it solve?

This Skill provides a comprehensive guide to building effective Retrieval Augmented Generation (RAG) systems, addressing challenges like irrelevant retrieval, poor context quality, and inefficient vector search. It ensures your LLMs have access to the most relevant and accurate information, significantly improving response quality.

Core Features & Use Cases

  • Document Chunking: Guides on semantic chunking strategies with overlap to preserve context and optimize retrieval.
  • Vector Database Integration: Patterns for integrating with vector stores, adding chunks with embeddings, and performing efficient semantic searches.
  • Reranking & Query Expansion: Implements reranking for improved precision and query rewriting/expansion to enhance recall.
  • Context Assembly: Provides strategies for building concise and token-limited contexts from retrieved chunks for LLM consumption.
  • Use Case: A data scientist is building a chatbot that answers questions based on a large knowledge base. This skill helps them implement semantic chunking, integrate with a vector database, use reranking to prioritize relevant documents, and assemble a concise context for the LLM, leading to more accurate answers.

Quick Start

Implement a semantic chunking strategy for a document, ensuring chunks have appropriate overlap and metadata.

Frequently Asked Questions about rag-design-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement semantic chunking for RAG systems?

Semantic chunking divides documents at meaningful boundaries rather than fixed sizes, preserving context and improving retrieval relevance. Set configurable max_chunk_size and overlap parameters to maintain continuity between chunks while extracting embeddings for vector database storage.

What vector databases work with RAG retrieval systems?

RAG systems integrate with FAISS, Pinecone, Qdrant, and ChromaDB for storing and searching embeddings. These vector stores enable efficient semantic search by comparing query embeddings against indexed chunk vectors to retrieve the most relevant documents.

How do I improve retrieval accuracy in RAG pipelines?

Reranking and query expansion enhance retrieval precision and recall after initial semantic search. Reranking prioritizes retrieved chunks by relevance, while query expansion rewrites or extends queries to capture alternative phrasings and retrieve more comprehensive context for your LLM.

Can I use metadata with document chunks in a vector database?

Yes, metadata propagates across chunks throughout the RAG pipeline, enabling filtered searches, source attribution, and contextual retrieval. Store document properties, chunk indices, and custom fields alongside embeddings to build more intelligent retrieval workflows.

What's the best way to assemble context for LLMs from retrieved chunks?

Context assembly combines retrieved chunks into concise, token-limited prompts that preserve relevance while staying within LLM input limits. Prioritize reranked results, deduplicate overlapping content, and format output to maximize answer quality without exceeding token budgets.

Do I need asynchronous indexing for large RAG knowledge bases?

Asynchronous indexing supports scalable RAG pipelines by processing chunks and embeddings in the background without blocking retrieval operations. This pattern accelerates ingestion of diverse document types and large knowledge bases while maintaining system responsiveness.