agentleFS
pathiec92pathiec92/claude-skills/skills/rag-system-design/SKILL.md

rag-system-design

Skill0 starsChanged 5 months agoMITView on GitHub

Design or review a production RAG (retrieval-augmented generation) system — ingestion, chunking, embeddings, vector store, retrieval, reranking, prompt assembly, generation, and evaluation / hallucination control. Use when building or debugging RAG, semantic search, or Q&A-over-documents, or when retrieval quality is poor. NOT for generic ML systems (use ml-system-design).

The file

Files
SKILL.md

RAG System Design

Walk every stage. Most RAG failures are retrieval failures, not model failures — diagnose retrieval before blaming the LLM.

Ingestion & chunking

  • Source parsing (PDF/HTML/code) and cleaning
  • Chunk size & overlap; semantic vs fixed-size splitting
  • Metadata captured per chunk (source, section, timestamp, ACL)

Embeddings & index

  • Embedding model choice and dimensionality
  • Vector store & index type (HNSW/IVF); recall vs latency
  • Hybrid search (dense + lexical/BM25)

Retrieval & reranking

  • top-k selection and filters (metadata, freshness, permissions)
  • Reranker (cross-encoder) when precision matters
  • Query rewriting / expansion / multi-query

Generation & grounding

  • Prompt assembly and context-window budgeting
  • Citation / source attribution
  • Refusal when context is insufficient (anti-hallucination)

Evaluation

  • Retrieval: recall@k, MRR, context precision
  • Generation: faithfulness/groundedness, answer relevance
  • Golden set + automated eval in CI

Ops & cost

  • Index freshness / re-embedding strategy
  • Latency budget per stage
  • Cost per query (embedding + retrieval + generation tokens)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.