Contents
A code review for agent-generated code has different priorities from a classic review: syntax and style are usually clean, while the risks lie in misread requirements, silent assumptions, shallow tests and unnecessary dependencies. The checklist below helps reviewers find exactly these weaknesses systematically and in reasonable time.
Why agent-generated code needs a different review
When a human writes code, mistakes often reflect uncertainty: odd formatting, hesitant naming, a comment saying "TODO". Code from coding agents, by contrast, almost always looks confident and tidy – even when it is wrong. That invites superficial reviews.
Typical patterns in agent-generated changes include:
- Plausible but off target: the code solves a similar problem, but not the one requested.
- Overeager changes: the agent "improves" files that were not part of the task.
- Self-confirming tests: tests check the implementation rather than the desired behaviour, or were adjusted until they passed.
- New dependencies: an extra library is pulled in for a small problem.
- Duplicated logic: existing helpers are overlooked and rewritten.
Our article on AI in code reviews describes how AI itself can support reviewing. Final responsibility, however, stays with a human.
Before the review: set up the preconditions
A good review starts before the reviewer reads the first line. Make sure that:
- the pull request references a concrete task or specification,
- the pipeline with build, tests, linter and security scans has passed,
- the change is small enough – as a rule of thumb, small enough for a reviewer to fully understand in one focused session,
- the person who instructed the agent has already read the change themselves.
The last point is crucial: whoever submits an agent PR is its author. Passing unchecked agent output to colleagues only shifts the work. More on this in agentic coding and code ownership.
The checklist for agent-generated code
The checklist is divided into four blocks. Not every item is relevant to every change, but each block should be worked through deliberately.
1. Requirements and scope
- Does the change solve exactly the described task – no more, no less?
- Are all acceptance criteria met, including edge cases from the specification?
- Are there changes to files unrelated to the task? If so: justify or revert them.
- Did the agent make assumptions where the requirement was unclear? Are they documented and functionally correct?
- Was behaviour removed or altered that other parts of the system rely on?
2. Architecture and maintainability
- Does the code follow the application's existing patterns and layers?
- Are existing helpers, components and services reused rather than duplicated?
- Are names domain-correct and consistent with the rest of the code?
- Is the solution appropriately simple, or was unnecessary abstraction introduced?
- Is there commented-out code, debug output or placeholders that need removing?
- Are error cases handled, and in the way the project usually handles them?
3. Tests
- Do the tests check the desired behaviour rather than just the specific implementation?
- Would the tests fail if the core logic were wrong? (Thought experiment: flip one line – would a test notice?)
- Were existing tests changed or deleted? If so, exactly why?
- Are edge cases covered: empty input, boundary values, error responses from external services?
- Are mocks used sensibly, or is so much mocked that the test no longer proves anything?
4. Security, data and dependencies
| Check | What to look for |
|---|---|
| Input validation | Is user input validated and are queries parameterised? |
| Authorisation | Does every new endpoint check whether the user may perform the action? |
| Secrets | No keys, tokens or passwords in code or config files |
| Logging | No personal data or tokens in logs |
| New dependencies | Necessary? Does the package really exist, is it maintained and trustworthy? |
| Licences | Is the licence of new packages compatible with your project? |
| Error messages | Do error messages avoid leaking internal details? |
For more depth, see our articles on security risks of AI-generated code and open-source licences and AI code.
Reviewing efficiently: keeping the effort manageable
When agents produce more code, review must not become the bottleneck. These practices help:
- Description first, then code: have the author (or the agent) explain what changed and why. If the diff deviates from that, it is a warning sign.
- Read the tests first: they show fastest what the code is supposed to do.
- Review by risk: security-relevant and business-critical parts thoroughly, generated boilerplate by spot check.
- Automate what you can: formatting, style, known security patterns and licence checks belong in the pipeline, not in human review.
- Feed insights back: recurring review comments belong in the agent's context files so the same mistake does not happen again.
Conclusion
Agent-generated code often looks cleaner than it is. A good review therefore focuses less on style and more on requirement fidelity, architecture, meaningful tests, security and dependencies. With clear preconditions, a fixed checklist and consistent automation, reviews stay fast and become the most important quality gate in the agentic coding process. If you want to train this review routine with your team, one of our workshops from 799 € net with AI developers from real-world practice is a good fit.
Frequently Asked Questions
Can an AI review agent-generated code?
AI reviews are a sensible first pass and catch many typical issues. The functional and architectural review and final approval should still remain with a human.
How large may an agent's pull request be?
There is no fixed limit, but it should be small enough for a reviewer to fully understand in one focused session. Split larger tasks into several pull requests.
Who is responsible for bugs in agent-generated code?
The person who instructed the agent and submitted the change, and secondarily the reviewer. An agent cannot take responsibility.
What should I watch for with new dependencies?
Check whether the package is really needed, actually exists, is actively maintained and has a compatible licence. Agents occasionally suggest packages that do not exist or are not trustworthy.