When it works and when it fails
The conditions that make agent-written code succeed, and the failure modes that make it expensive.
Conditions for success
Delegation works when the cost of noticing a mistake is low. That is an engineering property of the project, not a property of the model.
- A tight feedback loop: tests, a type checker, or a dev server you can look at in seconds.
- A small, well-factored surface where a change has one obvious place to live.
- Checkable acceptance criteria - 'the list sorts by date' beats 'make it nicer'.
- Conventions the model can imitate by reading neighbouring files.
- A cheap way to throw the attempt away and start again.
# wire the loop before you write the prompt
npm run typecheck -- --watch &
npm test -- --watch &
npm run dev
# then ask for changes you can verify immediately
# "render the empty state when items.length is 0"Predictable failure modes
| Failure | Signal | Response |
|---|---|---|
| Confident nonsense | Code calls functions that do not exist | Compile or test after every step, not at the end |
| Silent scope creep | The diff touches unrelated files | Review file by file and revert the extras |
| Regression by rewrite | A working module is replaced wholesale | Ask for the smallest diff and pin behaviour with tests first |
| Cargo-cult patterns | Idioms from another framework appear | Point at an existing file as the pattern to copy |
| Lost context | It repeats a bug it already fixed, or drops a constraint | Restate the constraints and move them into a rules file |
⚠️
The expensive failure is not wrong code, it is wrong code that looks right. A green build on a test that asserted nothing is worse than a red one, because it buys false confidence.
FAQ
Why does it break down on large tasks?
The model has to hold the whole change in context. Once the request exceeds that window, detail drops silently. Split the work until each step fits comfortably.
What predicts success best?
Verification strength. Teams with fast tests and a strict type checker can delegate far more, because mistakes surface in seconds instead of in production.
Related
The vibe coding practice Keeping quality with tests and review
Last refreshed 2026-09-18.