Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Designs an evaluation for a retrieval-augmented (RAG) system — scoring the retriever separately from the generator, requiring a groundedness check, and building a labeled golden set with hard negatives. Use when someone wants to test, benchmark, or set up an eval for a system that looks up documents/passages and then writes an answer from them. Do NOT use for general eval or rubric authoring on non-retrieval tasks (that is eval-writer / prompt-eval-rubric-writer), or for making an agent answer-from-sources at runtime (that is rag-grounding-and-citation).
.claude/skills/rag-eval-design/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-03 | ✗→✓ | ▲ Improved | 598% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 600% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 576% | 0% |
| case-01 | ✗→✓ | ▲ Improved | 576% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 609% | 0% |
Designs an evaluation for a system that retrieves context (chunks, passages, documents) and then generates an answer from it. The core discipline a generic eval skips: score the two stages separately, always include a groundedness check, and build a labeled golden set that has hard negatives — not one blended "does it answer well?" number.
Use when someone is testing, benchmarking, or building an eval / test set for a document-Q&A bot, knowledge-base assistant, support-answer bot over articles, or any retrieve-then-answer pipeline — and wants to know how to measure it.
Do NOT use for:
eval-writer / prompt-eval-rubric-writer.
rag-grounding-and-citation. This skill designs the eval, it does not do the answering.
A retrieve-then-answer system has two independent failure surfaces. Collapsing them into one score hides which stage broke, and the two need different fixes.
independent of the generator. The generator can never answer from a chunk that was never retrieved. Measure:
Choose k to match the generator's context budget: measuring recall@20 is meaningless if you only feed the top 5 chunks to the model.
Faithfulness / groundedness = every claim in the answer is supported by the retrieved context. Grade it claim-by-claim against the retrieved chunks — not against world truth.
An answer can be factually correct (pulled from the model's training memory) and still unfaithful because the retrieved context does not support it. A generic "is this a good answer?" judge rewards that answer; a grounded system must not. Every RAG eval needs an explicit groundedness dimension, scored against the retrieved passages, or it is not a RAG eval.
Label each question with:
Then deliberately add hard negatives, or the numbers lie:
behavior is to refuse ("not in the sources"). This is the only way to measure refusal and false-answer rate. A test set of only answerable questions never catches a system that makes things up on the ones it can't answer.
Without them, precision is untested and a retriever that returns everything scores perfect recall while teaching you nothing.
Include a labeled case for each, because they have different root causes and the separated metrics are what let you tell them apart:
| Failure mode | Signature in the metrics | Where the fix lives | |---|---|---| | Retrieval miss | low recall@k — the answering chunk never made the top k | retriever: embeddings, chunking, k | | Hallucination despite context | low faithfulness while retrieval recall is high | generator / grounding prompt | | Ignoring retrieved context | correct chunk WAS retrieved, yet the answer contradicts it or falls back to training | generator |
The diagnostic power comes from Rule 1: high recall + low faithfulness = a generation bug; low recall = a retrieval bug. A single blended score can localize neither.
reference answer. Mix in out-of-corpus questions and distractor chunks (Rule 3).
You cannot compute retrieval metrics or grade faithfulness against context you didn't record.
answer relevance, completeness; plus refusal-correctness on the out-of-corpus questions.
System: a bot that embeds internal PDFs, retrieves the top 5 chunks, and writes an answer.
reference answer), 10 out-of-corpus (answer: refuse), 5 with planted distractor chunks.
Read-out: retrieval is the bigger miss (fix chunking/embeddings); generation is faithful when fed a good chunk but invents answers when the corpus lacks one (tighten the refusal behavior). A single "0.8 answer quality" score would have surfaced none of this.
failure can't be localized.
retrieved context, letting confident-but-unsupported answers pass.
faithfulness are uncomputable.
references/retrieval-metrics.md — exact formulas and when to use each retrieval metric(recall@k, precision@k, MRR, hit-rate, nDCG), micro-vs-macro averaging, and choosing k.
Other measured skills in the registry, with their headline benchmark lift.