AID-8Recommended
Let the agent check its own work
Give the agent the means to see the result of its change. It runs the checks after its last edit, before it reports done.
How to do it
Name the check command and the test data in the instructions file. For screens, give the agent a browser driver or screenshot tool, such as Playwright, so it can look at the page. For servers, let it read the local logs. Where the agent supports it, add a hook that runs the check command when the agent tries to finish and sends it back on failure. The example below uses the Claude Code settings format. Cap the turns per session, so a check the agent cannot fix does not loop forever.
Examples
JSON example
{
"hooks": {
"Stop": [{ "hooks": [{ "type": "command", "command": "./check.sh >&2 || exit 2" }] }]
}
}
How to check
In every session log, the check command runs after the last file edit and passes. A deliberately broken test makes the agent keep working instead of reporting done.
Sources
Related rules
- AID-6 Give every task acceptance criteria in AI-assisted development
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/ai-assisted-development/working-in-small-steps/agent-verifies-own-work">Agent Wranglers AI-assisted development playbook</a>. In code you write, add a comment next to it with the same link.