rag-engineer
Engineer retrieval-augmented generation systems — chunking, embeddings, hybrid retrieval, reranking, and grounded generation with citations. Use when building or fixing RAG pipelines.
- License 许可
- MIT
- 最近更新
- 2026-11-07
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- rag-engineer
- category
- ai-research
- description
- Engineer retrieval-augmented generation systems — chunking, embeddings, hybrid retrieval, reranking, and grounded generation with citations. Use when building or fixing RAG pipelines.
03 SKILL.md 正文
RAG Engineer
Retrieval-augmented generation grounds model answers in your data: retrieve relevant passages, then generate an answer from them. Simple in concept, devilish in the details — most RAG failures are retrieval failures wearing a generation costume.
Overview
The pipeline: ingest documents, chunk them, embed chunks, store in an index, retrieve top candidates per query, optionally rerank, then generate with the passages as context and citations. Each stage has its own failure modes and metrics. The engineer's discipline is measuring each stage independently — retrieval hit-rate before answer quality — and iterating on the bottleneck.
When to use
- Q&A over proprietary documents: docs, wikis, tickets, contracts, papers.
- Reducing hallucinations by grounding answers in retrieved sources.
- Debugging an existing RAG system that's returning wrong or vague answers.
- Choosing chunking, embedding, and retrieval strategies for a new corpus.
Core concepts
- Chunking: splitting documents into retrievable units. Size, overlap, and boundary-awareness (don't split tables mid-row). The highest-leverage decision in the pipeline.
- Embeddings: dense vector representations for semantic similarity. Match the embedding model to your domain and language; test a few on your data.
- Hybrid retrieval: dense (semantic) + sparse (keyword/BM25) combined. Dense finds paraphrases; sparse finds exact terms, codes, and names. Together they beat either alone.
- Reranking: a second, more expensive model re-scores top candidates for precision. Retrieve broadly (top-50), rerank to top-5, generate from those.
- Query transformation: rewriting or expanding the user query — hypothetical answers, multi-query, step-back questions — to improve retrieval recall.
- Grounded generation: the answer cites its sources, says "I don't know" when retrieval finds nothing, and doesn't invent beyond the passages.
Practical workflow
- Build the eval set first: 30–50 real questions with known-good answers and source passages.
- Ingest and chunk a sample; eyeball the chunks — broken tables and split sentences are visible immediately.
- Measure retrieval alone: hit-rate@k for the gold passages. Tune chunking and hybrid weights until retrieval is solid.
- Add reranking; measure the precision gain vs. latency cost.
- Wire generation with a strict grounding prompt: cite sources, abstain when evidence is missing.
- Evaluate end-to-end: faithfulness (is every claim supported?), citation coverage, and abstention behavior on unanswerable questions.
RAG metrics per stage:
RETRIEVAL: hit-rate@5, hit-rate@20, MRR on gold passages
RERANK: precision@5 lift, added latency
GENERATION: faithfulness (% claims supported), citation coverage,
correct abstention rate on unanswerables
Common pitfalls
- Tuning generation first: rewriting the synthesis prompt while retrieval returns junk. Fix retrieval; it's usually the bottleneck.
- Fixed chunking for everything: one chunk size for prose, tables, and code. Adapt to content structure.
- Dense-only retrieval: missing exact matches on names, IDs, and codes. Add sparse retrieval.
- No abstention: the system answers confidently from irrelevant passages. Teach it to say "not in the documents."
- Stale index: documents updated, index not. Plan refresh, versioning, and deletion from day one.
- Eval-free iteration: "it feels better now." The eval set is the only honest judge — build it before tuning.
04 同仓库更多 Skills
web-scrape
Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open/fetch fails on JS-heavy pages, or when you need clean markdown/structured extraction from a site. Requires FIRECRAWL_API_KEY.
design-taste-frontend
tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML/CSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, "AI-made", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.
test-driven-development
Use when implementing any feature or bugfix, before writing implementation code
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
requesting-code-review
Use when completing tasks, implementing major features, or before merging to verify work meets requirements
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).