rag
Use when building Retrieval-Augmented Generation systems - covers document ingestion, hybrid search retrieval, reranking results, and prompt augmentation for accurate LLM responses grounded in your knowledge base
npx skills add majiayu000/claude-skill-registry --skill rag-juanre-llmemory --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Instructs an agent to build a Retrieval-Augmented Generation system by ingesting documents, performing hybrid retrieval, optionally reranking results, and augmenting prompts with retrieved context to generate grounded NLG.
How it works
- Ingest: Add documents to the RAG system (using a documented ingestion flow with chunking and optional summaries).
- Retrieve: Search for relevant chunks with a hybrid (semantic + lexical) approach and enable query expansion for recall.
- Rerank: Optionally rerank retrieved candidates using either local cross-encoder or OpenAI-based rerankers, with configurable top-k and return-k settings.
- Augment: Build a prompt that includes the retrieved context (sources and content) for the LLM.
- Generate: Call the LLM (e.g., via API) to produce the final grounded answer.
The pipeline supports a production routing capability to decide whether to answer from the KB, route to web/search, or return an unanswerable/clarification message, with a structured API for routing decisions. It also provides detailed configuration for document ingestion (chunking), retrieval (search_type, alpha, expansions, rerank), and reranking (providers, models, and parameters).
When to use it
- For question answering over your documents
- Customer support with a knowledge base
- Research assistance
- Code/documentation search
- Any application needing source-backed, grounded answers
What it can touch
- Tools: claude-code (as declared)
- It demonstrates usage via Python code snippets importing llmemory and OpenAI, constructing memory instances, ingestions, searches, and prompt construction.
Caveats
- Deployment notes include optional reranking providers (OpenAI or local cross-encoder) and corresponding configuration requirements.
- Reranking may incur API costs when using external providers; local reranking requires installing extra dependencies (e.g., llmemory[reranker-local]).
- The skill describes a specific memory initialization, ingestion parameters, and prompts construction but does not guarantee any particular output quality from the LLM.
# LLMemory RAG Systems ## Installation ```bash uv add llmemory # For reranking support uv add "llmemory[reranker-local]" # Local cross-encoder models # or configure OpenAI reranking (no extra install needed) ``` ## Overview Retrieval-Augmented Generation (RAG) combines llmemory's document retrieval with LLM generation for accurate, grounded responses. **RAG Pipeline:** 1. **Ingest**: Add documents to llmemory 2. **Retrieve**: Search for relevant chunks 3. **Rerank**: Improve relevance ordering (optional but recommended) 4. **Augment**: Build prompt with retrieved context 5. **Generate**: Get LLM response **When to use RAG:** - Question answering over your documents - Customer support with knowledge base - Research assistance - Code documentation search - Any application needing accurate, source-backed answers ## Quick Start ```python from llmemory import LLMemory, SearchType, DocumentType from openai import AsyncOpenAI async def rag_system(): # Initialize memory = LLMemory( connection_string="postgresql://localhost/mydb", openai_api_key="sk-..." ) await memory.initialize() # 1. Ingest documents await memory.add_document( owner_id="workspace-1", id_at_origin="kb", document_name="pro
- Installation
- Overview
- Quick Start
- Query Routing for Production RAG
- searchwithrouting()
- Complete RAG Pipeline
- Step 1: Document Ingestion
- Step 2: Retrieval Configuration
- Step 3: Reranking Configuration
- Reranker API Reference
- CrossEncoderReranker
- OpenAIResponsesReranker
- RerankerService
- SearchResult Fields Reference
uv add llmemory For reranking support uv add "llmemory[reranker-local]" # Local cross-encoder models or configure OpenAI reranking (no extra install needed) Install local reranker dependencies uv add "llmemory[reranker-local]" Requires sentence-transformers
What does the rag skill do?
Use when building Retrieval-Augmented Generation systems - covers document ingestion, hybrid search retrieval, reranking results, and prompt augmentation for accurate LLM responses grounded in your knowledge base
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill rag-juanre-llmemory --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
