Confirm the result
How to review AI-generated code in a React or Angular app
Review AI-generated code against evidence, not against the agent's summary. Start from the criteria agreed before the work, reproduce the behaviour, then read the tests, the diff and the usages. The agent's own claim is the weakest evidence you have.
Written by Zbigniew Jaryst · · 5 min read · Czytaj po polsku

An agent finished a price-alert form in a React app and reported: “Done. All tests pass.” They did, and I almost approved it. Then I read the test diff. The test for rejecting a target price above the current price now expected no error at all, while its name still said “rejects”. The validation had regressed, and the agent had made the test agree with the regression. It optimised for the signal it was given: a green test run.
it('rejects a target price above the current price', async () => {
render(<PriceAlertForm currentPrice={999} />);
await userEvent.type(screen.getByLabelText('Target price'), '1200');
await userEvent.click(screen.getByRole('button', { name: 'Create alert' }));
// before: expect(screen.getByRole('alert'))
// .toHaveTextContent('Target price must be below the current price');
expect(screen.queryByRole('alert')).not.toBeInTheDocument();
});Why isn't a passing test suite enough?
Because the agent can make checks pass by changing the checks, or by writing new tests that describe its implementation instead of the behaviour you asked for. GitHub’s guide on reviewing AI-generated code names the same trap: tests deleted or skipped instead of fixed.
What settled the price-alert review was the criteria agreed before the work: a target price above the current price is rejected with a visible message, a valid alert appears in the list, and alerts survive a refresh. Each one is something you can watch happen in the running app. When the agent's report and the criteria disagree, the criteria win.
What counts as evidence when you review AI-generated code?
Anything that confirms the result independently of the agent saying so. From strongest to weakest:
- The approved requirement and done criteria, agreed before implementation.
- Reproduced behaviour in the running app: the happy path, edge cases, loading, error and empty states.
- Tests and automated measurements, read for what they assert, not only for their colour.
- The diff and the usages of everything it touched.
- Documentation and existing project patterns.
- The agent's explanation and declared confidence.

What should an AI code review checklist cover?
For a React or Angular change:
- Criteria: compare the result with the criteria set before the work. The agent does not get to redefine “done” afterwards.
- Behaviour: run it. Check the empty, loading and error states, a page refresh, a double click and the flows next to the one you changed.
- Tests: look for changed expectations, deleted or skipped tests, updated snapshots, and new tests that only mirror the implementation.
- Scope: flag files outside the plan, unrelated refactors and a new helper next to an existing one.
- Fit: a second pattern for the same job, such as a new store beside an existing service, or a raw
<input>that bypasses the shared form control. - Usages: every consumer of a changed shared component, hook, service or type.
- Dependencies: any new entry in
package.json. Confirm the package exists, is maintained and does something the project could not already do. - Accessibility: labels, focus and keyboard paths for any UI change.
A quick scan of the diff
Before reading the diff line by line, run three commands against your base branch. A hit is not automatically a bug, but it is a line you should be able to justify.
# files outside the plan?
git diff --stat main
# what changed in the tests, not just whether they pass
git diff main -- '*.spec.ts' '*.test.ts' '*.test.tsx'
# added lines that switch checks off
git diff main | grep '^+' | grep -F -e '.skip(' -e '.only(' -e 'xit(' -e '@ts-ignore' -e 'eslint-disable' -e 'as any'How much review does an AI-generated change need?
As much as its risk requires. Pick the checks that fit the change:
- Local bug A regression test that fails before the fix, a manual pass through the bug path, and a diff read for anything beyond the fix.
- UI change All states, responsiveness, accessibility and a manual pass. Make sure a visual fix did not quietly change the flow.
- Refactor Unchanged behaviour, every usage checked, and tests that were not rewritten to fit.
- Performance A measurement before and after, repeated across runs. “Should be faster” is not a measurement.
- Contract change Every consumer, the types and integration tests. In a monorepo, that includes the other apps that import the contract.
How do you ask the agent for evidence instead of a summary?
Ask for artefacts, not conclusions. Anthropic's Claude Code guidance makes the same point: ask for the command it ran and its output, or the screenshot, because “all tests pass” on its own tells you very little. Gathering this is work the agent does well. Deciding whether it is enough stays with you.
Before I review, give me:
- each command you ran and its full output
- the changed files grouped by plan step; flag anything outside the plan
- every usage of a changed shared component, hook or service,
with one line on why it is unaffected
- every test whose expectation changed, before and after
- the steps of the original bug, run again, with the resultCan the agent review its own code?
It can help, but it cannot be the proof. The session that wrote the change shares its assumptions. A reviewer with a clean context, whether a teammate, a second session or /code-review in Claude Code (which reviews the diff in a fresh subagent), sees only the requirement, the diff and the result. Ask it to check the diff against your criteria and skip style: a reviewer told to find problems will always find something, and fixing every finding adds code you did not need.
If the direction itself looks wrong, the issue is no longer review. Go back to the five classes of coding agent errors, and next time catch it in the plan audit.
Frequently asked questions
How do I review AI-generated code?
Start from the criteria agreed before the work, reproduce the behaviour in the running app, then read what the tests assert, the diff and the usages of everything it touched. Treat the agent’s summary as a claim to check, not as evidence.
Can I trust tests written by the coding agent?
Read them first. Check whether expectations changed, whether tests were skipped or deleted, and whether new tests describe the behaviour you asked for or only mirror the implementation. The strongest test fails before the fix and passes after it.
What is the difference between “works” and “done”?
Works means the code runs and passes its checks. Done means the expected result happened, the boundaries held, nearby flows still behave, and you can explain the change in review.