Evaluation Methods for Claude Code Agents

SkillAI & models

Evaluate and improve Claude Code commands, skills, and agents. Use when testing prompt effectiveness, validating context engineering choices, or measuring improvement quality.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Evaluation Methods for Claude Code Agents skill

What this skill tells your AI

The instructions your AI receives, as published by neolabhq/context-engineering-kit in skills/agent-evaluation/SKILL.md and read by ahel’s review.

Evaluation of agent systems requires different approaches than traditional software or even standard language model applications. Agents make dynamic decisions, are non-deterministic between runs, and often lack single correct answers. Effective evaluation must account for these characteristics while providing actionable feedback. A robust evaluation framework enables continuous improvement, catches regressions, and validates that context engineering choices achieve intended effects.

Core Concepts

Agent evaluation requires outcome-focused approaches that account for non-determinism and multiple valid paths. Multi-dimensional rubrics capture various quality aspects: factual accuracy, completeness, citation accuracy, source quality, and tool efficiency. LLM-as-judge provides scalable evaluation while human evaluation catches edge cases.

The key insight is that agents may find alternative paths to goals—the evaluation should judge whether they achieve right outcomes while following reasonable processes.

Performance Drivers: The 95% Finding Research on the BrowseComp evaluation (which tests browsing agents' ability to locate hard-to-find information) found that three factors explain 95% of performance variance:

FactorVariance ExplainedImplication
Token usage80%More tokens = better performance
Number of tool calls~10%More exploration helps
Model choice~5%Better models multiply efficiency

Implications for Claude Code development:

  • Token budgets matter: Evaluate with realistic token constraints
  • Model upgrades beat token increases: Upgrading models provides larger gains than increasing token budgets
  • Multi-agent validation: Validates architectures that distribute work across subagents with separate context windows

Evaluation Challenges

Non-Determinism and Multiple Valid Paths

Agents may take completely different valid paths to reach goals. One agent might search three sources while another searches ten. They might use different tools to find the same answer. Traditional evaluations that check for specific steps fail in this context.

Solution: The solution is outcomes, not exact execution paths. Judge whether the agent achieves the right result through a reasonable process.

Context-Dependent Failures

Agent failures often depend on context in subtle ways. An agent might succeed on complex queries but fail on simple ones. It might work well with one tool set but fail with another. Failures may emerge only after extended interaction when context accumulates.

Solution: Evaluation must cover a range of complexity levels and test extended interactions, not just isolated queries.

Composite Quality Dimensions

Agent quality is not a single dimension. It includes factual accuracy, completeness, coherence, tool efficiency, and process quality. An agent might score high on accuracy but low in efficiency, or vice versa.

An agent might score high on accuracy but low in efficiency.

Solution: Evaluation rubrics must capture multiple dimensions with appropriate weighting for the use case.

Evaluation Rubric Design

Multi-Dimensional Rubric

Effective rubrics cover key dimensions with descriptive levels:

Instruction Following (weight: 0.30)

  • Excellent (1.0): All instructions followed precisely
  • Good (0.8): Minor deviations that don't affect outcome
  • Acceptable (0.6): Major instructions followed, minor ones missed
  • Poor (0.3): Significant instructions ignored
  • Failed (0.0): Fundamentally misunderstood the task

Output Completeness (weight: 0.25)

  • Excellent: All requested aspects thoroughly covered
  • Good: Most aspects covered with minor gaps
  • Acceptable: Key aspects covered, some gaps
  • Poor: Major aspects missing
  • Failed: Fundamental aspects not addressed

Tool Efficiency (weight: 0.20)

  • Excellent: Optimal tool selection and minimal calls
  • Good: Good tool selection with minor inefficiencies
  • Acceptable: Appropriate tools with some redundancy
  • Poor: Wrong tools or excessive calls
  • Failed: Severe tool misuse or extremely excessive calls

Reasoning Quality (weight: 0.15)

  • Excellent: Clear, logical reasoning throughout
  • Good: Generally sound reasoning with minor gaps
  • Acceptable: Basic reasoning present
  • Poor: Reasoning unclear or flawed
  • Failed: No apparent reasoning

Response Coherence (weight: 0.10)

  • Excellent: Well-structured, easy to follow
  • Good: Generally coherent with minor issues
  • Acceptable: Understandable but could be clearer
  • Poor: Difficult to follow
  • Failed: Incoherent

Scoring Approach

Convert dimension assessments to numeric scores (0.0 to 1.0) with appropriate weighting. Calculate weighted overall scores. Set passing thresholds based on use case requirements (typically 0.7 for general use, 0.85 for critical operations).

Evaluation Methodologies

LLM-as-Judge

Using an LLM to evaluate agent outputs scales well and provides consistent judgments. Design evaluation prompts that capture the dimensions of interest. LLM-based evaluation scales to large test sets and provides consistent judgments. The key is designing effective evaluation prompts that capture the dimensions of interest.

Provide clear task description, agent output, ground truth (if available), evaluation scale with level descriptions, and request structured judgment.

Evaluation Prompt Template:

You are evaluating the output of a Claude Code agent.

## Original Task
{task_description}

## Agent Output
{agent_output}

## Ground Truth (if available)
{expected_output}

## Evaluation Criteria
For each criterion, assess the output and provide:
1. Score (1-5)
2. Specific evidence supporting your score
3. One improvement suggestion

### Criteria
1. Instruction Following: Did the agent follow all instructions?
2. Completeness: Are all requested aspects covered?
3. Tool Efficiency: Were appropriate tools used efficiently?
4. Reasoning Quality: Is the reasoning clear and sound?
5. Response Coherence: Is the output well-structured?

Provide your evaluation as a structured assessment with scores and justifications.

Chain-of-Thought Requirement: Always require justification before the score. Research shows this improves reliability by 15-25% compared to score-first approaches.

Human Evaluation

Human evaluation catches what automation misses:

  • Hallucinated answers on unusual queries
  • Subtle context misunderstandings
  • Edge cases that automated evaluation overlooks
  • Qualitative issues with tone or approach

For Claude Code development, ask users this:

  • Review agent outputs manually for edge cases
  • Sample systematically across complexity levels
  • Track patterns in failures to inform prompt improvements

End-State Evaluation

For commands that produce artifacts (files, configurations, code), evaluate the final output rather than the process:

  • Does the generated code work?
  • Is the configuration valid?
  • Does the output meet requirements?

Test Set Design

Sample Selection Start with small samples during development. Early in agent development, changes have dramatic impacts because there is abundant low-hanging fruit. Small test sets reveal large effects.

Sample from real usage patterns. Add known edge cases. Ensure coverage across complexity levels.

Complexity Stratification Test sets should span complexity levels: simple (single tool call), medium (multiple tool calls), complex (many tool calls, significant ambiguity), and very complex (extended interaction, deep reasoning).

Context Engineering Evaluation

Testing Prompt Variations

When iterating on Claude Code prompts, evaluate systematically:

  1. Baseline: Run current prompt on test cases
  2. Variation: Run modified prompt on same cases
  3. Compare: Measure quality scores, token usage, efficiency
  4. Analyze: Identify which changes improved which dimensions

Testing Context Strategies

Context engineering choices should be validated through systematic evaluation. Run agents with different context strategies on the same test set. Compare quality scores, token usage, and efficiency metrics.

Degradation Testing

Test how context degradation affects performance by running agents at different context sizes. Identify performance cliffs where context becomes problematic. Establish safe operating limits.

Advanced Evaluation: LLM-as-Judge

Key insight: LLM-as-a-Judge is not a single technique but a family of approaches, each suited to different evaluation contexts. Choosing the right approach and mitigating known biases is the core competency this skill develops.

The Evaluation Taxonomy

Evaluation approaches fall into two primary categories with distinct reliability profiles:

Direct Scoring: A single LLM rates one response on a defined scale.

  • Best for: Objective criteria (factual accuracy, instruction following, toxicity)
  • Reliability: Moderate to high for well-defined criteria
  • Failure mode: Score calibration drift, inconsistent scale interpretation

Pairwise Comparison: An LLM compares two responses and selects the better one.

  • Best for: Subjective preferences (tone, style, persuasiveness)
  • Reliability: Higher than direct scoring for preferences
  • Failure mode: Position bias, length bias

Research from the MT-Bench paper (Zheng et al., 2023) establishes that pairwise comparison achieves higher agreement with human judges than direct scoring for preference-based evaluation, while direct scoring remains appropriate for objective criteria with clear ground truth.

The Bias Landscape

LLM judges exhibit systematic biases that must be actively mitigated:

Position Bias: First-position responses receive preferential treatment in pairwise comparison. Mitigation: Evaluate twice with swapped positions, use majority vote or consistency check.

Length Bias: Longer responses are rated higher regardless of quality. Mitigation: Explicit prompting to ignore length, length-normalized scoring.

Self-Enhancement Bias: Models rate their own outputs higher. Mitigation: Use different models for generation and evaluation, or acknowledge limitation.

Verbosity Bias: Detailed explanations receive higher scores even when unnecessary. Mitigation: Criteria-specific rubrics that penalize irrelevant detail.

Authority Bias: Confident, authoritative tone rated higher regardless of accuracy. Mitigation: Require evidence citation, fact-checking layer.

Metric Selection Framework

Choose metrics based on the evaluation task structure:

Task TypePrimary MetricsSecondary Metrics
Binary classification (pass/fail)Recall, Precision, F1Cohen's κ
Ordinal scale (1-5 rating)Spearman's ρ, Kendall's τCohen's κ (weighted)
Pairwise preferenceAgreement rate, Position consistencyConfidence calibration
Multi-labelMacro-F1, Micro-F1Per-label precision/recall

The critical insight: High absolute agreement matters less than systematic disagreement patterns. A judge that consistently disagrees with humans on specific criteria is more problematic than one with random noise.

Evaluation Metrics Reference

Classification Metrics (Pass/Fail Tasks)

Precision: Of all responses marked as passing, what fraction truly passed?

  • Use when false positives are costly

Recall: Of all actually passing responses, what fraction did we identify?

  • Use when false negatives are costly

F1 Score: Harmonic mean of precision and recall

  • Use for balanced single-number summary

Agreement Metrics (Comparing to Human Judgment)

Cohen's Kappa: Agreement adjusted for chance

  • 0.8: Almost perfect agreement

  • 0.6-0.8: Substantial agreement
  • 0.4-0.6: Moderate agreement
  • < 0.4: Fair to poor agreement

Correlation Metrics (Ordinal Scores)

Spearman's Rank Correlation: Correlation between rankings

  • 0.9: Very strong correlation

  • 0.7-0.9: Strong correlation
  • 0.5-0.7: Moderate correlation
  • < 0.5: Weak correlation

Good Evaluation System Indicators

MetricGoodAcceptableConcerning
Spearman's rho> 0.80.6-0.8< 0.6
Cohen's Kappa> 0.70.5-0.7< 0.5
Position consistency> 0.90.8-0.9< 0.8
Length-score correlation< 0.20.2-0.4> 0.4

Evaluation Approaches

Direct Scoring Implementation

Direct scoring requires three components: clear criteria, a calibrated scale, and structured output format.

Criteria Definition Pattern:

Criterion: [Name]
Description: [What this criterion measures]
Weight: [Relative importance, 0-1]

Scale Calibration:

  • 1-3 scales: Binary with neutral option, lowest cognitive load
  • 1-5 scales: Standard Likert, good balance of granularity and reliability
  • 1-10 scales: High granularity but harder to calibrate, use only with detailed rubrics

Prompt Structure for Direct Scoring:

You are an expert evaluator assessing response quality.

## Task
Evaluate the following response against each criterion.

## Original Prompt
{prompt}

## Response to Evaluate
{response}

## Criteria
{for each criterion: name, description, weight}

## Instructions
For each criterion:
1. Find specific evidence in the response
2. Score according to the rubric (1-{max} scale)
3. Justify your score with evidence
4. Suggest one specific improvement

## Output Format
Respond with structured JSON containing scores, justifications, and summary.

Chain-of-Thought Requirement: All scoring prompts must require justification before the score. Research shows this improves reliability by 15-25% compared to score-first approaches.

Pairwise Comparison Implementation

Pairwise comparison is inherently more reliable for preference-based evaluation but requires bias mitigation.

Position Bias Mitigation Protocol:

  1. First pass: Response A in first position, Response B in second
  2. Second pass: Response B in first position, Response A in second
  3. Consistency check: If passes disagree, return TIE with reduced confidence
  4. Final verdict: Consistent winner with averaged confidence

Prompt Structure for Pairwise Comparison:

You are an expert evaluator comparing two AI responses.

## Critical Instructions
- Do NOT prefer responses because they are longer
- Do NOT prefer responses based on position (first vs second)
- Focus ONLY on quality according to the specified criteria
- Ties are acceptable when responses are genuinely equivalent

## Original Prompt
{prompt}

## Response A
{response_a}

## Response B
{response_b}

## Comparison Criteria
{criteria list}

## Instructions
1. Analyze each response independently first
2. Compare them on each criterion
3. Determine overall winner with confidence level

## Output Format
JSON with per-criterion comparison, overall winner, confidence (0-1), and reasoning.

Confidence Calibration: Confidence scores should reflect position consistency:

  • Both passes agree: confidence = average of individual confidences
  • Passes disagree: confidence = 0.5, verdict = TIE

Rubric Generation

Well-defined rubrics reduce evaluation variance by 40-60% compared to open-ended scoring.

Rubric Components

  1. Level descriptions: Clear boundaries for each score level
  2. Characteristics: Observable features that define each level
  3. Examples: Representative outputs for each level (when possible)
  4. Edge cases: Guidance for ambiguous situations
  5. Scoring guidelines: General principles for consistent application

Strictness Calibration

  • Lenient: Lower bar for passing scores, appropriate for encouraging iteration
  • Balanced: Fair, typical expectations for production use
  • Strict: High standards, appropriate for safety-critical or high-stakes evaluation

Domain Adaptation

Rubrics should use domain-specific terminology:

  • A "code readability" rubric mentions variables, functions, and comments.
  • Documentation rubrics reference clarity, accuracy, completeness
  • Analysis rubrics focus on depth, accuracy, actionability

Practical Guidance

Evaluation Pipeline Design

Production evaluation systems require multiple layers:

┌─────────────────────────────────────────────────┐
│                 Evaluation Pipeline              │
├─────────────────────────────────────────────────┤
│                                                   │
│  Input: Response + Prompt + Context               │
│           │                                       │
│           ▼                                       │
│  ┌─────────────────────┐                         │
│  │   Criteria Loader   │ ◄── Rubrics, weights    │
│  └──────────┬──────────┘                         │
│             │                                     │
│             ▼                                     │
│  ┌─────────────────────┐                         │
│  │   Primary Scorer    │ ◄── Direct or Pairwise  │
│  └──────────┬──────────┘                         │
│             │                                     │
│             ▼                                     │
│  ┌─────────────────────┐                         │
│  │   Bias Mitigation   │ ◄── Position swap, etc. │
│  └──────────┬──────────┘                         │
│             │                                     │
│             ▼                                     │
│  ┌─────────────────────┐                         │
│  │ Confidence Scoring  │ ◄── Calibration         │
│  └──────────┬──────────┘                         │
│             │                                     │
│             ▼                                     │
│  Output: Scores + Justifications + Confidence     │
│                                                   │
└─────────────────────────────────────────────────┘

Avoiding Evaluation Pitfalls

Anti-pattern: Scoring without justification

  • Problem: Scores lack grounding, difficult to debug or improve
  • Solution: Always require evidence-based justification before score

Anti-pattern: Single-pass pairwise comparison

  • Problem: Position bias corrupts results
  • Solution: Always swap positions and check consistency

Anti-pattern: Overloaded criteria

  • Problem: Criteria measuring multiple things are unreliable
  • Solution: One criterion = one measurable aspect

Anti-pattern: Missing edge case guidance

  • Problem: Evaluators handle ambiguous cases inconsistently
  • Solution: Include edge cases in rubrics with explicit guidance

Anti-pattern: Ignoring confidence calibration

  • Problem: High-confidence wrong judgments are worse than low-confidence
  • Solution: Calibrate confidence to position consistency and evidence strength

Decision Framework: Direct vs. Pairwise

Use this decision tree:

Is there an objective ground truth?
├── Yes → Direct Scoring
│   └── Examples: factual accuracy, instruction following, format compliance
│
└── No → Is it a preference or quality judgment?
    ├── Yes → Pairwise Comparison
    │   └── Examples: tone, style, persuasiveness, creativity
    │
    └── No → Consider reference-based evaluation
        └── Examples: summarization (compare to source), translation (compare to reference)

Scaling Evaluation

For high-volume evaluation:

  1. Panel of LLMs (PoLL): Use multiple models as judges, aggregate votes

    • Reduces individual model bias
    • More expensive but more reliable for high-stakes decisions
  2. Hierarchical evaluation: Fast cheap model for screening, expensive model for edge cases

    • Cost-effective for large volumes
    • Requires calibration of screening threshold
  3. Human-in-the-loop: Automated evaluation for clear cases, human review for low-confidence

    • Best reliability for critical applications
    • Design feedback loop to improve automated evaluation

Examples

Example 1: Direct Scoring for Accuracy

Input:

Prompt: "What causes seasons on Earth?"
Response: "Seasons are caused by Earth's tilted axis. As Earth orbits the Sun,
different hemispheres receive more direct sunlight at different times of year."
Criterion: Factual Accuracy (weight: 1.0)
Scale: 1-5

Output:

{
  "criterion": "Factual Accuracy",
  "score": 5,
  "evidence": [
    "Correctly identifies axial tilt as primary cause",
    "Correctly explains differential sunlight by hemisphere",
    "No factual errors present"
  ],
  "justification": "Response accurately explains the cause of seasons with correct
scientific reasoning. Both the axial tilt and its effect on sunlight distribution
are correctly described.",
  "improvement": "Could add the specific tilt angle (23.5°) for completeness."
}

Example 2: Pairwise Comparison with Position Swap

Input:

Prompt: "Explain machine learning to a beginner"
Response A: [Technical explanation with jargon]
Response B: [Simple analogy-based explanation]
Criteria: ["clarity", "accessibility"]

First Pass (A first):

{ "winner": "B", "confidence": 0.8 }

Second Pass (B first):

{ "winner": "A", "confidence": 0.6 }

(Note: Winner is A because B was in first position)

Mapped Second Pass:

{ "winner": "B", "confidence": 0.6 }

Final Result:

{
  "winner": "B",
  "confidence": 0.7,
  "positionConsistency": {
    "consistent": true,
    "firstPassWinner": "B",
    "secondPassWinner": "B"
  }
}

Example 3: Rubric Generation

Input:

criterionName: "Code Readability"
criterionDescription: "How easy the code is to understand and maintain"
domain: "software engineering"
scale: "1-5"
strictness: "balanced"

Output (abbreviated):

{
  "levels": [
    {
      "score": 1,
      "label": "Poor",
      "description": "Code is difficult to understand without significant effort",
      "characteristics": [
        "No meaningful variable or function names",
        "No comments or documentation",
        "Deeply nested or convoluted logic"
      ]
    },
    {
      "score": 3,
      "label": "Adequate",
      "description": "Code is understandable with some effort",
      "characteristics": [
        "Most variables have meaningful names",
        "Basic comments present for complex sections",
        "Logic is followable but could be cleaner"
      ]
    },
    {
      "score": 5,
      "label": "Excellent",
      "description": "Code is immediately clear and maintainable",
      "characteristics": [
        "All names are descriptive and consistent",
        "Comprehensive documentation",
        "Clean, modular structure"
      ]
    }
  ],
  "edgeCases": [
    {
      "situation": "Code is well-structured but uses domain-specific abbreviations",
      "guidance": "Score based on readability for domain experts, not general audience"
    }
  ]
}

Iterative Improvement Workflow

  1. Identify weakness: Use evaluation to find where agent struggles
  2. Hypothesize cause: Is it the prompt? The context? The examples?
  3. Modify prompt: Make targeted changes based on hypothesis
  4. Re-evaluate: Run same test cases with modified prompt
  5. Compare: Did the change improve the target dimension?
  6. Check regression: Did other dimensions suffer?
  7. Iterate: Repeat until quality meets threshold

Guidelines

  1. Always require justification before scores - Chain-of-thought prompting improves reliability by 15-25%

  2. Always swap positions in pairwise comparison - Single-pass comparison is corrupted by position bias

  3. Match scale granularity to rubric specificity - Don't use 1-10 without detailed level descriptions

  4. Separate objective and subjective criteria - Use direct scoring for objective, pairwise for subjective

  5. Include confidence scores - Calibrate to position consistency and evidence strength

Shortened here. Read the whole file on GitHub.

Signals

GitHub stars
2k
Forks
157
Last commit
Aug 2026
Advanced
Catalog kind
skill
Gateway key
agent-evaluation-neolabhq
Source
github.com/neolabhq/context-engineering-kit