mcpField
W
write-code-eval

write-code-eval

github.com/ai-evals-courseTesting & quality1.6k382 installsUpdated 5w ago
Repository

About write-code-eval

A skill for implementing code evaluators for identified agent failure modes, intended for teams working in a project's language and evaluation framework. It guides rule definition, implementation, and testing against passing, failing, and borderline examples.

Key features

  1. 01Turn failure modes into checks
  2. 02Identify required trace fields or reference data
  3. 03Implement in the project's language and eval framework
  4. 04Test passing, failing, and borderline cases
  5. 05Inspect results and compare with human labels

Use cases

  1. 01Check output structure or required fields
  2. 02Match missing or forbidden text
  3. 03Validate citation sources or tool calls
  4. 04Compare output values with reference values

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ai-evals-course/evals-skills --skill write-code-eval

After installing, type/write-code-evalin Claude Code to confirm it loaded.

Bundled filesagents/openai.yaml

Details

From the project README

Write a code evaluator

Start with a failure mode found through error analysis. Write one check for that failure mode, much like a unit test that asserts what should hold for each trace.

  1. State the rule and identify the trace fields or reference data the check needs. If the rule requires interpretation, use write-judge-prompt.
  2. Implement the check in the project's language and eval framework. Return a result and a reason in the format that framework expects.
  3. Test known passes and failures, including borderline cases. Run the check on available traces and inspect mistakes. If the rule uses a proxy for human judgment, compare its results with human labels.

Examples

Failure modePossible check
Invalid output structureParse the output and check required fields
Missing or forbidden textMatch a string or pattern
Citation not in retrieved documentsCompare cited IDs with retrieved IDs
Bad tool callCheck arguments against the tool schema or run the call in a safe test environment
Wrong valueCompare the output with a reference value

Choose the check from the failure rule. For a failure with both objective and interpretive parts, check the objective part with code and use a judge for the rest.

Comments

Markdown supported