What is code review?
Code review is the practice of having someone else examine a proposed code change. It is a form of quality control and also a way to share knowledge across a team.
When AI agents write code, code review becomes even more important. Agents can produce code that compiles and passes tests but still has subtle flaws. A human reviewer adds judgment, context, and responsibility.
Key idea: tests verify behavior; review verifies judgment.
Automated checks
Before a human reads the code, automated tools can check it:
- Linters: enforce style rules and catch suspicious syntax.
- Type checkers: verify that variables are used consistently.
- Static analyzers: look for possible bugs without running the program.
- Security scanners: detect known vulnerabilities and dangerous patterns.
These tools are fast and consistent, but they cannot replace human judgment. They are best used as a first pass before review.
What reviewers look for
A good reviewer asks questions like:
- Does this change do what the description says?
- Are there edge cases that are not handled?
- Could this fail in production?
- Is the code readable and well-named?
- Does it introduce security or privacy risks?
- Are tests included and meaningful?
These questions are hard to automate. They require understanding the problem, the user, and the system.
Spot the issues
Review the snippet below. Click on the lines that have a real problem. Lines with good code should not be clicked.
Hint: look for hardcoded secrets, missing error handling, and unsafe database queries.
A fixed version
Here is the same code after review. The diff shows how each issue can be addressed: moving secrets out of the source, checking for division by zero, and using a parameterized query.
Check yourself
Why is code review still important if a CI pipeline runs tests and a linter?
Your answer:
Sample answer: Automated tools check for specific errors and style, but they cannot judge whether the code solves the right problem, handles edge cases, or is safe in context. Human reviewers bring judgment, design sense, and accountability.
Quick quiz
1. What is the main purpose of code review?
2. Which tool can catch style and syntax issues before a human review?
3. Why is human review especially important for AI-generated code?
Keep learning
Code review is the human judgment layer. Next, learn how to design safe, observable agentic systems that can plan, act, and recover from failure.
Part of the “Agentic Engineering & AI Software Topics” series.