0%
AI-Assisted Coding Interviews: Prompting, Reviewing AI Output, Testing, and Handling the Twist
How AI-Assisted Rounds Work
Reviewing AI Output
Thinking Out Loud
Time Management
Scoped Asks and the Right Context
Every request you send to the assistant has a size, and that size decides how much code comes back. In an AI-assisted round, the code that comes back is not the end of the work; it is the start of a review. So the size of your ask directly decides how much reviewing you will have to do, and how likely it is that something wrong slips through.
This lesson is about scoping asks: making each request to the assistant as small and precise as the job needs, and giving the assistant the context it needs to get it right. The next lesson covers planning before asking, and when it is faster to type the code yourself.
The size of the ask sets the size of the diff
Compare two requests for the same bug. The first: fix the booking bug. The second: in overlaps in booking service, touching intervals should not count as overlapping; change the comparison so that an end equal to a start is allowed, without changing the function's signature.
The first request leaves almost everything to the assistant. It must decide which bug you mean, where it is and how to fix it. It may also tidy nearby code, rename variables, add a helper or change other functions it thinks are related. The diff you get back could touch several files, and you must now review all of it.
The second request names the function, the behaviour and the constraint. The assistant will almost certainly change one comparison. You can review the diff in seconds, because you already know exactly what should change.
Both requests might fix the bug. Only one leaves you with a diff you can review with confidence in the time available.
Review cost grows faster than diff size
Reviewing a diff is not linear in its length. A one line change can be checked by reading the line. A ten line change in one function needs you to understand how the lines interact. A change across three files needs you to understand how the files interact, whether any caller is affected and whether any test depends on the old behaviour. Each additional file or function touched adds not just its own lines but its interactions with everything else.
That is why experienced candidates keep asks small. It is not that the assistant cannot handle large tasks; it is that the human cannot review large diffs reliably under time pressure, and an unreviewed diff is a risk in a round that grades verification.
Scope is also a signal
How you scope requests is visible to the interviewer, and it is evidence for decomposition. A candidate who asks the assistant to fix the bug and add the feature in one go shows little decomposition. A candidate who asks for one well defined change at a time, checks it and moves on shows exactly the skill most rubrics describe: breaking the problem into steps that can each be done and verified.
Small does not mean slow
A common worry is that small asks mean more prompts and therefore more time. In practice the opposite is usually true. A small ask returns a small diff, which you review in seconds and accept with confidence. A large ask returns a large diff, which you review for minutes and often have to partly undo or re prompt. Over a whole round, a sequence of small asks is usually faster, and it is far less likely to end with a mess you cannot untangle.
What scoped looks like in practice
A scoped ask usually fits in two to four sentences. It names a function or a small area, says what should change in terms of behaviour and says what must not change. Often it includes an example or a test. Here are some scoped asks.
In parse duration, add support for an hours suffix h, so 2h returns 7200; keep the existing suffixes working and do not change the return type.
Write a pytest test for free slots where two bookings touch at twenty, with a day from zero to sixty and minimum length ten; expected result is zero to ten and thirty to sixty. Do not change free slots.
In the leaderboard class, the top method currently sorts all scores on every call. Change it to use a heap of size k, keeping the same signature and the same tie order of lower id first.
Each of these is specific about where, what and what not. Each produces a diff that can be checked quickly.
What wide looks like
Wide asks are easy to recognize. They name a goal without a location: make the tests pass. They name a quality without a definition: make this cleaner, make this faster. They bundle several tasks: fix the bug and add pagination. They hand over decisions you should make: figure out what is wrong and fix it.
Wide asks are not always wrong. Early in orientation, a wide question such as summarize this module is a reasonable way to start, as long as you check the answer. But for code changes, especially in a round that grades verification, wide asks should be rare.
A sample exchange
Interview Dialogue
The candidate's answer to the interviewer's question is exactly the reasoning this lesson teaches, and saying it out loud makes the decision visible.
Scope and the twist
Scoping becomes even more important when the twist arrives, because the twist usually changes a requirement in a way that touches code you have already modified. A wide ask at that point, such as update the code for the new requirement, invites the assistant to rewrite large parts of your earlier work, including parts that were correct and verified. Scoped asks, one change at a time, protect what you have already built. Module 6 covers this in detail.
A rule of thumb
If you cannot predict roughly what the diff will look like before you send the prompt, the ask is probably too wide. You do not need to predict every line, but you should be able to say which function will change and roughly how. If you cannot, either narrow the ask or spend another minute understanding the code first. Being able to predict the diff is also what makes the review fast: you compare what came back with what you expected, and any difference is something to look at closely.
A drill for scoping
Take any small codebase with a few tests, and for each of five changes you might make, write two prompts: the widest reasonable one and the most scoped one. Send both to an assistant in separate sessions and compare the diffs. Count the files and functions each touched, and time how long each takes you to review with confidence. Most people find the scoped version takes a fraction of the review time and is correct more often. Doing this once or twice makes the cost of wide asks concrete, and the habit of scoping follows naturally.
Scope first, then speed: the scoped ask is almost always the faster route to code you can stand behind in front of an interviewer.
Before sending a prompt, say to yourself which function should change and roughly how. If you cannot, the ask is too wide. If you can, review becomes a quick comparison of the diff against your prediction.