Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Tests and Lint

15.4. Tests and Lint — Confirming Changes Are Correct and Clean

The Terminal tool is the center of this step

Running the test suite, linters, and type checkers all goes through the terminal tool (8.1) — with a Docker/Daytona backend, the test environment is completely isolated from the host machine, safer when running tests for a project you do not fully trust.

The fix-run-retest loop

The natural process: the agent runs the tests → sees a failure → reads the error → patches the code → runs the tests again → repeats until passing. This is where patch (instead of write_file, 8.2) shines the most — fixing exactly the broken part without overwriting code that was already correct.

Notes

  • Always have the agent run the full test suite before reporting “done”, not just the tests for the part just fixed — to avoid regressions in other code that was not checked.
  • For a project with many kinds of checks (unit tests, lint, type check, security scan), list all the commands that need to be run in AGENTS.md (7.2) — ensuring the agent does not skip any step even when not reminded each time.
  • If the linter can auto-fix, have the agent run the auto-fix command first, and fix by hand only the parts the linter cannot handle automatically — saving time and reducing the chance of fixing it wrong.