Auto-fix lint and test failures after each agent edit
Configure the agent to run your linter and tests after every change and fix what it broke before handing the work back.
The use case
Agents that edit code without running anything hand back work that does not compile. Aider can be set to run a lint command and a test command after each change; when they fail, it reads the output and tries to fix the problem before returning. The same habit works with other terminal agents through hooks or instructions. This keeps diffs closer to mergeable and saves the developer a round trip. The developer still reviews the final diff, watches for fixes that silence a linter rule or skip a test, and decides when to commit.
Example workflow
- Set lint and test commands in the agent config
- Ask the agent for a change
- Agent runs lint and tests and fixes failures
- Review the final diff and test output
- Commit when satisfied
Tools
- Aider
- pytest
- ESLint
Risks and guardrails
- Agent may add ignore comments or skip tests to get green; check the diff
- Slow test suites make loops expensive; use a fast subset
- Keep commits small so bad fixes are easy to revert
Sources
Written by Agents Lookup. Credits and official pages for the tools this use case names:
- Aider docs: linting and testing: aider.chat/docs/usage/lint-test.html
- Aider (official page): aider.chat (checked 2026-11-19)