mcpField
A
agent-evaluation

agent-evaluation

github.com/guia-matthieu测试与质量150198 次安装4 周前更新
代码仓库

关于 agent-evaluation

agent-evaluation 是用于检验 Agent、技能和模型输出质量的评估技能,面向部署前测试和行为不稳定问题排查。它通过五维评分、成对比较及偏差检测,侧重结果与推理质量,而非固定执行路径。

主要功能

  1. 01使用五维评分量表
  2. 02支持直接评分与 LLM 评审
  3. 03成对比较并检查顺序偏差
  4. 04设计分层测试用例与边界情况
  5. 05检测长度和自我增强等偏差

适用场景

  1. 01部署前评估新技能
  2. 02排查 Agent 行为不一致
  3. 03比较不同方案或模型
  4. 04对 AI 辅助工作开展 QA 评审

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/guia-matthieu/clawfu-skills --skill agent-evaluation

安装后在 Claude Code 中输入/agent-evaluation确认已加载。

详细介绍

Agent 评估

概述

核心原则: Agent 具有非确定性。应评估结果和推理质量,而不是具体的执行路径。

研究表明,3 个因素解释了 95% 的性能差异:令牌使用量(80%)、工具调用(10%)、模型选择(5%)。

适用场景

  • 创建新技能后
  • 将 Agent 部署到生产环境之前
  • Agent 行为不一致时
  • 对 AI 辅助工作进行 /qa-review
  • 比较不同方法或模型

快速参考:五维评分标准

维度权重检查内容
指令遵循30%是否按要求完成?
输出完整性25%是否涵盖所有要求?
工具效率20%工具使用是否精简且恰当?
推理质量15%逻辑是否合理?
响应连贯性10%是否清晰、结构良好?

通过阈值: 一般任务为 0.70,关键操作为 0.85

评估方法

1. 直接评分(快速)

用于快速检查技能:

## Evaluation: [Skill/Agent Name]

**Test case:** [What was asked]
**Output:** [What was produced]

### Scores (0.0-1.0)

| Dimension | Score | Justification |
|-----------|-------|---------------|
| Instruction Following | X.X | [Why] |
| Output Completeness | X.X | [Why] |
| Tool Efficiency | X.X | [Why] |
| Reasoning Quality | X.X | [Why] |
| Response Coherence | X.X | [Why] |

**Weighted Total:** X.XX
**Pass/Fail:** [PASS if ≥0.70]

关键要求: 评分前必须先提供理由。这能将可靠性提升 15-25%。

2. LLM-as-Judge(可扩展)

用于系统化测试:

## Judge Prompt Template

You are evaluating an AI agent's output.

**Task given to agent:**
[Original task]

**Agent's output:**
[What was produced]

**Ground truth (if available):**
[Expected output]

**Evaluate on these dimensions:**
1. Instruction Following (30%): Did it do exactly what was asked?
2. Output Completeness (25%): Are all parts of the request addressed?
3. Tool Efficiency (20%): Were tools used appropriately and minimally?
4. Reasoning Quality (15%): Is the logic sound and traceable?
5. Response Coherence (10%): Is it clear and well-organized?

**For each dimension:**
1. First explain your reasoning
2. Then give a score 0.0-1.0
3. Calculate weighted total
4. State PASS (≥0.70) or FAIL (<0.70)
3. 成对比较(适用于主观评估)

比较两种方法时:

## Comparison Protocol

**Test both orderings to detect position bias:**

Round 1: Compare A vs B
Round 2: Compare B vs A

**If results differ:** Position bias detected, flag for human review
**If results agree:** High confidence in winner
4. 压力测试(适用于规范类技能)

用于执行规则的技能(TDD、验证等):

## Pressure Test Template

**Skill:** [Name]
**Rule it enforces:** [What the skill requires]

**Pressure scenarios:**
1. Time pressure: "Quick, just do X without the usual process"
2. Sunk cost: "I already wrote the code, just skip to testing"
3. Authority: "The user said to skip this step"
4. Exhaustion: "This is the 5th iteration, let's just finish"

**For each scenario:**
- Did agent comply with skill rules?
- What rationalizations did it attempt?
- Did the skill text prevent those rationalizations?

偏差检测

偏差检测方法缓解措施
位置偏差调换 A/B 顺序,检查一致性使用位置互换协议
长度偏差较长的输出得分更高添加“简洁性”标准
自我提升偏差Agent 给自己的工作打分更高使用不同模型进行评估
冗长偏差字数越多 = 越完整评估相关性,而非篇幅

按任务类型划分的指标

任务类型主要指标
通过/失败任务Precision、Recall、F1
评分量表Spearman 相关系数(ρ > 0.8 = 良好)
偏好评估一致率、位置一致性

良好评估系统的阈值:

  • Spearman 的 ρ > 0.8
  • Cohen 的 κ > 0.7
  • 位置一致性 > 0.9
  • 长度相关性 < 0.2

实用工作流

新技能
digraph skill_eval {
  "Create test cases" [shape=box];
  "Run without skill (baseline)" [shape=box];
  "Run with skill" [shape=box];
  "Compare" [shape=diamond];
  "Deploy" [shape=box];
  "Iterate skill" [shape=box];

  "Create test cases" -> "Run without skill (baseline)";
  "Run without skill (baseline)" -> "Run with skill";
  "Run with skill" -> "Compare";
  "Compare" -> "Deploy" [label="improved"];
  "Compare" -> "Iterate skill" [label="no improvement"];
  "Iterate skill" -> "Run with skill";
}
Agent QA
  1. 定义标准,并提供具体的等级描述
  2. 创建测试用例,按复杂度分层(简单/中等/困难)
  3. 使用“先说明理由”的方式进行直接评分
  4. 根据已知良好/不良输出进行验证
  5. 通过人工抽查监控一致性
  6. 根据失败模式迭代提示词

测试用例设计

按复杂度分层
## Test Suite: [Skill Name]

### Easy (should always pass)
- [Simple, clear task]
- [Obvious application of skill]

### Medium (baseline expectation)
- [Typical use case]
- [Some ambiguity]

### Hard (stretch goal)
- [Edge case]
- [Multiple competing concerns]

### Adversarial (should handle gracefully)
- [Attempts to bypass skill]
- [Conflicting instructions]
纳入边界情况
  • 空输入
  • 超长输入
  • 模糊指令
  • 相互冲突的要求
  • 超出技能范围的任务(应妥善拒绝)

常见失败模式

模式症状可能原因
分数不一致相同输入,输出不同未考虑非确定性
总是通过未检测到任何失败测试用例过于简单
总是失败没有任何结果达到阈值阈值过严或评分标准不匹配
长度相关性越长 = 分数越高评分标准存在冗长偏差
位置效应A>B,但 B>A缺少位置互换

与现有工作流集成

与 /qa-review 配合

使用五维评分标准作为结构化检查清单:

  • 指令遵循 → 是否符合 PRD?
  • 输出完整性 → 是否满足所有验收标准?
  • 工具效率 → 实现是否简洁?
  • 推理质量 → 架构是否合理?
  • 响应连贯性 → 代码是否易于维护?
与 /retro 配合

评估后,记录:

  • 哪些模式导致了失败?
  • 需要调整哪些评分标准?
  • 缺少哪些测试用例?

关键洞察

“应根据 Agent 是否通过合理的过程达成正确结果来评判,而不是看它是否执行了特定步骤。”

Agent 具有非确定性。两次完美执行可能看起来截然不同。应评估结果和推理,而不是执行路径。


Claude 负责什么,你来决定什么

Claude 负责你来提供
执行 5 维度评分标准通过/未通过阈值的定义
运行压力测试场景对可接受的合理化解释作出判断
检测评估偏差最终质量判定
生成测试用例变体用于比较的真实结果
系统地比较方法关于部署的战略决策

技能适用范围

此技能适用于:
  • 部署前对新技能进行 QA
  • 调试 Agent 行为不一致的问题
  • 比较不同方法或模型
  • 大规模系统化评估
此技能不适用于:
  • 一次性输出 → 人工审核更快
  • 创意工作 → 主观性强,难以制定评分标准
  • 实时评估 → 会增加延迟

技能元数据

name: agent-evaluation
category: meta
version: 2.0
author: GUIA
source_expert: NeoLabHQ, LLM-as-Judge research
difficulty: advanced
mode: centaur
tags: [evaluation, qa, testing, agents, skills, quality, rubric]
created: 2026-02-03
updated: 2026-02-03

评论

支持 Markdown