Skip to main content
skill CX Codex

benchmark · takagoto — Claude Code skill for RAG performance testing

Runs your RAG pipeline through a query set and shows where the time and tokens go. Useful once answers start feeling slow or expensive.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add TakaGoto/rag-learning-academy --skill benchmark -a claude-code
Open on GitHub

What benchmark does

The skill covers operational numbers: latency at each stage (retrieval, generation, embeddings), throughput, token and memory use, and a rough cost per query. Answer quality is out of scope — /evaluate handles that.

It works in steps. First it looks for your pipeline under projects/ and src/, breaks it into parts (loader, chunker, embedder, vector store, retriever, generator) and asks what you want measured. Then it helps you build a test set of 20–50 queries, ground-truth answers, timing wrappers and warm-up runs so cold starts don't skew the numbers. Results come back as mean, median, p95 and p99 in a table, followed by a read on which stage costs the most time.

The report lands in projects/[pipeline-name]/eval/benchmarks/report-[date].md. With no pipeline in the project yet, the skill points you to /build and stops there — there is nothing to measure.

What it helps with

  • pin down which pipeline stage adds the most latency
  • estimate token spend and cost per query
  • compare numbers before and after an optimization
  • catch outlier queries that run far slower than the rest
  • set a performance baseline before scaling up

Example prompts for the agent

  • Benchmark the pipeline in projects/rag-basic and tell me where the latency is
  • Build a 30-query test set and measure latency and token usage
  • Compare this benchmark report against the last run after my chunk size change

How to install benchmark

1Skills CLI (Vercel)

npx skills add TakaGoto/rag-learning-academy --skill benchmark -a claude-code

2Manually: put the files in place

~/.claude/skills/benchmark/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/benchmark/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about benchmark

How do I install benchmark in Claude Code?

Run npx skills add TakaGoto/rag-learning-academy --skill benchmark -a claude-code. The skill is placed at ~/.claude/skills/benchmark/SKILL.md.

What does the benchmark skill do?

It measures latency, throughput, token and memory use across your RAG pipeline, flags the bottlenecks and writes a report to projects/[pipeline-name]/eval/benchmarks/report-[date].md.

How is benchmark different from evaluate?

benchmark reports operational figures — time, tokens, memory, cost. Answer quality metrics such as faithfulness, relevancy and correctness come from /evaluate.

Source text

SKILL.md · MIT
---
name: benchmark
description: "Benchmark your RAG pipeline's performance"
---

# Benchmark: Measure Your RAG Pipeline's Performance

> **Scope:** This skill focuses on **operational performance** (latency, throughput, token costs, memory). For answer quality metrics (faithfulness, relevancy, correctness), use `/evaluate`.

Set up and run comprehensive benchmarks on the learner's RAG pipeline to identify bottlenecks and establish performance baselines.

## Step 1: Identify the Pipeline

Welcome! Let's measure how your RAG pipeline performs under the hood.

First, check whether the learner has existing work to benchmark:
- Look for a learner profile at `progress/learner-profile.md` and for code in `src/` and `projects/`.
- If pipeline code exists in `projects/`, great — proceed. If multiple pipelines exist, ask which to benchmark.
- If **no pipeline or RAG code exists** anywhere in `projects/` or `src/`, guide them warmly:
  > "Looks like you don't have a pipeline to benchmark yet — no worries! Let's get you set up first. Run `/build` to create your first RAG pipeline, and once it's running you can come back here to see exactly where the time and tokens go. It won't take long!"

  Stop here — do not continue to Step 2.
- If a pipeline is found, catalog the pipeline components: loader, chunker, embedder, vector store, retriever, generator.

## Step 2: Define Benchmark Scope

Ask the learner what they want to measure, or suggest a comprehensive benchmark covering:

### Latency Metrics
- **End-to-end latency**: Total time from query to answer
- **Retrieval latency**: Time to embed the query and fetch results from the vector store
- **Generation latency**: Time for the LLM to produce the answer
- **Embedding latency**: Time to embed a single query or a batch of documents

### Throughput Metrics
- **Queries per second**: How many queries can the pipeline handle?
- **Indexing throughput**: How fast can documents be chunked, embedded, and stored?

### Quality Metrics
- **Retrieval accuracy**: Precision@k, Recall@k, MRR (Mean Reciprocal Rank)
- **Answer quality**: Faithfulness, relevancy (via RAGAS or custom evaluators)

### Resource Metrics
- **Token usage**: Tokens consumed per query (embedding + generation)
- **Memory footprint**: RAM usage of the vector store and pipeline components
- **Cost estimate**: Approximate cost per query for paid APIs

## Step 3: Prepare the Benchmark Suite

Help the learner set up the benchmarking infrastructure:

1. **Create a test query set**: 20-50 queries of varying complexity, representative of real usage.
2. **Establish ground truth** (for quality metrics): Expected answers and relevant source documents.
3. **Set up timing instrumentation**: Wrap each pipeline stage with timing code.
4. **Configure warm-up runs**: Run 5-10 queries before measuring to avoid cold-start effects.

Provide reusable benchmark code that the learner can save and run again later.

## Step 4: Run the Benchmarks

Execute the benchmarks and collect data:

1. Run the full query set through the pipeline
2. Record all metrics for each query
3. Compute statistics: mean, median, p95, p99 for latency; averages for quality

Display a progress indicator as benchmarks run.

## Step 5: Present Results

Display results in clear tables:

```
Performance Benchmark Report
============================
Pipeline: [name]
Queries: [N]
Date: [today]

Latency (ms):
  Stage            Mean    Median    P95     P99
  Retrieval        [...]   [...]     [...]   [...]
  Generation       [...]   [...]     [...]   [...]
  End-to-end       [...]   [...]     [...]   [...]

Quality:
  Precision@5:     [score]
  Recall@5:        [score]
  MRR:             [score]
  Faithfulness:    [score]

Resources:
  Avg tokens/query: [N]
  Est. cost/query:  $[X]
```

## Step 6: Identify Bottlenecks

Analyze the results and highlight:
- Which stage is the biggest latency contributor?
- Are there any outlier queries that are much slower?
- Where is quality weakest?
- Is cost per query sustainable at target scale?

## Step 7: Optimization Suggestions

Provide prioritized recommendations:
1. **Quick wins**: Changes that take < 30 minutes and yield measurable improvement
2. **Medium effort**: Changes that require refactoring but have significant impact
3. **Architectural changes**: Bigger changes for when the pipeline needs to scale

Examples: add caching, batch embeddings, switch to a faster embedding model, add a re-ranker, optimize chunk size.

## Step 8: Save the Report

Save the benchmark report to `projects/[pipeline-name]/eval/benchmarks/report-[date].md`. Encourage the learner to re-run after optimizations to measure improvement.

Suggest 2-3 relevant next steps using slash commands:

- `/evaluate` — measure answer quality metrics alongside your performance benchmarks
- `/debug-rag` — diagnose and fix the bottlenecks identified in your benchmark
- `/architecture` — redesign your pipeline architecture if fundamental changes are needed

© TakaGoto · MIT · TakaGoto/rag-learning-academy

Similar skills

All skills for AI and ML →

benchmark by other authors comes first.

benchmark affaan-m This skill measures page, API, and build performance, then compares results before and after a change. Use it to check a release or investigate reports that a page feels slow. CX Codex +1 4,500installs benchmark hoangsonww The benchmark skill takes one session or a few recent ones and compares them with the rolling average from Agent Monitor data: cost, tokens, tool count and workflow complexity. Each metric comes back as a percentile of the population. CX Codex +1 ★ 1,121repo stars skill-creator official anthropics Creates and refines skills, then tests them with prompts, evaluations, and performance checks. 414,180installs writing-for-agents Matt Pocock Guidance for writing skills and agent-facing documents. Use it when editing AGENTS.md, CLAUDE.md, or reference files reached from them. 466,719installs media-use heygen-com Finds or generates media for HyperFrames videos, including voiceovers, music, cutouts, and color grades. Stores files locally in assets. CX Codex +1 1,100,000installs mcp-builder official anthropics This skill walks through building an MCP server in TypeScript or Python, from reading the protocol spec to writing tests and evaluation questions. 130,949installs subagent-driven-development Jesse Vincent This skill runs an implementation plan through fresh subagents for independent tasks and reviews each result. Use it for multi-step work in one session. CX Codex 237,746installs orchestration stablyai Coordinates supervised Orca workers with task DAGs, decision gates, and threaded messages. Fits workflows that split work across multiple agents. CX Codex +1 350,300installs

From the same set4

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor