Skip to content
Development
Skill

/agentsop-metric-design

Decomposed, multi-criteria metric design for LLM pipelines. The metric IS the model — change the metric and the optimizer changes behavior. Decompose by default; bool during compile, float during eval; calibrate against human; mitigate judge bias. Search keywords: LLM-as-judge,

From plugin
skillalchemy
46149 skills

Claude Code

$ npx -y skills add agentsope/SkillAlchemy --skill agentsop-metric-design --agent claude-code

SKILL.md

agentsop-metric-design.SKILL.md
name: agentsop-metric-design
version: 0.1.0
phase: D
tier: core
frequency: high
status: opinionated
description: >-
  Decomposed, multi-criteria metric design for LLM pipelines. The metric IS the model —
  change the metric and the optimizer changes behavior. Decompose by default; bool during
  compile, float during eval; calibrate against human; mitigate judge bias. Search keywords:
  LLM-as-judge, llm as judge, eval metric, evaluation score, scoring function, rubric,
  RAGAS, G-Eval, judge bias, verbosity bias, how to evaluate LLM output.

metric-design — Decomposed, Multi-Criteria Metrics for LLM Pipelines

> "It's unproductive to launch optimization runs using a poorly designed program or a bad metric." > — DSPy core team [dspy.ai/learn/optimization/overview/]

> "LLM judges exhibit self-preference, recency, rubric-order, score-ID, and length biases." > — Synthesized from [arxiv.org/pdf/2506.02592, arxiv.org/pdf/2509.26072]

This is a **tool skill**. It produces a metric function (and a calibration receipt) that other skills consume — DSPy compilers (MIPROv2 / GEPA / BootstrapFewShot), LlamaIndex `FaithfulnessEvaluator`/`RelevancyEvaluator`/`RetrieverEvaluator`, LangGraph eval judges, RAGAS, TruLens. The metric is the optimization target. Get it wrong and every downstream optimizer is theatre.

---

1. 何时激活 (When to Activate)

Activate when **any** of these is true:

  • **Optimization runs**: a DSPy / OpenAI-Evals / RAGAS / TruLens job is about to consume a `metric(example, pred) -> bool|float`. The metric drives gradient-free search; bias propagates into the artifact.
  • **RAG evaluation**: deciding chunk size, reranker, hybrid alpha, retriever-k. A bad metric here picks the wrong chunking strategy and you ship it.
  • **Agent benchmarks**: tool-use, multi-step, planning. A single holistic LLM judge cannot distinguish "wrong tool" from "right tool, wrong args".
  • **Prompt tuning that has gone past 2 manual iterations**: if you're tuning a prompt and have no quantitative metric, you are guessing. Stop the prompt edits, write the metric.
  • **Production regression test**: every chunking / embedding / retriever / prompt PR change needs a metric gate (LlamaIndex `OP-10 EvalLoop`).

**Do NOT activate for:**

  • One-off exploratory prompt tests where no decision rides on the output.
  • Tasks where exact-match / unit-test / schema-validity already gives ≥95% of signal — don't over-engineer.
  • Where the user explicitly refuses to commit to any evaluation criteria (then `dspy-sop` will refuse to compile anyway; this skill cannot help).

---

2. 核心心智模型 (Core Mental Model)

**"The metric IS the model. Change the metric, change the behavior."**

A DSPy/GEPA/MIPRO optimizer is a black-box search that maximizes `metric(pred, example)`. Whatever the metric rewards, the compiled prompt will produce. If the metric prefers verbose, hedged answers (which an LLM judge will, by default — judges over-prefer length [arxiv.org/pdf/2506.02592]), the optimizer will produce verbose, hedged answers. **A bad metric beats a good optimizer every time.**

Three corollaries:

1. **Decompose by default.** A single holistic LLM-as-judge call ("is this answer good? rate 1-5") collapses orthogonal axes (factuality, tone, length, relevance) into one noisy scalar. Decompose into N orthogonal yes/no sub-judges, then aggregate. Same number of LM calls in the limit, vastly less noise. 2. **Bool during compile, float during eval.** Same metric function, two return types based on the `trace` argument. Compile-time `bool` prevents the optimizer from chasing noise in the middle of the distribution; eval-time `float` gives gradient for reporting and debugging. [dspy.ai/learn/evaluation/metrics/] 3. **The metric must be calibrated against humans.** ≥20 spot-checks where you (the human) rate the same examples the metric does. If metric disagrees with human on >20% of cases, **fix the metric before any compile**. Otherwise the optimizer just learns the metric's bias.

Why holistic judges fail (the catalog)

| Bias | What it does | Source | |---|---|---| | Length bias | Judges prefer longer answers regardless of quality | [arxiv.org/pdf/2506.02592] | | Self-preference | A judge from family X prefers outputs from family X | [arxiv.org/pdf/2506.02592] | | Recency / position | Last option in a pairwise rated higher | [arxiv.org/pdf/2509.26072] | | Rubric-order | Criteria listed first weighted more | [arxiv.org/pdf/2509.26072] | | Score-ID | "5" and "10" anchor differently across rubrics | [arxiv.org/pdf/2509.26072] | | Provenance | Knowing the source model biases the rating | [arxiv.org/pdf/2506.02592] |

Full catalog in `references/R2-judge-bias-catalog.md`.

---

3. SOP (Standard Operating Procedure)

0. Confirm activation criteria (§1)
1. DECOMPOSE: list orthogonal criteria
2. CHOICE: bool vs float per criterion
3. WRITE: implement sub-judges + aggregator
4. BIAS-TEST: probe for length, position, self-preference
5. CALIBRATE: ≥20 human spot-checks; agreement ≥80%
6. SHIP: hand metric to optimizer / eval loop

Stage 1 — Decompose

Write down the criteria the user *actually* cares about. For an open-ended Q&A:

  • **Factual?** (yes/no) — answer makes no unsupported claims
  • **On-topic?** (yes/no) — addresses the question
  • **Concise?** (length penalty, scalar) — token count vs budget
  • **Non-hedging?** (yes/no) — no "as an AI language model..." or "it depends" cop-outs
  • **Cites source?** (yes/no) — if grounded retrieval is required

For RAG specifically, copy LlamaIndex's triad: **Faithfulness** (answer entailed by context), **Relevancy** (answer addresses query), **Retriever quality** (MRR / hit-rate on labeled QA pairs). See `references/R1-source-evidence.md`.

**Output of this stage**: a checklist of 3–6 sub-criteria, each with type (`bool` / scalar) and aggregation rule (AND for hard gates, weighted sum for soft).

Stage 2 — Bool vs Float Choice (per criterion)

Per [dspy.ai/learn/evaluation/metr

Read more
@agentsope
Ships withskillalchemy

Turn people, methods, and experience into installable, reusable agent skills. SkillAlchemy is an open-world agent skill creation system that turns underspecified skill briefs and open-world sources into installable, reusable agent skills.

Stars on GitHub

Momentum

stars in total
461
Star history of agentsope/SkillAlchemy on GitHub, a chart by star-history.com

Other skills on skillalchemy.

LEAP

LEAP

LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into…

Lens

Lens

Lens — Add a cognitive lens to any problem. It accepts a task description and produces an enhanced description that surfaces…

agentsop-aider

agentsop-aider

SOP for terminal-based, git-native AI pair programming with Aider (git work-tree + tree-sitter repo-map + edit-format +…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about agentsop-metric-design.

Which coding agents can use agentsop-metric-design?
agentsop-metric-design installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.