agentleFS
tim-osterhustim-osterhus/millrace-skills/skills/evaluate-rag/SKILL.md

evaluate-rag

Skill0 starsChanged 7 months agoApache-2.0View on GitHub

Guardrail for evaluating RAG retrieval and generation quality, including retrieval datasets, Recall@k, chunking experiments, grounding, and leakage checks.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    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
  1. Distinctive:

    Do trace-level error analysis before selecting metrics.

    line 28
  2. Distinctive:

    Do not rely on one end-to-end score.

    line 35
  3. Distinctive:

    Do not tune generation before checking whether the needed context was retrieved.

    line 36
  4. Distinctive:

    Use Recall@k for first-pass retrieval and precision, MRR, or NDCG for reranking as appropriate.

    line 37
  5. Distinctive:

    Treat synthetic questions as useful but not sufficient without realism filtering.

    line 38
  6. Distinctive:

    Check train/eval leakage when RAG traces become training data.

    line 39
  7. Distinctive:

    Test chunk size, overlap, and content-aware chunking when retrieval is weak.

    line 57
  8. Distinctive:

    If converting traces to training rows, audit final serialized rows for leakage, citation/source alignment, prompt residue, and malformed …

    line 59
  9. Distinctive:

    Start with trace inspection and retrieval/generation separation.

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Evaluate RAG

Purpose

Help agents evaluate retrieval-augmented generation systems by separating retrieval quality from generation quality. This skill covers retrieval eval datasets, Recall@k, reranking metrics, chunking experiments, faithfulness, relevance, and training-data leakage checks.

Quick Start

  1. Do trace-level error analysis before selecting metrics.
  2. Build query-to-relevant-chunk datasets for retrieval.
  3. Optimize first-pass retrieval for recall.
  4. Evaluate generation separately for faithfulness and relevance.
  5. Grid-search chunking before tuning generation when retrieval is weak.

Operating Constraints

  • Do not rely on one end-to-end score.
  • Do not tune generation before checking whether the needed context was retrieved.
  • Use Recall@k for first-pass retrieval and precision, MRR, or NDCG for reranking as appropriate.
  • Treat synthetic questions as useful but not sufficient without realism filtering.
  • Check train/eval leakage when RAG traces become training data.

Inputs This Skill Expects

  • RAG traces showing query, retrieved chunks, context, and answer.
  • Corpus chunks, chunking strategy, retriever, reranker, and prompt.
  • Retrieval eval dataset or source documents from which to build one.
  • Generation eval criteria such as grounding, relevance, citation support, and omissions.

Output Contract

  • State whether failures come from retrieval, generation, or both.
  • Provide retrieval metrics and generation findings separately.
  • Recommend chunking, embedding, reranking, prompt, or generation changes based on the diagnosed failure.
  • Include leakage and source-alignment checks if traces become training rows.

Procedure

  1. Inspect failed traces and classify retrieval versus generation failures.
  2. Build or review query-to-relevant-chunk labels.
  3. Measure first-pass retrieval and reranking separately.
  4. Test chunk size, overlap, and content-aware chunking when retrieval is weak.
  5. Evaluate generated answers for faithfulness, relevance, omissions, and hallucinations.
  6. If converting traces to training rows, audit final serialized rows for leakage, citation/source alignment, prompt residue, and malformed text.

Pitfalls And Gotchas

  • Using similarity metrics as primary answer-quality measures.
  • Overfitting to synthetic retrieval questions.
  • Ignoring multi-hop queries that need multiple chunks.
  • Treating reranker precision as a fix when first-pass recall is too low.
  • Training on RAG traces without checking final assistant text quality.

Progressive Disclosure

Start with trace inspection and retrieval/generation separation. Expand into synthetic QA, adversarial retrieval, chunking grid search, reranking, multi-hop metrics, or training-data audits only when the problem requires it.

Verification Pattern

  • Confirm traces were inspected before metrics were chosen.
  • Confirm retrieval and generation are measured separately.
  • Confirm first-pass retrieval recall is adequate before generation tuning.
  • Confirm chunking changes are evaluated against a labeled retrieval set.
  • Confirm RAG-derived training rows are checked for leakage and source alignment.

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.