rag-pipeline-engineering
Skill1 starsChanged 17 days agoMITView on GitHub
Build or improve retrieval-augmented generation pipelines, from document ingestion and chunking to retrieval, grounding, citations, and production evaluation.
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Clean carefully: Remove boilerplate and duplicates without deleting qualifications, table relationships, code, or critical context.
- Distinctive: line 15
Chunk semantically: Prefer section-aware boundaries and preserve parent/child relationships.
- Distinctive: line 20
Handle insufficient evidence: Ask a clarifying question, search again under a bounded policy, or abstain.
- Distinctive: line 21
Evaluate end to end: Test ingestion, retrieval, answer quality, permissions, latency, and cost separately and together.
- Distinctive: line 30
Use metadata filtering for tenant, time, type, and access scope.
- Distinctive: line 33
Consider reranking, query rewriting, multi-query, or agentic retrieval only when a baseline demonstrates a gap.
- Distinctive: line 34
Keep a deterministic baseline before adding agent loops.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
RAG Pipeline Engineering
Goal
Build a retrieval-augmented generation (RAG) pipeline that retrieves authorized, relevant evidence and uses it to answer questions with traceable support. RAG reduces some knowledge gaps; it does not guarantee correctness.
Workflow
- Define the knowledge task. Identify query types, source systems, freshness requirements, access controls, languages, document types, and answerability criteria.
- Inventory and ingest. Extract text and structure from supported formats. Preserve headings, tables, page/section identifiers, source URI, timestamp, tenant/ACL metadata, and document version.
- Clean carefully. Remove boilerplate and duplicates without deleting qualifications, table relationships, code, or critical context. Record extraction failures.
- Chunk semantically. Prefer section-aware boundaries and preserve parent/child relationships. Tune chunk size and overlap using evaluation rather than defaults alone.
- Select retrieval. Compare lexical search, dense vectors, hybrid retrieval, metadata filters, and domain-specific query expansion. Enforce authorization filters before returning content.
- Rerank when justified. Rerank a bounded candidate set if measured gains outweigh latency and cost. Preserve source metadata through every transformation.
- Construct grounded context. Deduplicate, order evidence, cap token budget, and instruct the model to distinguish supported claims from missing evidence.
- Generate with citations. Make citations refer to actual retrieved chunks or stable document locations. Validate citation IDs before returning them.
- Handle insufficient evidence. Ask a clarifying question, search again under a bounded policy, or abstain. Do not fabricate a citation or answer merely to appear helpful.
- Evaluate end to end. Test ingestion, retrieval, answer quality, permissions, latency, and cost separately and together.
Evaluation dimensions
- Retrieval: recall@k, precision@k, MRR/nDCG where appropriate.
- Answer: correctness, faithfulness to evidence, relevance, completeness, citation validity.
- Operations: index freshness, ingestion errors, p95 latency, token use, cost, and failure rate.
- Security: cross-tenant retrieval, ACL enforcement, poisoned documents, prompt injection, sensitive-data exposure.
Design decisions
- Use metadata filtering for tenant, time, type, and access scope.
- Reindex or incrementally update documents with idempotent jobs and deletion handling.
- Version chunking, embedding model, index configuration, and prompt together.
- Consider reranking, query rewriting, multi-query, or agentic retrieval only when a baseline demonstrates a gap.
- Keep a deterministic baseline before adding agent loops.
Avoid
- Assuming vector similarity equals relevance.
- Treating retrieved text as trusted instructions.
- Losing provenance during chunking or reranking.
- Evaluating only a few hand-picked happy paths.
- Exposing documents because the model was asked to respect permissions; permissions must be enforced by the retrieval layer.
Deliverable
Provide a pipeline diagram or sequence, ingestion/chunking choices, retrieval configuration, citation strategy, evaluation dataset and results, access-control design, and known limitations.
References
- Microsoft AI Agents for Beginners, Agentic RAG: https://github.com/microsoft/ai-agents-for-beginners/tree/main/05-agentic-rag
- Ragas metrics: https://docs.ragas.io/en/latest/concepts/metrics/available_metrics/
- Anthropic contextual retrieval: https://www.anthropic.com/news/contextual-retrieval
In this repository28 other files it gives its agents.
- agent-architecture-designSkill
- agent-evaluationSkill
- agent-harness-engineeringSkill
- agentic-workflow-testingSkill
- agent-memory-designSkill
- browser-computer-useSkill
- durable-agent-workflowsSkill
- human-in-the-loopSkill
- mcp-developmentSkill
- mcp-server-developmentSkill
- multi-agent-orchestrationSkill
- tool-calling-designSkill
- advanced-retrieval-rerankingSkill
- context-engineeringSkill
- embedding-model-engineeringSkill
- llm-evaluationSkill
- llm-observabilitySkill
- model-serving-inferenceSkill
- multimodal-ai-pipelinesSkill
- prompt-engineeringSkill
- rag-engineeringSkill
- structured-outputsSkill
- agentic-securitySkill
- security-reviewSkill
- code-reviewSkill
- debuggingSkill
- test-engineeringSkill
- example-skillSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

