/agent-evals:agent-evalsfrom Agent Evals
Builds and runs deterministic and model-based evals for agent tools, hooks, and instructions. Writes JSON test cases and executes them with a Python runner.
Ships in Agent Evals. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The word "eval" covers two different things. Keep them apart, because they cost different amounts and prove different things.
hook and command.model.The runner is scripts/run_evals.py in this plugin's folder, two folders above this skill (<this-skill-dir>/../../scripts/run_evals.py). Python 3.8 or later, standard library only. <this-skill-dir>/../../examples/sample-cases.json has working cases of each kind: three hook cases, one command case and two model cases.
"by_design" with the reason when the tool's current behavior is a known limit you accepted. The case then says what the limit is, and tells you the day it moves.Also test the setup the protection depends on, not only the code. A hook that fails open (if its interpreter is not on the path, every command runs) needs a check that the interpreter is there.
When someone finds a bug in a tool, hook, wrapper or instruction:
sonnet and opus move to new versions on their own, so keep the model name with the results.Change one thing at a time. If two land together and a case changes, you cannot say which one did it. Run with --save, make the change, run again with --compare against the saved file, and read the list of what changed.
A JSON file with a cases list. Every case has an id (unique, no commas) and a kind. note (why the case exists) and by_design (a reason) are optional. A mistyped field name is refused, because it would silently grade nothing.
Paths in a case are relative to the case file's folder. {python} in a command is the Python that runs the script, so the file works where only python3 exists.
hook: feeds a payload on stdin to a hook command, the way Claude Code does, and checks the decision.
{"id": "deny-drop-table", "kind": "hook",
"command": "{python} hooks/block_writes.py",
"payload": "sqlcmd -S TESTBOX -Q \"DROP TABLE dbo.Orders;\"",
"expect": "deny", "reason_contains": "table"}
payload is a string (sent as a Bash tool call, with the string as the command) or a full JSON object (sent as it is, for other tools). expect is allow or deny. A deny case must have a reason_contains: the runner refuses the file without one, so a hook that blocks for the wrong reason, or a mistyped hook path, does not pass. The decision is read the way Claude Code reads it: exit code 2 is a deny with stderr as the reason (or the reason in the hook's JSON, if it printed a blocking decision), exit 0 with no output is allow (no objection), exit 0 with JSON uses hookSpecificOutput.permissionDecision, and that object needs "hookEventName": "PreToolUse". The only top-level decision values are approve and block. JSON in any other shape is an error, because Claude Code rejects it and runs the command. A hook that crashes, times out, exits with any code but 0 or 2, prints output that is not a decision, or exits 2 because Python could not open the script FAILS the case, whatever it expected, because a crashed hook lets the command run.
command: runs a shell command and checks the exit code and its stdout.
{"id": "avg-elapsed-3-runs", "kind": "command",
"command": "sqlcmd -S TESTBOX -E -b -i harness/avg_elapsed.sql -h -1 -W",
"exit_code": 0,
"must_match": ["(?m)^v1\\s+1\\.500\\s+pass$", "(?m)^v2\\s+NULL\\s+pass$"],
"must_not_match": "FAIL"}
This covers known-answer SQL: a harness query that stands in a table of rows you chose for the real source, and prints pass or FAIL for each case. The expected answers come from arithmetic you did by hand, such as 4500 microseconds over 3 runs is 1.5 milliseconds, and a source with no runs has no average (NULL, not 0).
Two things keep a broken harness from passing. Add a must_match for every pass row the harness should print, because a harness whose join returns no rows prints no FAIL row either, and must_not_match alone passes it. And run sqlcmd with -b, so a T-SQL error ends it with a nonzero exit code that the case's exit_code sees. A must_match pattern that matches the empty string is refused.
model: asks claude -p with no tools and grades each answer.
{"id": "review-finds-nolock", "kind": "model",
"prompt": "Review this change: ...",
"runs": 5, "min_hits": 4,
"must_match": ["(?i)nolock|read ?uncommitted|dirty read"],
"must_not_match": []}
A run is a hit when every must_match pattern matches and no must_not_match pattern does. The case passes when at least min_hits of runs are hits (default: all of them). Use prompt_file for a long prompt. Put the text of your instructions inside the prompt: the runner starts claude with --safe-mode, so your own CLAUDE.md, plugins and memory do not load, and the test measures only what is in the prompt.
must_match and must_not_match take one regular expression or a list. They are case-sensitive unless the case sets "ignore_case": true or the pattern starts with (?i). Model answers have their whitespace collapsed first, so a phrase can wrap across lines.
python <path>/run_evals.py cases.json # hook and command cases
python <path>/run_evals.py cases.json --only deny-drop-table,review-finds-nolock
python <path>/run_evals.py cases.json --count # how many model calls --models would make. Calls nothing
python <path>/run_evals.py cases.json --models --model sonnet --save results/2026-11-30-sonnet.json
python <path>/run_evals.py cases.json --models --model sonnet --compare results/2026-11-30-sonnet.json
--models. Before you run them, run the same command with --count (and the same --only, if you use one) in place of --models. It prints how many claude -p calls --models would make, and calls nothing. Tell the person that number and wait for a yes. Each call costs usage, so do not run model cases on your own initiative, and do not run them after every small edit.--compare list can show EDITED beside a case. The case itself changed since the saved run (its note does not count), so a result that moved or stayed put does not say whether the tool changed. Say which cases were edited and what the edit was.by_design with the person's agreement.None of that is a reason not to have them. Read a pass as "nothing I know about broke."
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub erikdarlingdata/claude-plugins --plugin agent-evalsOther plugins' skills for the same job