Agent skill

RAG Eval

by agentscope-ai in agentscope-ai/OpenJudge

A skill your agent uses when the user has a RAG (Retrieval-Augmented Generation) system and wants to evaluate its quality — separating retrieval issues from generation issues.

Apache-2.0Auto-check passedAI & LLM Engineering

Install RAG Eval

skills CLI
$ npx skills add agentscope-ai/OpenJudge --skill rag-eval -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install agentscope-ai/OpenJudge rag-eval --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/agentscope-ai/OpenJudge.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/eval_pipeline/05-rag-eval .claude/skills/rag-eval && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
rag-eval
GitHub stars
868
Token cost
~2.4k tokens
SKILL.md length
679 words
Files
2 (incl. scripts)
Skills in repo
19
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when the user has a RAG (Retrieval-Augmented Generation) system and wants to evaluate its quality — separating retrieval issues from generation issues.

  • Works in 6 steps: Load RAG Traces → Separate Retrieval vs Generation → Faithfulness Evaluation → …
  • The user mentions RAG evaluation
  • SKILL.md covers When to Activate, Checklist, Fast path: run the bundled… and Step 1: Load RAG Traces, plus 7 more sections
  • Runs Python scripts from its folder; calls python

What it does

RAG Eval is an agent skill from agentscope-ai/OpenJudge. Use when the user has a RAG (Retrieval-Augmented Generation) system and wants to evaluate its quality — separating retrieval issues from generation issues. Also use when the user mentions RAG evaluation, faithfulness checking, hallucination detection in RAG, retrieval quality, chunking optimization, or "is my RAG pipeline working." Outputs a diagnostic matrix that pinpoints whether problems are in retrieval or generation.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including scripts (for example `scripts/rag_diagnostic.py`).

It sits in AI & LLM Engineering, covering Retrieval-augmented generation. The repository describes itself as: OpenJudge: A Unified Framework for Holistic Evaluation and Quality Rewards. The licence is Apache-2.0.

When your agent uses it

  • The user mentions RAG evaluation
  • Faithfulness checking
  • Hallucination detection in RAG
  • Retrieval quality

Example prompts

  • “is my RAG pipeline working.”
  • “/rag-eval”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Load RAG Traces
  2. Separate Retrieval vs Generation
  3. Faithfulness Evaluation
  4. Retrieval Evaluation
  5. Diagnostic Matrix
  6. Output

What it can do on your machine

Read from SKILL.md and the folder at commit d1e0642. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

RAG Eval loads about 2.4k tokens when it runs. Until then it costs about 109 tokens; SKILL.md has 679 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~109
When it runs · the whole SKILL.md, loaded when a task matches
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from agentscope-ai/OpenJudge at commit d1e0642, republished under its Apache-2.0 licence (© agentscope-ai). 679 words, ~2,402 tokens.

Download SKILL.mdSave it as .claude/skills/rag-eval/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
rag-eval
description
Use when the user has a RAG (Retrieval-Augmented Generation) system and wants to evaluate its quality — separating retrieval issues from generation issues. Also use when the user mentions RAG evaluation, faithfulness checking, hallucination detection in RAG, retrieval quality, chunking optimization, or "is my RAG pipeline working." Outputs a diagnostic matrix that pinpoints whether problems are in retrieval or generation.

RAG Eval

Evaluate RAG systems by diagnosing retrieval and generation separately. A single "RAG accuracy" number hides whether the problem is finding the right documents or using them correctly. This skill separates them so you know what to fix.

When to Activate

  • User has a RAG pipeline (retriever + generator) with traces
  • User wants to know if their RAG system hallucinates
  • User is optimizing chunking strategy and needs before/after comparison
  • User wants to build a RAG evaluation dataset

Checklist

You MUST create a task for each item and complete them in order:

  1. Load RAG traces — validate query + context + answer triples
  2. Separate retrieval vs generation — determine which layers to evaluate
  3. Run faithfulness evaluation — is the answer grounded in retrieved docs?
  4. Run retrieval evaluation — are the right documents retrieved?
  5. Build diagnostic matrix — cross-tabulate to find root cause
  6. Output findings — prioritized issues with concrete fixes

Fast path: run the bundled script

Once each trace has a faithfulness judgment (and ideally a retrieval signal), build the retrieval-vs-generation diagnostic matrix with the bundled, tested script (scripts/rag_diagnostic.py, standard library only, no OpenJudge dependency):

bash
python scripts/rag_diagnostic.py --traces traces.jsonl

Trace rows: {"faithful":bool} or {"faithfulness_score":1-5} (>= 4 = faithful), plus an optional retrieval signal {"retrieval_good":bool} or {"recall_at_k":0-1} (>= 0.5 = good). It prints the generation faithful/hallucinating split, the 2×2 matrix when a retrieval signal is present, and the primary issue (retrieval vs generation). --self-test to verify it.

Steps below explain how to separate the layers and produce the faithfulness/retrieval signals (with OpenJudge graders or any judge).

Step 1: Load RAG Traces

The minimum data needed per trace:

python
# Each trace must contain:
trace = {
    "query": "What is the return policy?",
    # retrieved_docs are dicts with id + text (the id is required for retrieval
    # metrics like Recall@k; the text is required for the faithfulness check).
    "retrieved_docs": [
        {"id": "doc_1", "text": "Returns are accepted within 30 days..."},
        {"id": "doc_2", "text": "Refunds are issued to the original..."},
    ],
    "answer": "You can return items within 30 days for a full refund.",
    "reference_answer": "Our 30-day return policy allows full refunds.",  # optional
    "gold_doc_ids": ["doc_1", "doc_3"],  # optional — which docs should have been retrieved
}

If your traces only have raw strings (no ids), wrap them first so retrieval metrics work: retrieved_docs = [{"id": f"d{i}", "text": t} for i, t in enumerate(raw_strings)].

Validate data completeness and report any gaps. If > 20% of traces are missing key fields, ask the user to confirm the schema before proceeding.

Step 2: Separate Retrieval vs Generation

RAG failures come from two independent sources:

SourceWhat goes wrongMetric to use
RetrievalWrong/missing documents returnedRecall@k, Precision@k, MRR
GenerationModel misuses or fabricates beyond docsFaithfulness (HallucinationGrader)
GenerationAnswer doesn't address the queryRelevance (RelevanceGrader)

Why separate them? A system with perfect retrieval but poor generation needs prompt engineering. A system with poor retrieval needs chunking/embedding work. Treating them as one problem wastes effort.

Step 3: Faithfulness Evaluation

Use OpenJudge HallucinationGrader to check if the answer stays grounded in retrieved documents:

python
from openjudge.graders.common.hallucination import HallucinationGrader
from openjudge.runner.grading_runner import GradingRunner

faithfulness_grader = HallucinationGrader(model=model)

runner = GradingRunner(
    grader_configs={"faithfulness": faithfulness_grader},
    max_concurrency=8,
)

# Dataset format for HallucinationGrader
dataset = [
    {
        "query": trace["query"],
        "response": trace["answer"],
        "context": "\n\n".join(doc["text"] for doc in trace["retrieved_docs"]),
    }
    for trace in traces
]

results = await runner.arun(dataset)

# HallucinationGrader scores 1-5 (5 = no hallucination, fully grounded)
# Binarize: score >= 4 → faithful, score < 4 → hallucination

Also evaluate answer relevance — does the response actually address the query?

python
from openjudge.graders.common.relevance import RelevanceGrader

relevance_grader = RelevanceGrader(model=model)
Show full SKILL.md (273 more words)Show less

Step 4: Retrieval Evaluation

If gold_doc_ids are available, compute retrieval metrics:

python
def recall_at_k(retrieved_docs, gold_ids, k=5):
    """Fraction of gold docs found in top-k retrieved docs."""
    retrieved_ids = set(doc["id"] for doc in retrieved_docs[:k])
    gold_set = set(gold_ids)
    if not gold_set:
        return None
    return len(retrieved_ids & gold_set) / len(gold_set)

def precision_at_k(retrieved_docs, gold_ids, k=5):
    """Fraction of top-k docs that are relevant."""
    retrieved_ids = set(doc["id"] for doc in retrieved_docs[:k])
    gold_set = set(gold_ids)
    if not retrieved_ids:
        return 0
    return len(retrieved_ids & gold_set) / len(retrieved_ids)

def mrr(retrieved_docs, gold_ids):
    """Mean Reciprocal Rank — how early the first relevant doc appears."""
    for i, doc in enumerate(retrieved_docs):
        if doc["id"] in gold_ids:
            return 1 / (i + 1)
    return 0

If gold_doc_ids are NOT available, use a semantic relevance judge as a proxy: check whether each retrieved doc is semantically related to the query.

Chunking Optimization

If retrieval is the bottleneck, try a grid search over chunk size and overlap:

python
chunk_configs = [
    {"chunk_size": 256, "overlap": 32},
    {"chunk_size": 512, "overlap": 64},
    {"chunk_size": 1024, "overlap": 128},
    {"chunk_size": 512, "overlap": 128},
]

for config in chunk_configs:
    # Re-chunk, re-embed, re-retrieve, compute Recall@5
    ...

Step 5: Diagnostic Matrix

The most valuable output — cross-tabulate retrieval vs generation results:

                    Generation: Faithful    Generation: Hallucinating
Retrieval: Good          ████████ 62%            ██ 10%
                         (system works)          (generator problem)

Retrieval: Poor          █ 8%                   ██████ 20%
                         (lucky guess)           (both broken)

Interpretation:

  • 62% (Good/Faithful): System working correctly
  • 10% (Good/Hallucinating): Generator is misusing or fabricating despite having the right docs. Fix: prompt engineering, few-shot examples, or model upgrade.
  • 8% (Poor/Faithful): Generator got the right answer from wrong docs — likely using parametric knowledge, not retrieval. Unreliable.
  • 20% (Poor/Hallucinating): Both layers broken. Fix retrieval first, then generation.

Step 6: Output

Present findings with concrete recommendations:

RAG Evaluation Results (500 traces):

Layer Results:
  Faithfulness:     76% pass  (95% CI: [72%, 80%])
  Answer Relevance: 82% pass  (95% CI: [78%, 85%])
  Retrieval Recall@5: 70%    (95% CI: [66%, 74%])

Diagnostic Matrix:
                    Faithful    Hallucinating
  Retrieval Good      62%          10%  ← 10% of answers hallucinate despite good docs
  Retrieval Poor       8%          20%  ← 20% both broken

Primary issue: 10% hallucination rate even with good retrieval.
  → Generator is ignoring or misreading retrieved documents.
  → Recommendation: add "cite specific document passages" to generation prompt.
  → Re-evaluate faithfulness after prompt change.

Secondary issue: 20% of traces have both poor retrieval and hallucination.
  → Recommendation: optimize chunking first (try smaller chunks with more overlap).
  → Re-run retrieval eval after chunking changes.

Common Mistakes

  • Using a single "RAG accuracy" metric. This is the cardinal sin of RAG eval. You can't fix what you can't localize. Always separate retrieval from generation.
  • Skipping faithfulness because correctness looks OK. An answer can be correct (matches reference) but unfaithful (not derived from retrieved docs). This means the generator is using parametric knowledge — which will fail silently on a different knowledge domain.
  • Optimizing generation before retrieval. If retrieval is broken, no amount of prompt engineering will fix the answers. Fix the data pipeline first.
  • No adversarial questions in the eval set. RAG systems look great on factual lookups but fail on queries that require synthesizing across multiple chunks. Include multi-hop and comparative questions.

Next Skills

After 05-rag-eval:

  • 03-align-human: Calibrate the faithfulness judge against human judgments.
  • 01-eval-design: Build a more comprehensive RAG eval dataset with adversarial queries.
  • 06-prompt-regression: If you change the generation prompt, measure before/after.

© agentscope-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (scripts) in skills/eval_pipeline/05-rag-eval of agentscope-ai/OpenJudge.

  • SKILL.md
  • scripts/rag_diagnostic.py

Open the folder on GitHubat commit d1e0642

Compare with similar skills

RAG Eval next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

RAG Eval compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
RAG Eval this skillagentscope-ai/OpenJudge868—~2.4kAutomated safety check: PassApache-2.0
Chroma Vector DatabaseOrchestra-Research/AI-Research-SKILLs13k8 repos~2.3kAutomated safety check: PassMIT
LLM Application DevMoizIbnYousaf/ai-agent-skills1.1k2 repos~1.3kAutomated safety check: PassMIT
Senior Prompt Engineermaslennikov-ig/claude-code-orchestrator-kit2604 repos~1.4kAutomated safety check: PassCustom licence
MCP Local RAGshinpr/mcp-local-rag407—~4.4kAutomated safety check: PassMIT
Ms Agent Framework RAGshuyu-labs/WebCode278—~1.1kAutomated safety check: PassCustom licence

Similar skills

  • Chroma Vector Database

    Orchestra-Research/AI-Research-SKILLs

    Shows how to store documents and embeddings in Chroma, query them by similarity with metadata filters, and persist them to disk for RAG and semantic search projects.

    13k GitHub starsUsed in 8 repos~2.3k tokens
    AI & LLM EngineeringAuto-check passed
  • LLM Application Dev

    MoizIbnYousaf/ai-agent-skills

    Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration.

    1.1k GitHub starsUsed in 2 repos~1.3k tokens
    AI & LLM EngineeringAuto-check passed
  • Senior Prompt Engineer

    maslennikov-ig/claude-code-orchestrator-kit

    Provides reference guides and Python scripts for prompt optimization, RAG evaluation, and agent orchestration when building or tuning LLM systems.

    260 GitHub starsUsed in 4 repos~1.4k tokens
    AI & LLM EngineeringAuto-check passed
  • MCP Local RAG

    shinpr/mcp-local-rag

    Searches, saves, and maintains a local document index through a local RAG MCP server.

    407 GitHub stars~4.4k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Ms Agent Framework RAG

    shuyu-labs/WebCode

    Comprehensive guide for building Agentic RAG systems using Microsoft Agent Framework in C.

    278 GitHub stars~1.1k tokensUpdated 3 mo ago
    AI & LLM EngineeringAuto-check passed
  • Local RAG Search

    nkapila6/mcp-local-rag

    Efficiently perform web searches using the mcp-local-rag server with semantic similarity ranking.

    134 GitHub starsUsed in 1 repo~1.6k tokens
    AI & LLM EngineeringAuto-check passed

More from agentscope-ai/OpenJudge

All 19 skills in this repo
  • Align Human

    agentscope-ai/OpenJudge

    A skill your agent uses when the user has a judge/grader and human-labeled data, and wants to measure how well the judge agrees with humans, detect systematic biases, determine whether automatic…

    868 GitHub stars~3.1k tokensUpdated 27 days ago
    Auto-check passed
  • Prompt Regression

    agentscope-ai/OpenJudge

    A skill your agent uses when the user has changed a prompt (system prompt, RAG template, agent instruction, etc.) and wants to know whether the candidate is better or worse than the baseline.

    868 GitHub stars~2.8k tokensUpdated 27 days ago
    Auto-check passed
  • 01 Auto Arena

    agentscope-ai/OpenJudge

    Automatically evaluate and compare multiple AI models or agents without pre-existing test data.

    868 GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Eval Design

    agentscope-ai/OpenJudge

    A skill your agent uses when the user needs to design evaluation datasets, create test cases, stratify samples, generate adversarial examples, extract eval dimensions from traces/specs, or build a…

    868 GitHub stars~2.8k tokensUpdated 27 days ago
    Auto-check: warnings
  • 01 Graders And Pipeline

    agentscope-ai/OpenJudge

    Build custom LLM evaluation pipelines using the OpenJudge framework.

    868 GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • 01 Paper Review

    agentscope-ai/OpenJudge

    Review academic papers for correctness, quality, and novelty using OpenJudge's multi-stage pipeline.

    868 GitHub starsUsed in 1 repo~2.4k tokens
    Auto-check passed

Questions about RAG Eval

What does RAG Eval do?

A skill your agent uses when the user has a RAG (Retrieval-Augmented Generation) system and wants to evaluate its quality — separating retrieval issues from generation issues. RAG Eval is an agent skill from agentscope-ai/OpenJudge. Use when the user has a RAG (Retrieval-Augmented Generation) system and wants to evaluate its quality — separating retrieval issues from generation issues.

When should I use RAG Eval?

RAG Eval fits situations like: the user mentions RAG evaluation; faithfulness checking; hallucination detection in RAG; retrieval quality.

How do I install RAG Eval in Claude Code?

Run `npx skills add agentscope-ai/OpenJudge --skill rag-eval -a claude-code`. Or copy the skill folder (skills/eval_pipeline/05-rag-eval in agentscope-ai/OpenJudge) into .claude/skills/rag-eval in your project. Claude Code loads it when a task matches its description.

How do I install RAG Eval in Codex?

Run `npx skills add agentscope-ai/OpenJudge --skill rag-eval -a codex`. Or copy the skill folder (skills/eval_pipeline/05-rag-eval in agentscope-ai/OpenJudge) into .agents/skills/rag-eval in your project. Codex loads it when a task matches its description.

Can I use RAG Eval in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add agentscope-ai/OpenJudge --skill rag-eval -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rag-eval, .gemini/skills/rag-eval, .github/skills/rag-eval and .opencode/skills/rag-eval in your project.

What does RAG Eval need to run?

Going by SKILL.md and its folder, RAG Eval needs Python for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does RAG Eval access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is RAG Eval safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does RAG Eval use?

RAG Eval is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does RAG Eval use?

About 2.4k tokens (SKILL.md is roughly 9.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to RAG Eval?

Skills that share tags, products or a category with RAG Eval: Chroma Vector Database (Orchestra-Research/AI-Research-SKILLs, 13k stars), LLM Application Dev (MoizIbnYousaf/ai-agent-skills, 1.1k stars), Senior Prompt Engineer (maslennikov-ig/claude-code-orchestrator-kit, 260 stars) and MCP Local RAG (shinpr/mcp-local-rag, 407 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains RAG Eval?

agentscope-ai (a GitHub organization) maintains it in agentscope-ai/OpenJudge, which has 868 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on September 11, 2026.

Source: agentscope-ai/OpenJudge on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.