---
title: "How to evaluate an agent skill"
date: 2026/12/01
description: "Evaluating agent skills has a learning curve. This post will give you a good framework for setting up your skill evals."
tag: engineering, agents, evaluation
author: Lotte
---

Agent skills are great, they enable you to give nuanced instructions to your agent, in a structured way. But when it comes to skills, how do you evaluate them?

It is tempting to evaluate a skill the same way you evaluate a system prompt. But skills are not prompts, and skill evals are not prompt evals. Let's walk through what that means for your skill eval setup.

## Why skill evals are not prompt evals [#why-skill-evals-are-not-prompt-evals]

Evaluating an agent skill differs from evaluating a prompt in two fundamental ways:

### 1. Progressive disclosure

Prompts are always immediately in an agent's context. A skill, on the other hand, uses progressive disclosure: the agent starts with only the frontmatter in context, and loads `SKILL.md` (and any other files) only if it deems them useful.

This means that, unlike for prompts, you **can't just blindly evaluate assuming the agent was aware of the skill content**.

Agent context across 7 iterations, comparing a prompt vs. a skill:

- **Prompt:** `prompt` stays in the agent context from iteration 1 through iteration 7.
- **Skill:**
  - Iteration 1: only `frontmatter` is in context.
  - Iteration 3: agent decides to use skill, loading `SKILL.md` into context.
  - Iteration 6: agent reads skill reference file, loading `references/file-1.md` into context.

### 2. Agent behavior is (often) more complex

The decision to put something into a skill implies that it was too complex to fit everything into one long string that's always completely in the agent's context.

Evaluating a skill therefore means **evaluating more complex behavior**. This shifts the focus to a specific kind of eval.

## Separate skill routing from skill quality [#separate-routing-from-quality]

Before writing evaluators, you need to separate two questions that often get tangled together:

1. **Does the agent pick the right skill when left on its own?**
2. **Does the skill itself actually help when the agent uses it?**

This means you will test two things every time you edit your skill:

| Eval                     | Setup                                                                        |
| ------------------------ | ---------------------------------------------------------------------------- |
| **Skill routing**        | All skills available (check the right skill is picked, with no interference) |
| **Skill quality (lift)** | `Forced skill` vs. baseline (`No skill` or previous version)                 |

So how do you evaluate these?

## Evaluating skill routing [#evaluating-skill-routing]

Routing evals test whether the agent loads the right skill (files) when left on its own.

To test this, create a dataset where each item pairs a prompt + environment with the skill file that should be loaded into context (as `expected_output`). When you [link skills to traces](/docs/skill-management/tracing), loading a skill file into context will be recorded on a trace, so you can use a [code-based evaluator](/docs/evaluation/evaluation-methods/code-evaluators) to check this.

Routing evaluation flow:

- **Dataset item:** `input` (prompt), `metadata` (environment config, files, ...), and `expected output` (skill/file that should be used).
- **Execution:** `input` and `metadata` feed into `run agent`, which produces a `trace`.
- **Evaluation:** A code-based evaluator checks the `trace` against `expected output`.

### 1. Skill-level triggering and coexistence

First, test whether the frontmatter of the skill is clear enough for the agent to load your skill when it should, and leave it alone when it shouldn't.

**This gets harder (and more important) as your skill library grows:** every new skill competes for attention, so adding a new skill can change routing behavior for existing skills.

Skill routing coexistence diagram: an agent routes prompts across `Skill A` through `Skill H`. When `Skill I` (new) is added alongside them, a prompt that previously routed to `Skill C` is silently pulled away to `Skill I` instead.

### 2. Intra-skill routing (other skill files)

Larger skills use multiple files and progressive disclosure to keep context size low. For example, our [Langfuse skill](https://github.com/langfuse/skills/tree/main/skills/langfuse) keeps core rules and a routing index in `SKILL.md` and delegates workflows to `references/`:

  
```text
skills/langfuse/
├── SKILL.md
└── references/
    ├── setting-up-evals.md
    ├── cost-optimization.md
    ├── judge-calibration.md
    └── ...
```

Loading of these sub-files into context needs to be tested individually. Here's an example of 2 items in the dataset we use to test our Langfuse skill:

  ![Langfuse dataset items for intra-skill routing showing prompt inputs, expected output with invoked_reference_file, and metadata with env_folder](/images/blog/2026-12-01-how-to-evaluate-an-agent-skill/routing-dataset-items.png)

## Evaluating skill quality [#evaluating-skill-quality]

Alongside skill routing, also test whether using the skill actually improves your agent.

To isolate skill quality from routing, **force the agent to use the skill** during the run, and **compare the results against a baseline** (either no skill, or the previous version of the skill). This is similar to any form of agent testing in general.

Once you run these experiments, how do you decide what to evaluate? There isn't a one-size-fits-all answer. But there are two categories of eval metrics that we often see when people are evaluating skills:

- outcome & trajectory (quality) metrics
- trajectory efficiency metrics

Generally, a good starting point for coming to a metric set for your specific agent is the [Evaluate section in our academy](/academy/evaluate).

### 1. Task outcome & trajectory

Because skills target multi-step work, concrete outcome and trajectory checks often make sense. The exact metrics you'll measure come from reading your traces ([error analysis](/academy/monitoring/error-analysis)) and depend on your use case. Some examples:

**Coding**

- **Build passes (outcome):** Does the edited repo still compile without errors?
- **Tests pass (outcome):** Does the test suite still pass?
- **Expected code patterns (outcome):** Are the required SDK calls or imports present in the diff?
- **Clean workspace (outcome):** Is `git status` free of stray temporary files or artifacts?

**CLI/API operations**

- **No collateral writes (outcome):** Did the agent avoid unintended mutations (`collateral_writes == 0`)?
- **Tool adherence (trajectory):** Did the agent use the skill's CLI or SDK instead of ad-hoc workarounds?

**Encoded team workflows**

- **Step order (trajectory):** Did the agent run required steps in order (such as a dry run before a destructive action)?
- **Output format (outcome):** Does the final artifact follow the team's expected format?

Some tips:

**Score per constraint (avoid one monolithic score).** Grade concrete sub-checks (`builds_cleanly`, `uses_production_label`, `no_collateral_writes`) so you can immediately see _which_ requirement breaks.

**Pick `pass@k` vs. `pass^k` based on user risk.** Use `pass@k` (succeeding at least once in `k` attempts) for workflows where the agent can iterate. Use `pass^k` (succeeding across every trial) for actions like production migrations or compliance reviews.

### 2. Trajectory efficiency & cost

Quality evals can still hide severe friction, because strong frontier models often recover from broken instructions. Try to track whether your agent gets the job done efficiently as well:

**Tool error rate:** Non-zero exit codes, `4xx` responses, failed tool spans, etc. per run.

  In our own CLI skill iterations, tracking CLI error rate caught a 25% hallucinated-flag rate and a `No server URL found` retry loop hitting 90% of runs. Both were fixed with two-line edits to `SKILL.md`.

**Workaround rate:** Track when the agent abandons the skill's recommended path (for example, dropping from your CLI to raw `curl`, or falling back to web search).

**Token cost, turns, and wall-clock time (passing runs only):** For these metrics, make a distinction between successful vs. failed runs (failed runs often look cheap because the agent gave up early).

  **In production, you can also track the cost of misrouted skills.** When an agent loads the wrong skill or misses a needed one, the extra tokens, latency, and degraded outcomes add up quickly and show which routing failures are worth fixing first.

## How to sequence this without Goodharting yourself [#how-to-sequence-this]

Looking at routing, trajectory efficiency, and multi-constraint outcome graders together, it is easy to over-engineer your evaluation suite, or worse, optimize against a flawed metric.

First of all, make sure you are recording skill usage on your agent's traces. Always track which skills are available, when a skill gets loaded into context, and which files get loaded exactly. [Skill management in Langfuse](/docs/skill-management/overview) does this for you.

Then, as covered in [Choosing what to evaluate](/academy/evaluate/choosing-what-to-evaluate) and [AI is eating the AI engineering loop](/blog/2026-06-09-ai-is-eating-ai-engineering), your metric set should emerge from observing your agent's traces:

1. **Start by reading traces.** You will learn a lot from just observing how your agent is behaving and form an opinion on how you'd prefer things to go.
2. **Add routing evals first.** Everything else is noise if the skill never gets loaded.
3. **Layer in outcome and trajectory evals.** These should be heavily inspired by the outcome of your error analysis.
4. **Re-run your `no-skill` baseline when models upgrade.** Newer models absorb older skills, so you know what to drop.

<!-- agent-instructions -->

---

## Agent Instructions

This page is part of the [Langfuse](https://langfuse.com) documentation, published as plain Markdown for AI agents. Every page is available as Markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` header. This page: `https://langfuse.com/blog/2026-12-01-how-to-evaluate-an-agent-skill.md`.

### Querying these docs

If the answer is not on this page, query the documentation instead of guessing:

- **Semantic search** across all Langfuse docs, returning an answer with the relevant pages and excerpts. Ask a specific, self-contained question:

  ```bash
  curl -sG "https://langfuse.com/api/search-docs" --data-urlencode "query=How do I trace a LangGraph agent?"
  ```

- **Index of every page**: <https://langfuse.com/llms.txt>, with per-section indexes [llms-docs.txt](https://langfuse.com/llms-docs.txt), [llms-integrations.txt](https://langfuse.com/llms-integrations.txt), and [llms-self-hosting.txt](https://langfuse.com/llms-self-hosting.txt).

### Before writing Langfuse code

- **Install the [Langfuse Agent Skill](https://langfuse.com/docs/api-and-data-platform/features/agent-skill).** It encodes Langfuse's own best practices for instrumentation, prompt management, and evaluation, and materially improves results.
- **Read [What does a good trace look like?](https://langfuse.com/docs/observability/best-practices.md)** before instrumenting an application.
- **Verify endpoints, parameters, and response fields** against the [OpenAPI spec](https://cloud.langfuse.com/generated/api/openapi.yml), or read the [API reference as Markdown](https://api.reference.langfuse.com/index.md), instead of inferring them from code examples.
- **Use the [Langfuse CLI](https://langfuse.com/docs/api-and-data-platform/features/cli)** (`npx @langfuse/cli api <resource> <action>`) to read or write traces, prompts, datasets, and scores from the terminal.

Found an error in these docs? Please open an issue at <https://github.com/langfuse/langfuse-docs/issues>.
