Coding agent headtohead eval

From findscripter/everything-skills · View interactive version

Coding agent headtohead eval is an AI agent skill from the GitHub repository findscripter/everything-skills. 当需要在自己代码库上把 Claude Code、Aider、Codex 等编码 Agent 做可复现的对比评测时使用;做基于 YAML 任务声明 + git worktree 隔离的多次运行,产出含通过率/成本/耗时/一致性的对比报告;不适用于评测纯对话/生成质量、单模型基准或无判据的开放任务。触发词:编码 Agent 对比、agent-eval、通过率、git worktree、选型评测

How to use this skill

Skill file

编码 Agent 对比评测(通过率/成本/耗时)

用一个轻量 CLI,在可复现的任务上把多个编码 Agent 做「正面对决」(head-to-head)。"哪个编码 Agent 更好"通常靠感觉——本技能把它体系化为可度量、可复现的数据。

何时使用

适用:

不该用(负边界):

核心理念:声明式任务 + 隔离运行 + 多次重复 = 可复现的对比,而非一次性的主观印象。

步骤

  1. 声明任务:建 tasks/ 目录,每个任务一个 YAML(指定 repo、要改的文件、prompt、判据 judge、固定 commit)。
  2. 跑对决:对同一任务并列跑多个 Agent,每个至少 3 次(Agent 是非确定性的,需要看方差)。每次运行内部:

1. 从指定 commit 创建全新 git worktree(隔离,免 Docker,互不干扰、不破坏基础库);

2. 把 prompt 交给 Agent 执行;

3. 运行 judge 判据;

4. 记录 通过/失败、成本、耗时。

  1. 出报告:生成对比表,按通过率/成本/耗时/一致性横向比较,据此选型。

指令

CLI 用法(保留源命令):

# 1. 建任务目录
mkdir tasks
# 在 tasks/ 下按模板写每个任务的 YAML

# 2. 同一任务并列评多个 Agent,各跑 3 次
agent-eval run --task tasks/add-retry-logic.yaml \
  --agent claude-code --agent aider --runs 3

# 3. 生成对比报告
agent-eval report --format table

收集的指标(四维):

| 指标 | 测什么 |

|---|---|

| 通过率 Pass Rate | Agent 产出的代码能否通过 judge |

| 成本 Cost | 每任务 API 费用(可得时) |

| 耗时 Time | 完成的墙钟秒数 |

| 一致性 Consistency | 重复运行的通过率(如 3/3 = 100%) |

judge(判据)三类,按确定性优先选:

最佳实践(保留源约束):

示例

任务 YAML(声明式,固定 commit 保可复现):

name: add-retry-logic
description: Add exponential backoff retry to the HTTP client
repo: ./my-project
files:
  - src/http_client.py
prompt: |
  Add retry logic with exponential backoff to all HTTP requests.
  Max 3 retries. Initial delay 1s, max delay 30s.
judge:
  - type: pytest
    command: pytest tests/test_http_client.py -v
  - type: grep
    pattern: "exponential_backoff|retry"
    files: src/http_client.py
commit: "abc1234"  # 固定到特定 commit 以保证可复现

报告输出示意:

Task: add-retry-logic (3 runs each)
┌──────────────┬───────────┬────────┬────────┬─────────────┐
│ Agent        │ Pass Rate │ Cost   │ Time   │ Consistency │
├──────────────┼───────────┼────────┼────────┼─────────────┤
│ claude-code  │ 3/3       │ $0.12  │ 45s    │ 100%        │
│ aider        │ 2/3       │ $0.08  │ 38s    │  67%        │
└──────────────┴───────────┴────────┴────────┴─────────────┘

judge 各类型片段:

# 确定性
judge:
  - type: pytest
    command: pytest tests/ -v
  - type: command
    command: npm run build
# 模式匹配
  - type: grep
    pattern: "class.*Retry"
    files: src/**/*.py
# LLM 评审
  - type: llm
    prompt: |
      Does this implementation correctly handle exponential backoff?
      Check for: max retries, increasing delays, jitter.

注意事项

互见


采编自 affaan-m/everything-claude-code(MIT 许可);CLI 源自 github.com/joaquinhuigomez/agent-eval。

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.