Working with AI-generated code can feel like magic—until it isn’t. The speed at which tools like Claude Code or Codex produce working code is impressive, but trusting the narrative without inspecting the concrete changes is a shortcut to technical debt. Git diffs and tests aren’t just overhead; they’re your control panel for understanding what actually happened, what was verified, and where things might break tomorrow.
Here are four practical insights to keep AI-generated code under control:
Trust the diff, not the story
A PR description that says “everything is done” is not proof. The real evidence lives in the diff: which files changed, what dependencies were added, and how the behavior was validated. Without reviewing the actual changes, you risk trusting a compelling narrative instead of verifying the work. Start every review withgit statusandgit diffto ground your understanding in facts, not assumptions.Plan before you code
Before letting an AI modify files, ask for a concrete plan: which files will change, what tests will be added, and how you’ll validate the result. This turns the final diff into a verifiable artifact rather than an opaque block of code. For example, when adding a CPU chart, insist on a focused plan—display logic, error handling, and tests—before any file is touched.Small commits are reasoning units
A large diff that includes multiple features, abstractions, and fixes may work, but it’s nearly impossible to review. Breaking work into small, intentional commits—like adding one chart, handling one error case, then testing—lets you verify each step and roll back safely if something breaks. Each commit should tell a clear story, not recount your entire day.Tests should protect needs, not just code
A passing test only confirms that the code behaves as written, not that it protects a useful behavior. Before writing tests, describe the expected behavior in plain language: valid values, edge cases, missing data, and error states. Then let the AI help refine the test suite—but don’t let it define the strategy. Intentionally break the behavior you think is protected to see if the test actually catches it.
You don’t need to slow down to stay in control. You need to know where to look, what to verify, and when to say no. That’s how AI becomes a force multiplier—not a black box.
https://nicolas-dabene.fr/en/blog/controlling-generated-code-with-git-diffs-and-tests/
Top comments (0)