rag-patterns
Retrieval-Augmented Generation patterns and best practices. Implement chunking, embedding, retrieval, reranking, and generation pipelines. Use for knowledge-grounded AI, document QA, and semantic search applications.
npx skills add majiayu000/claude-skill-registry --skill rag-patterns --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.
# RAG Patterns Expert guidance for Retrieval-Augmented Generation systems. ## Basic RAG Pipeline ```python from openai import OpenAI from sentence_transformers import SentenceTransformer import chromadb # Initialize client = OpenAI() embedder = SentenceTransformer('all-MiniLM-L6-v2') chroma = chromadb.Client() collection = chroma.create_collection("documents") # Index documents def index_documents(documents: list[str]): embeddings = embedder.encode(documents) collection.add( documents=documents, embeddings=embeddings.tolist(), ids=[f"doc_{i}" for i in range(len(documents))] ) # Retrieve and generate def rag_query(query: str, top_k: int = 5) -> str: # Embed query query_embedding = embedder.encode([query])[0] # Retrieve results = collection.query( query_embeddings=[query_embedding.tolist()], n_results=top_k ) # Format context context = "\n\n".join(results['documents'][0]) # Generate response = client.chat.completions.create( model="gpt-4o", messages=[ {"role": "system", "content": f"Answer based on context:\n\n{context}"}, {"role": "user", "content": query} ] ) return response.choices[0].message.content ``` ## Chunking Strategies ### Fixed Size Chunking ```python def chunk_fixed_size
- Basic RAG Pipeline
- Chunking Strategies
- Fixed Size Chunking
- Semantic Chunking
- Sentence-Based Chunking
- Document Structure Chunking
- Embedding Strategies
- Hybrid Embeddings
- Multi-Vector Embeddings
- Retrieval Strategies
- Query Expansion
- HyDE (Hypothetical Document Embeddings)
- Reranking
- Cross-Encoder Reranking
What does the rag-patterns skill do?
Retrieval-Augmented Generation patterns and best practices. Implement chunking, embedding, retrieval, reranking, and generation pipelines. Use for knowledge-grounded AI, document QA, and semantic search applications.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill rag-patterns --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.
