Skip to main content
skill CX Codex

rag-implementer — Claude Code skill: what it does, how to install

rag-implementer guides an agent through a retrieval-augmented generation build, from chunking and embeddings to hybrid retrieval and quality metrics.

MIT 121 installs ★ 29 updated 2026-08-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add oakoss/agent-skills --skill rag-implementer -a claude-code
Open on GitHub

What rag-implementer does

The skill treats RAG as three stages: retrieve documents, assemble context, generate an answer with sources attached. Its reference tables cover hybrid dense plus BM25 retrieval, cross-encoder re-ranking, MMR, reciprocal rank fusion, contextual compression, GraphRAG and proposition chunking. Vector store picks run from Pinecone and Qdrant to pgvector and Milvus; embedding picks include text-embedding-3-large at 3072 dimensions.

Eight phases set the order of work, from mapping sources and picking an embedding model through deployment and later tuning. Quality gets measured with Precision@K, Recall@K, faithfulness and end-to-end latency.

Before any of that, the skill asks whether RAG is warranted. An FAQ page, keyword search or plain semantic search may cover the case for less money. Its threshold is 50k+ documents, confirmed demand and a $200-500 monthly budget. Chunking deserves attention early: a weak strategy costs 9% recall on its own, so settle it before you benchmark and the gap will not look like a model problem. Architecture and graph work belong to knowledge-base-manager and knowledge-graph-builder.

What it helps with

  • pick a chunking strategy that fits the document layout
  • benchmark embedding models on your own corpus
  • wire up hybrid search with BM25 alongside dense vectors
  • add cross-encoder re-ranking and MMR de-duplication
  • measure Recall@K and faithfulness before and after changes

Example prompts for the agent

  • Design a RAG pipeline over the files in docs/ and justify the chunking you pick.
  • Benchmark text-embedding-3-small against multilingual-e5-large on our corpus and report Recall@K.
  • Add cross-encoder re-ranking and MMR so near-duplicate chunks stop filling the top results.

How to install rag-implementer

1Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill rag-implementer -a claude-code

2Manually: put the files in place

~/.claude/skills/rag-implementer/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/rag-implementer/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about rag-implementer

How do I install rag-implementer in Claude Code?

Run npx skills add oakoss/agent-skills --skill rag-implementer -a claude-code. The skill file lands at ~/.claude/skills/rag-implementer/SKILL.md.

What does rag-implementer do?

It walks an agent through building a retrieval-augmented generation pipeline: chunking, embedding model choice, a vector store, hybrid search with re-ranking, and evaluation.

Does every project need a RAG pipeline?

No. The skill suggests trying an FAQ page, keyword search or plain semantic search first, and names 50k+ documents with confirmed demand and a $200-500 monthly budget as its threshold for building one.

Source text

SKILL.md · MIT
---
name: rag-implementer
description: 'Implements retrieval-augmented generation pipelines. Use when building document retrieval systems, choosing chunking strategies, selecting embedding models, configuring vector stores, implementing hybrid search, or evaluating RAG quality. Use for embedding strategy, vector stores, retrieval pipelines, chunking, hybrid search, re-ranking, multi-query retrieval, parent document retrieval, contextual compression, MMR diversity selection, reciprocal rank fusion, and evaluation. For KB architecture selection and governance, use the knowledge-base-manager skill. For knowledge graphs, use the knowledge-graph-builder skill.'
license: MIT
metadata:
  author: oakoss
  version: '1.2'
  source: https://docs.anthropic.com/en/docs/build-with-claude/retrieval-augmented-generation
---

# RAG Implementer

Build production-ready retrieval-augmented generation systems. RAG = Retrieval + Context Assembly + Generation. Use RAG when LLMs need access to fresh, domain-specific, or proprietary knowledge not in their training data. Do not use RAG when simpler alternatives (FAQ pages, keyword search, semantic search) suffice. For KB architecture selection and governance, use the `knowledge-base-manager` skill. For knowledge graph implementation, use the `knowledge-graph-builder` skill.

## Overview

Before building RAG, validate the need: try FAQ pages, keyword search, concierge MVP, or simple semantic search first. Only proceed with RAG for 50k+ documents with validated user demand and $200-500/month budget. RAG systems range from Naive (prototype) through Advanced (production) to Modular (enterprise), each tier adding complexity and cost.

The RAG pipeline has three core stages. First, **retrieval** finds relevant documents using hybrid search (semantic + keyword). Second, **context assembly** ranks, deduplicates, and compresses retrieved chunks into an optimal prompt. Third, **generation** produces a grounded response with source attribution. Each stage has distinct failure modes: retrieval can miss relevant documents (low recall), context assembly can overwhelm the model (lost in the middle), and generation can hallucinate despite good context (low faithfulness).

Modern RAG extends beyond basic vector similarity. Hybrid search combining dense embeddings with sparse BM25 is now the baseline. Re-ranking with cross-encoders improves precision after initial retrieval. Contextual chunking and late chunking preserve document-level semantics that fixed-size chunking loses. GraphRAG enables multi-hop reasoning over entity relationships by building knowledge graphs from documents. Proposition chunking breaks documents into atomic facts for precise retrieval of individual claims.

Choose techniques based on your query complexity and document structure. Start with hybrid search and re-ranking as the foundation, then layer contextual chunking, GraphRAG, or query expansion as needed. Measure everything: Precision@K, Recall@K, faithfulness, and end-to-end latency. The difference between a good and bad chunking strategy alone can create a 9% gap in recall performance.

## Quick Reference

| Phase                     | Goal                            | Key Actions                                               |
| ------------------------- | ------------------------------- | --------------------------------------------------------- |
| 1. Knowledge Base Design  | Structured knowledge foundation | Map sources, define chunking, add metadata                |
| 2. Embedding Strategy     | Semantic understanding          | Select model, benchmark on domain data                    |
| 3. Vector Store           | Scalable storage                | Choose DB, configure index, plan scaling                  |
| 4. Retrieval Pipeline     | Beyond simple similarity        | Hybrid retrieval, query enhancement, re-ranking           |
| 5. Context Assembly       | Optimal LLM context             | Rank, synthesize, compress, mitigate "lost in the middle" |
| 6. Evaluation             | Measure performance             | Precision@K, Recall@K, faithfulness, latency              |
| 7. Production Deploy      | Enterprise reliability          | Containerize, cache, graceful degradation, security       |
| 8. Continuous Improvement | Ongoing enhancement             | Auto-updates, fine-tuning, optimization                   |

| Decision                      | Options                                                |
| ----------------------------- | ------------------------------------------------------ |
| Vector DB (managed)           | Pinecone                                               |
| Vector DB (self-hosted)       | Weaviate, Qdrant                                       |
| Vector DB (lightweight)       | Chroma                                                 |
| Vector DB (existing Postgres) | pgvector                                               |
| Vector DB (billion-scale)     | Milvus / Zilliz                                        |
| Embedding (general)           | `text-embedding-3-large` (3072 dim)                    |
| Embedding (cost-optimized)    | `text-embedding-3-small` (1536 dim)                    |
| Embedding (code)              | Voyage Code 3                                          |
| Embedding (multilingual)      | `multilingual-e5-large`, Cohere embed-v4               |
| Chunking (fixed)              | 500-1000 tokens, 50-100 overlap                        |
| Chunking (semantic)           | Paragraph/section/topic boundaries                     |
| Chunking (recursive)          | Markdown headers, code blocks                          |
| Chunking (contextual)         | LLM-generated summaries prepended to each chunk        |
| Chunking (late)               | Full-document embedding, then pool by chunk boundaries |

| Cost Tier                 | Time      | Monthly Cost | Scale            |
| ------------------------- | --------- | ------------ | ---------------- |
| Naive RAG (prototype)     | 1-2 weeks | $50-150      | <10k documents   |
| Advanced RAG (production) | 3-4 weeks | $200-500     | 10k-1M documents |
| Modular RAG (enterprise)  | 6-8 weeks | $500-2000+   | 1M+ documents    |

| Advanced Technique     | When to Use                                                   |
| ---------------------- | ------------------------------------------------------------- |
| Hybrid search          | Always -- combine semantic + keyword (BM25) for better recall |
| Re-ranking             | When initial retrieval returns noisy results                  |
| Contextual retrieval   | Documents with ambiguous references or pronouns               |
| Late chunking          | Efficiency-focused pipelines with anaphoric references        |
| GraphRAG               | Multi-hop reasoning over structured knowledge relationships   |
| Proposition chunking   | Fact-dense documents requiring atomic retrieval units         |
| Query expansion / HyDE | Queries that are short, ambiguous, or under-specified         |

## Common Mistakes

| Mistake                                                                     | Correct Pattern                                                                                           |
| --------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| Building RAG before validating user need                                    | Try simpler alternatives first (FAQ, keyword search, concierge MVP); only build RAG with validated demand |
| Using a single retrieval method (semantic only)                             | Implement hybrid retrieval combining semantic search with keyword (BM25) for better recall                |
| Dumping all available data into the knowledge base                          | Curate data sources carefully; filter noise, select authoritative content, and maintain quality           |
| Ignoring the "lost in the middle" problem                                   | Place critical information at the start and end of context; compress mid-section                          |
| Skipping evaluation metrics before production                               | Establish baselines for Precision@K, Recall@K, faithfulness, and hallucination rate before deploying      |
| Using `text-embedding-3-large` at full 3072 dimensions without benchmarking | Test at reduced dimensions (1024 or 1536) first -- often comparable accuracy at lower cost                |
| Fixed-size chunking for all document types                                  | Match chunking strategy to document structure; use semantic or recursive chunking for structured content  |
| Ignoring metadata filtering                                                 | Attach rich metadata (source, date, category) and filter before or during vector search                   |

## Embedding Model Notes

`text-embedding-3-large` (3072 dimensions) remains OpenAI's most capable embedding model. It supports Matryoshka dimensionality reduction via the `dimensions` API parameter -- 1024 dimensions often delivers near-full accuracy at one-third storage cost. `text-embedding-3-small` (1536 dimensions) is a cost-effective alternative at $0.02 per million tokens. For code search, Voyage Code 3 outperforms general-purpose models. For multilingual workloads, consider `multilingual-e5-large` or Cohere embed-v4. Always benchmark on your domain data; general benchmarks do not predict domain-specific performance.

## Vector Store Notes

Pinecone for managed simplicity, Weaviate or Qdrant for self-hosted with hybrid search, Chroma for prototyping, pgvector for teams already on PostgreSQL (practical limit around 10-100M vectors), and Milvus/Zilliz for billion-scale deployments. Choose index type based on tradeoffs: HNSW for speed (higher memory), IVF for scale (requires training), flat for exact search on small datasets only.

Most vector databases now achieve 10-100ms query latency on 1-10M vector datasets. Start with the simplest option that fits your scale requirements and migrate only when you hit concrete performance limits.

## Delegation

- **Discover data sources and assess knowledge base quality**: Use `Explore` agent to catalog documents, evaluate data freshness, and identify authoritative content
- **Implement retrieval pipeline with hybrid search and re-ranking**: Use `Task` agent to build embedding, indexing, retrieval, and evaluation components
- **Design RAG architecture and vector store topology**: Use `Plan` agent to select embedding models, vector databases, chunking strategies, and deployment architecture

> For KB architecture selection, curation workflows, and governance, use the `knowledge-base-manager` skill. For knowledge graph implementation (ontology, entity extraction, graph databases), use the `knowledge-graph-builder` skill.

## References

- [Architecture patterns and prerequisites](references/architecture-patterns.md)
- [Chunking strategies and knowledge base design](references/chunking-strategies.md)
- [Retrieval methods and pipeline design](references/retrieval-methods.md)
- [Evaluation metrics and quality gates](references/evaluation.md)
- [Production deployment and continuous improvement](references/production-deployment.md)

© oakoss · MIT · oakoss/agent-skills

Similar skills

All skills for AI and ML →

From the same set106

The whole set →
storybook-stories Writes Storybook stories and interaction tests in CSF3 format. Handles component examples, Chromatic visual snapshot setup, and accessibility checks. CX Codex +1 124installs shell-integration The shell-integration Claude Code skill provides terminal integration guides and Bash, Zsh, and Fish patterns for completions, prompt hooks, and portable POSIX wrappers. CX Codex +1 123installs usability-tester usability-tester plans usability test sessions, evaluates interfaces against heuristic standards, and scores UX friction points using severity formulas. CX Codex +1 122installs react-email Build responsive HTML emails from React Email components and render them as HTML or plain text. Useful for transactional messages and marketing templates. CX Codex +1 122installs service-worker service-worker guides the coding assistant in configuring Workbox v7.4 caching, offline app shells, background sync, and push notifications. CX Codex +1 121installs cli-power-tools cli-power-tools guides coding agents to use fast Rust-based command-line utilities and structured parsers instead of legacy shell pipelines. CX Codex +1 121installs quality-auditor quality-auditor runs a weighted audit across 12 dimensions, scores each one against cited evidence and hands back a prioritized fix list. CX Codex +1 120installs package-publishing package-publishing guides npm package metadata, ESM and CJS builds, and TypeScript declarations. Useful when preparing a library’s public entry points or publishing workflow. CX Codex +1 119installs

Project sponsors

Companies that keep this analytics open