/builder-ai:rag-pipeline-designfrom builder-ai
Use when designing or auditing a retrieval-augmented generation pipeline. Requires data audit and query audit before any design decision. Blocks "I'll use the standard setup" completions.
Ships in builder-ai. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
YOU CANNOT DESIGN A RAG PIPELINE WITHOUT FIRST AUDITING THE DATA AND THE QUERIES.
"Standard chunking" fails on structured documents.
"The embedding model worked for someone else" is not a validation.
A data audit + query audit + stage-by-stage decision log IS a design.
Trigger when:
A RAG pipeline has five stages. Design each explicitly — do not accept defaults.
Answer both audits before making any pipeline decision:
Data Audit:
Query Audit:
Every design decision below flows from these two audits.
| Document Type | Strategy | Chunk Size | Overlap |
|---|---|---|---|
| Prose / narrative | Sentence boundary | 256–400 tokens | 15% |
| Structured (headings, sections) | Section boundary | 512–800 tokens | 10% |
| Code | Function / class boundary | Variable | None |
| Tables / CSV | Row or row-group | 128–256 tokens | None |
Always attach metadata to every chunk: source, date, section, page, chunk_index.
Choose based on domain, not on general benchmark:
Do not skip the validation. General benchmarks do not predict domain-specific performance.
| Query Type | Strategy | Why |
|---|---|---|
| Semantic similarity | Dense only | Query and documents share conceptual vocabulary |
| Keyword / exact match | Sparse (BM25) | Overlap in exact terms matters more than semantics |
| General / mixed | Hybrid (dense + BM25 via RRF) | Covers both; best default |
Set top_k to 5 as the starting point. Increase only if recall@5 is below threshold.
Add a reranker when:
top_k > 5 AND the context window is constrainedCross-encoder for maximum precision. Cohere Rerank for cost/speed balance.
Do not add a reranker first and tune top_k later. Set top_k, measure recall, add reranker only if needed.
These thoughts mean the pipeline was not designed — stop:
When rag-pipeline-design is satisfied, state it like this:
RAG pipeline designed.
Data audit: rag-audit/<feature>/data-audit-<date>.md ✓
Format: <format>, avg length: <N tokens>, structure-bearing: yes/no
Query audit: <dominant type>, attribution needed: yes/no
Chunking: <strategy>, <chunk size> tokens, <overlap>%, metadata: source/date/section ✓
Embedding: <model>, validated on <N>-example domain similarity test (rank correlation: X) ✓
Retrieval: <dense/sparse/hybrid>, top_k=N, similarity threshold=X ✓
Reranking: <model or "none — top_k ≤ 5"> ✓
Generation: context budget ≤ 40%, citations required, faithfulness check ✓
Retrieval recall@k baseline: <to be measured / X%>
Generic RAG pipelines are built for generic data and generic queries. Production systems have specific documents and specific query patterns. Every mismatch between the pipeline design and the actual data/query distribution surfaces as hallucination, missed context, or high latency — at a cost that scales with volume.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
builder-ai@rbraga01 is listed by rbraga01/a-team — review the source before installing
npx claudepluginhub rbraga01/a-team --plugin builder-ai8 skills in this plugin
/ai-cost-auditUse before launching any LLM feature or when monthly API costs are growing unexpectedly. Requires token count measurement, call volume analysis, and cost projection at 10× scale. Blocks "it's cheap enough now" completions./ai-safety-reviewUse before shipping any LLM feature that touches users. Reviews prompt injection, hallucination risk, output misuse, agentic scope, and abuse vectors. Blocks "nobody will try that" completions./context-optimizationUse when prompt cost is too high, latency is above threshold, or context window limits are being approached. Requires measurement before and after each reduction. Blocks "I shortened the prompt so it should be cheaper" completions./eval-before-shipUse before merging, deploying, or demo'ing any LLM feature. Requires documented eval results — pass rate, failure analysis, baseline comparison. Blocks "it looked good when I tested it" completions./fallback-requiredUse before merging any PR that adds an LLM API call. Every call must handle timeout, malformed output, low confidence, and refusal — with a defined, user-safe fallback for each. Blocks "add error handling later" completions./model-benchmarkingUse when selecting a model for any production feature, or evaluating whether to switch models. Requires task-specific benchmarking — not leaderboard lookup. Blocks "GPT-4 is the best model" decisions.