AI-Generated Code Passed Review but Failed the Interview: Three 'Why' Questions That Exposed the Gap
AI coding tools default to happy-path implementations and common patterns like `useCallback` without context. Developers who skip the "why" step accumulate code they own but don't understand — a gap that technical interviews are specifically designed to expose.
A senior front-end developer walked into a technical interview confident about their project experience, only to freeze when asked to justify three design choices in their own codebase. A `useCallback` wrapping a handler passed to a native `<input>` had no performance benefit; an autocomplete component contained a race condition from unordered network requests; and a two-line static header was extracted into its own file for no reason. Each piece of code was generated by Claude Code, accepted because it ran, and committed without deeper scrutiny.
The post-interview audit uncovered at least 12 unnecessary `useCallback` instances and a systemic habit: describe requirements to AI, accept the output, and move on. The developer realized they had become a prompt writer and commit tool rather than the author of their own code. The core failure wasn't technical skill — it was the atrophy of the "why" reflex that AI tools quietly encourage.
A self-review checklist and a 3-day pre-interview audit framework emerged from the experience, targeting performance decisions, edge cases, component boundaries, type design, state placement, and dependency reasoning. The takeaway is not to abandon AI but to add a mandatory step: before committing AI-generated code, answer "why this way" for every significant logic block.
AI coding assistants optimize for "runs correctly" on the happy path, but technical interviews optimize for "explain your reasoning" — two metrics that are increasingly at odds.
The `useCallback` reflex in AI-generated React code mirrors a broader pattern: tools apply best-practice templates without evaluating whether the context actually calls for them.
Becoming a prompt writer instead of a code author is not a skill regression but a role shift; the danger is that the shift is invisible until someone asks a question the prompt didn't anticipate.
The interview exposed that code ownership now has two tiers: legal ownership (it's in your repo) and cognitive ownership (you can defend every decision). AI erodes the second without touching the first.