Design a Benchmark Harness for Claude Code Agent Accuracy

Create a structured testing framework to evaluate coding agent performance on pull requests using deterministic ground-truth verification.

Agent prompt for Claude

Prompt

Prompt
Act as a Senior Software Engineer specializing in automated testing frameworks. Design a benchmark harness to evaluate the accuracy of Claude Code when performing refactoring or bug-fixing tasks on specific pull requests. Follow these rules: 1. Define a JSON schema for test cases including input file state, target function signature, and expected output. 2. Establish a scoring rubric with three distinct tiers: Functional correctness, adherence to existing code style, and maintainability. 3. Include a verification script that uses diff-based comparison against a ground-truth branch. 4. Ensure the output provides a clear pass/fail report for every test case. Output format: Section 1: Benchmark Architecture Overview. Section 2: Test Case JSON Schema. Section 3: Scoring Rubric Table. Section 4: Verification Logic Snippet. This is not professional software engineering services; consult your team lead for architectural standards.

Example output

Example for: a Python-based microservice architecture using FastAPI requiring automated refactoring validation. ### Section 1: Benchmark Architecture Overview The harness operates by cloning a target repository into a sandboxed environment. It executes a pre-defined sequence of Claude Code commands against specific PR branches. Results are compared against a known-good 'golden' branch using a custom diff-comparison tool that ignores whitespace but enforces strict functional equivalence. ### Section 2: Test Case JSON Schema { "test_id": "refactor_001", "description": "Convert synchronous DB call to async", "input_file": "db_service.py", "target_function": "get_user_by_id", "expected_imports": ["from typing import Optional", "import asyncio"], "assertions": ["function must be decorated with @app.get", "db call must use await keyword"] } ### Section 3: Scoring Rubric Table | Metric | Weight | Success Criteria |
| --- | --- | --- |
| Functional | 60% | Passes all unit tests in test_suite.py |
| Style | 20% | Zero linting errors via ruff |
| Maintainability | 20% | Cyclomatic complexity index < 10 | ### Section 4: Verification Logic Snippet python def verify_agent_output(agent_path, golden_path): diff = run_diff(agent_path, golden_path) if diff.is_empty(): return Pass else: return Fail(reason=diff.summary)

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Requires a strict JSON schema for consistent test inputs.
  • Establishes a weighted rubric to quantify agent performance.
  • Uses a diff-based comparison logic for objective verification.

Use this prompt in Claude or Claude Code to build a custom evaluation suite for your repository. Paste your specific project language requirements or target library versions after the prompt to tailor the test cases.

Common edits

  • Adjust the scoring rubric weights to favor speed over style.
  • Add specific library dependencies to the test case schema.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

More in Claude Code
Agent OrchestrationClaude

Design Mock Tool Fixtures for Agent Trajectory Testing

Generate deterministic mock tool responses to test agent decision trees, edge-case failures, and schema-breaking payloads without live API usage or costs.

AI Coding AgentsClaude Code

Generate Reproducible Bug Fix Specs for Coding Agents

Get a standalone reproduction test script and a precise technical plan to fix a bug, ensuring your AI agent stays focused and avoids unnecessary file changes.

Create Selective Pre-Commit Hooks for Claude Code

This prompt generates a bash script that triggers specific tests and typechecks only for packages modified in your current git branch.

Sync Test Factories and Fixtures with Database Migrations

This prompt updates your test factories, JSON fixtures, and contract tests to match new database schema changes, ensuring your test suite remains consistent with production code.

Automated Dependency Upgrade and Rollback Protocol

Generate a safe, step-by-step dependency upgrade plan that includes strict semver validation, lockfile parity checks, and automated rollback triggers.

AI Coding AgentsClaude Code

Create Automated Verification Loops for Long-Running Coding Agents

Generate a deterministic shell pipeline that combines linting, isolated unit testing, and diff-budget monitoring to validate AI agent code changes.