Communitygithub.com

agent-eval

將程式碼代理人(Claude Code、Aider、Codex 等)在自訂任務上進行頭對頭比較,並提供通過率、成本、時間和一致性指標。當需要在不同程式碼代理人之間做選擇,或更動代理人設定後需要量化通過率、成本與時間,而非僅憑感覺時使用。

agent-eval 是什麼?

Agent Eval 是一個輕量級 CLI 工具,用於在可重現的任務上對程式碼代理人進行頭對頭比較。它解決了「哪個程式碼代理人最好?」這類問題長期以來僅依賴主觀感受的痛點 — 例如比較 Claude Code、Aider、Codex 等工具在自己程式碼庫上的真實表現。該技能支援以 YAML 定義任務,包含提示、受影響檔案與判斷標準(單元測試、指令執行、grep 模式匹配或 LLM 評分),並利用 Git worktree 隔離每個代理人執行環境,無需 Docker。產出指標包括通過率、API 成本、執行時間與多次執行的穩定性(一致性),並能產生表格比較報表。最佳實踐建議使用 3–5 個真實工作負載任務、至少執行 3 次以捕捉變異性、鎖定 git commit 以確保結果可重現,並包含至少一個決定性判斷器以減少 LLM 評分帶來的雜訊。

相容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/agent-eval

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Agent Eval 技能

一個輕量級 CLI 工具,用於在可重現的任務上對程式碼代理人進行頭對頭比較。每個「哪個程式碼代理人最好?」的比較都是憑感覺 — 這個工具將其系統化。

何時啟用

  • 在自己的程式碼庫上比較程式碼代理人(Claude Code、Aider、Codex 等)
  • 在採用新工具或模型之前衡量代理人效能
  • 當代理人更新其模型或工具時執行迴歸檢查
  • 為團隊產生資料驅動的代理人選擇決策

安裝

注意: 請在檢視原始碼後,從其儲存庫安裝 agent-eval。

核心概念

YAML 任務定義

以宣告式的方式定義任務。每個任務指定要做什麼、要觸碰哪些檔案,以及如何判斷成功:

name: add-retry-logic
description: 為 HTTP 客戶端加入指數退避重試邏輯
repo: ./my-project
files:
  - src/http_client.py
prompt: |
  為所有 HTTP 請求加入具有指數退避的重試邏輯。
  最多重試 3 次。初始延遲 1 秒,最大延遲 30 秒。
judge:
  - type: pytest
    command: pytest tests/test_http_client.py -v
  - type: grep
    pattern: "exponential_backoff|retry"
    files: src/http_client.py
commit: "abc1234"  # 鎖定特定提交以確保可重現性

Git Worktree 隔離

每個代理人執行都會獲得自己的 Git worktree — 無需 Docker。這提供了可重現性的隔離,使代理人不會互相干擾或破壞基礎儲存庫。

收集的指標

指標衡量內容
通過率代理人產生的程式碼是否通過判斷標準?
成本每個任務的 API 花費(當可用時)
時間完成所需的掛鐘秒數
一致性跨重複執行的通過率(例如 3/3 = 100%)

工作流程

1. 定義任務

建立一個 tasks/ 目錄,內含 YAML 檔案,每個任務一個:

mkdir tasks
# 撰寫任務定義(參見上方範本)

2. 執行代理人

根據您的任務執行代理人:

agent-eval run --task tasks/add-retry-logic.yaml --agent claude-code --agent aider --runs 3

每次執行:

  1. 從指定的提交建立一個新的 Git worktree
  2. 將提示交給代理人
  3. 執行判斷標準
  4. 記錄通過/失敗、成本和時間

3. 比較結果

產生比較報表:

agent-eval report --format table
Task: add-retry-logic(3 次執行)
┌──────────────┬───────────┬────────┬────────┬─────────────┐
│ Agent        │ 通過率    │ 成本   │ 時間   │ 一致性     │
├──────────────┼───────────┼────────┼────────┼─────────────┤
│ claude-code  │ 3/3       │ $0.12  │ 45s    │ 100%        │
│ aider        │ 2/3       │ $0.08  │ 38s    │  67%        │
└──────────────┴───────────┴────────┴────────┴─────────────┘

判斷器類型

基於程式碼(決定性)

judge:
  - type: pytest
    command: pytest tests/ -v
  - type: command
    command: npm run build

基於模式

judge:
  - type: grep
    pattern: "class.*Retry"
    files: src/**/*.py

基於模型(LLM 作為判斷器)

judge:
  - type: llm
    prompt: |
      這個實作是否正確處理了指數退避?
      檢查:最大重試次數、遞增延遲、抖動。

最佳實踐

  • 從 3-5 個任務開始,代表您的實際工作負載,而非玩具範例
  • 每個代理人至少執行 3 次,以捕捉變異性 — 代理人是非確定性的
  • 在任務 YAML 中鎖定提交,使結果在數天/數週內可重現
  • 每個任務至少包含一個決定性判斷器(測試、建置)— LLM 判斷器會增加雜訊
  • 同時追蹤成本與通過率 — 成本高 10 倍但通過率 95% 的代理人可能並非正確選擇
  • 對任務定義進行版本控制 — 它們是測試裝置,需將其視為程式碼

連結

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

相關技能