RAG Pipeline Builder: Accurate Answers from Your Docs
by Ignasi
Builds and optimizes RAG pipelines with hybrid search, reranking, and rigorous evaluation to eliminate hallucinations.
$3
RAG Pipeline Builder: Accurate Answers from Your Docs
Example session with this skill installed
My RAG system for our HR manuals is hallucinating benefits details and missing specific policy IDs. We use Postgres/pgvector. Can you audit the pipeline and suggest a fix?
- Read your context and instructions
- Compiled the rag pipeline builder
I have audited the HR manual RAG pipeline. The current failures stem from a lack of keyword matching for policy IDs and insufficient chunk context for specific benefits sections.
RAG Audit & Optimization Plan
| Component | Current Issue | Recommended Fix |
|---|---|---|
| Ingestion | PDFs parsed as raw text; tables are fragmented. | Switch to pymupdf4llm to preserve table Markdown and headers. |
| Retrieval | Vector-only search misses exact policy IDs (e.g., "HR-2024-X"). | Implement Hybrid Search (BM25 + pgvector) with RRF. |
| Chunking | Fixed 500-token blocks split mid-sentence. | Use heading-based splitting (300-800 tokens) with 15% overlap. |
| Reranking | Top 5 chunks sent directly to LLM. | Retrieve top 20, then use a cross-encoder to rerank the best 5. |
| Grounding | No "I don't know" rule in prompt. | Update system prompt to enforce citations [n] and strict refusal. |
Implementation Snippet (Hybrid Search)
-- Example Reciprocal Rank Fusion (RRF) logic for pgvector + BM25
WITH semantic_search AS (
SELECT id, row_number() OVER (ORDER BY embedding <=> $1) as rank
FROM document_chunks
LIMIT 20
),
keyword_search AS (
SELECT id, row_number() OVER (ORDER BY ts_rank(content_tsvector, to_tsquery($2)) DESC) as rank
FROM document_chunks
WHERE content_tsvector @@ to_tsquery($2)
LIMIT 20
)
SELECT
COALESCE(s.id, k.id) as chunk_id,
(1.0 / (60 + s.rank) + 1.0 / (60 + k.rank)) as combined_score
FROM semantic_search s
FULL OUTER JOIN keyword_search k ON s.id = k.id
ORDER BY combined_score DESC
LIMIT 5;
Next steps
- Generate an eval set of 30 "gold" Q&A pairs from the HR manual to measure baseline Recall@5.
- Re-index the benefits PDFs using a heading-aware strategy to ensure policy IDs are preserved.
- Configure a reranker (like BGE-reranker) to filter the hybrid search results before generation.
Connects securely to your tools. The creator never sees your data.
About this skill
Stop guessing why your RAG system returns vague or hallucinated answers. This skill builds and fixes retrieval-augmented generation pipelines by focusing on the primary cause of failure: poor retrieval. It moves beyond basic vector search to implement production-grade architectures that prioritize accuracy and grounding.
What it does
- Advanced Ingestion parses complex PDFs, tables, and code while preserving document structure and cleaning boilerplate.
- Strategic Chunking applies specific methods for manuals, FAQs, or code, including contextual headers and semantic overlaps.
- Hybrid Retrieval combines BM25 keyword search with dense vector embeddings using Reciprocal Rank Fusion to handle both semantic meaning and exact IDs.
- Reranking & Filtering optimizes results using cross-encoders and enforces strict metadata-level permissions before generation.
- Automated Evaluation measures performance using recall@k, MRR, and faithfulness rubrics to ensure every answer is backed by a citation.
How it works
- Audit & Scope identifies your document volume, latency budget, and existing database stack like pgvector or Qdrant.
- Pipeline Construction configures the ingestion logic, chunking strategy, and embedding models tailored to your content type.
- Retrieval Tuning implements hybrid search and reranking to ensure the most relevant context reaches the LLM.
- Evaluation Loop runs a test set of Q&A pairs to benchmark retrieval accuracy and answer correctness.
Frameworks & tools
Works with pgvector, Qdrant, Pinecone, Chroma, and OpenSearch. Supports ingestion via pymupdf4llm, docling, and unstructured.
Why this beats prompting it yourself
Prompting alone cannot fix a system where the right data never reaches the model. This skill implements the structural engineering required for RAG, from recursive character splitting to cross-encoder reranking, which simple system instructions cannot replicate.
Use cases
- Build a knowledge-base bot that correctly cites internal technical manuals.
- Fix a semantic search tool that fails to find specific part numbers or codes.
- Implement a multi-tenant RAG system with strict data isolation.
- Optimize a hallucination-prone chat interface with a rigorous eval set.
Known limitations
Requires an existing vector database or a stack capable of hosting one. Performance is limited by the quality and legibility of the source document parsing.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 11 days ago
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
New in LLM Ops
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.