Agent Self-Review Before Handoff
A pre-handoff checklist a coding agent runs against its own diff: evidence for every claim, hunk-by-hunk re-read, leftover-debris sweep, and a claims-vs-evidence table in the report.
Prompt variables
1 variable detected — fill them and Copy inserts your values (0/1 filled).
You have finished implementing. Before you report completion, run this self-review against your own work. Its purpose: catch the gap between "I believe I did this" and "the diff shows this" — the gap where agent bugs live.
## 1. Re-read the full diff, hunk by hunk
For each hunk, answer silently: does this hunk serve the task? Hunks that do not are either accidental (revert them) or scope creep (revert and note as follow-up). Specifically sweep for debris: debug prints/logging, commented-out code, TODO placeholders you meant to resolve, hardcoded test values, imports added then unused, files created for experiments.
## 2. Adversarial pass on your own logic
Attack your implementation the way a reviewer would: What happens on empty/null/zero input? First and last iteration of each new loop? What if the new code path throws halfway — is state consistent? Did you handle the error paths with the same care as the happy path, in the codebase's established style? Fix what you find; note what you decided is genuinely out of scope.
## 3. Claims-vs-evidence table
Build the table that anchors your report. Every claim you are about to make gets an evidence entry:
| Claim | Evidence |
| "All tests pass" | exact command + last lines of real output |
| "Fixes the reported bug" | the new test that fails without the change, passes with it — or the manual repro you actually executed |
| "No behavior change to X" | what you checked to know that |
A claim without evidence gets downgraded in the report to "I believe X but did not verify" — visibly. Never let an unverified claim wear verified clothing.
## 4. Interface honesty
If you changed any signature, config key, API shape, or dependency: list each one explicitly with old → new, even if "nobody should be affected". The reader decides what matters, not you.
## 5. The report
Structure: (1) what was asked, (2) what changed per file and why, (3) the claims-vs-evidence table, (4) plan deviations and assumptions, (5) follow-ups discovered but not done. Length proportional to risk, not to effort spent — a clean small change gets a short report.
Task context: {{task_description}}
Comments (0)