skip to content

AI Assisted Coding

AI as an assistant inside the ordinary edit-test-review loop: completion, refactoring, test generation, and the review discipline around all of it. Interviewers use this to gauge how you fold the tools into an existing codebase and team process.

part ofAI-assisted developmentoverview, primer and where to startread it →
on this pageshow

questions

30

When an inline completer proposes the next line, what material has it actually seen?

level: juniorimportance: must knowfreq 70%

answer

  1. A bounded slice of text
  2. Ask what it had in view
  3. Both sides of the cursor
  4. Plus fragments you did not choose
  5. Outside the slice, outside the answer

basics

~20 s

An inline completer sees a bounded slice of text - the code on both sides of your cursor, plus fragments of other files the editor adds - and nothing else. Most bad suggestions are explained by what fell outside that slice.

solid answer

~40 s

Think of it as a request assembled for you, in the moment you paused. It carries the text before your cursor and usually the text after it, both cut to fit a size budget, plus whatever else the tool decided to add - commonly fragments of files you have open, or ones it retrieved because they resemble the code you are writing. Which fragments, and how they are picked, differs per tool and changes; that the request is bounded does not. Anything not in it was not available for that suggestion: not the ticket, not a convention written down elsewhere in the repository, not a function nobody opened. So when a suggestion is wrong, the first question is not *why did the model reason badly* but *was the deciding fact even in view*.

code

pseudocode · 15 lines
pseudocode
# everything the completer had, for this one suggestion:
#   [a] this file, from the top down to the cursor
#   [b] this file, from the cursor down
#   [c] fragments of other files the editor chose to add - you did not pick them
# nothing else in the service was in [a]-[c].

function listOrdersPage(customerId, pageToken):
    |<- cursor

# suggested:
    return orders.findPage(customerId, pageToken)

# NOT in [a]-[c], and either one would have changed the suggestion:
#   orders.findPage(customerId, cursor, limit)  - three arguments, defined one file away
#   every other handler here returns a page record, never a raw row list

go deeper

for a junior

Be able to say that a completer works from a bounded slice of text around your cursor plus whatever else the editor adds, and that nothing outside it reached the model. That one fact explains most surprising suggestions.

for a middle

Explain the layers and what each contributes: the text above the cursor supplies names and style, the text below constrains what your line has to lead to, and added fragments come from files you did not choose. Then map a wrong suggestion onto a gap.

for a senior

Show that you diagnose in that order on real work - establish what was in view before concluding anything about the model - and that you arrange the work so the material a suggestion needs is near it, rather than complaining the tool did not go and find it.

for a principal

Own the consequence for where the team writes things down: a rule recorded only in a document that nothing opens is invisible to a tool reading code, however clearly it is written. Where a convention is recorded changes which tools can honour it.

## What an inline completer is actually being asked You pause. The editor assembles a request on your behalf, a model continues the text, and the continuation appears where you were about to type. The important word is **assembled**: you did not choose what went into that request, you were not shown it, and it was built to a size budget in the time your pause allowed. Almost every other property of inline completion follows from that one sentence. This topic's own charter names GitHub Copilot and Cursor. This answer deliberately says nothing about what either does today - those details are product-specific, they change, and what follows is about the shape, which changes far more slowly. ## The layers of what it has | layer | what it is | who chose it | what its absence explains | |---|---|---|---| | **prefix** | this file, from the top down to your cursor | the tool, cutting to a budget | a suggestion that ignores something declared far above | | **suffix** | this file, from your cursor down | the tool | a suggestion that does not lead to what the rest of the function needs | | **added fragments** | pieces of other files - commonly ones open in the editor, or ones retrieved because they resemble the code at the cursor | the tool, not you | a suggestion that contradicts a signature or a convention defined elsewhere | | **nothing else** | - | - | everything that was never assembled into the request | The first two layers are the anchor. They are why a completer uses your local variable names and your indentation without being told, and why the suggestion at the top of an empty file is so much worse than the one on line two hundred. The third layer is the one people underestimate in both directions: it is why opening the right file sometimes visibly improves suggestions, and it is also why a suggestion can change from one minute to the next for no reason you can see. ## What is not in there unless something put it there - the ticket or issue you are working from; - a convention recorded in a document nobody opened; - a decision taken in a conversation last week; - the body of a function in a file that was never in view; - what the tests assert about the thing you are writing; - how the program actually behaves when it runs. None of that is a limitation of the model. It is a description of the request. ## Reading a bad suggestion backwards 1. **Was the deciding fact in the request at all?** If the signature it got wrong lives one file away and nothing opened that file, stop - there is nothing to explain about reasoning. 2. **If it was in this file, where?** Material far above the cursor is the first thing a budget cuts. Material below the cursor is available, but a continuation is being written forward from where you stand. 3. **Only then ask whether it reasoned badly** about material it demonstrably had. Knowing a fact was in view does not prove it was used, so step 3 is a real step and not a formality. The value of the order is that the cheap check comes first, and on this subject the cheap check is usually where the answer is. Not every disappointing suggestion is a context gap - a model can produce something poor from a perfectly adequate request. But the context gaps are the class you can do something about, which is why they are worth ruling in or out first. ## Two ecosystems, two amounts inferable How much a completer can get right about a call site it was never shown depends partly on the ecosystem you are in. In a **statically-typed** one, the editor can often supply an exact signature for a symbol whose body was never in view, and a call that does not match is rejected before the code runs - so there is both more to go on and less room for a mismatch to stay quiet. In a **dynamically-typed** one there is frequently less that can be handed over about a symbol, and less that rejects a mismatch until the line executes. Same completer, same discipline; a different amount of the answer is knowable without the definition in front of it. ## Answering this in an interview Describe the shape rather than the product: a bounded request, assembled for you, made of the text around your cursor plus fragments the tool chose. Then give one concrete case - a suggestion that was wrong because the thing deciding it was one file away - and say what you checked first. The sentence carrying this whole subject is *what it could see determines what it could get right*, and it lands far harder with an example attached to it.

  • Two developers at the same cursor in the same file get different suggestions. What could differ?
    What each request carried. Different files open, different recent edits, a longer file cut at a different point, and the tool's own variation between runs. The visible file is not necessarily the whole of what was sent, so an identical cursor does not mean an identical request.
  • A suggestion improved after you opened the file it needed. What does that tell you, and what does it not?
    It tells you the deciding material was outside the request and is now inside it - a context gap rather than a reasoning failure. It does not tell you the new suggestion is right, and it does not promise the same file will be picked up next time. You still read it against the code.

saying these in an interview costs you the question

  • Assumes the completer has the whole repository in view
  • Explains every wrong suggestion as the model being bad at code
  • Believes the completer knows which ticket you are working from
  • Treats a suggested call as evidence that the call is right here
  • Never asks what was outside the window before blaming the tool
open as a page

Why should a one-function code request name the language version and framework you are on?

level: juniorimportance: must knowfreq 60%

basics

~20 s

An unstated environment gets filled in from what is most common, not from what your build accepts. You then get an answer that is correct somewhere else: a newer idiom, a different framework line, a dependency you do not carry.

open as a page

A generated unit test asserts exactly what the function already returns. What is it unable to catch?

level: juniorimportance: must knowfreq 60%

basics

~20 s

It cannot catch the function being wrong. An expectation taken from the implementation agrees with that implementation by construction, so the test reports that behaviour has changed rather than whether the behaviour was ever right.

open as a page

What do you attach to a one-function code request so the result fits your codebase?

level: middleimportance: must knowfreq 56%

basics

~20 s

Attach what the codebase has already fixed and the answer should not re-choose: the signature the caller expects, the record type it must return, the helper that already exists. Otherwise you get a correct function that needs an adapter.

open as a page

A tool extracts a shared validation routine out of a long handler - what behaviour can silently change?

level: middleimportance: must knowfreq 58%

basics

~20 s

An extraction can preserve every happy path and still move the edges: which order side effects run in, whether an early exit still leaves the caller, which failure escapes, and what a missing value defaults to.

open as a page

Who is accountable for an AI-assisted change once it merges, and what follows for the author?

level: middleimportance: must knowfreq 52%

basics

~20 s

The people, not the tool: the author owns the change they submitted and the reviewer owns the approval, exactly as before. What follows is a bar at submission - do not send code you cannot explain.

open as a page

Which defects in a generated change does the build already catch, and which need a human reviewer?

level: middleimportance: must knowfreq 48%

basics

~20 s

The build decides whatever has a deterministic oracle: resolution, types, style, declared dependencies, the existing suite. A person is needed wherever correctness depends on a rule the generator could not see, and that is where review attention belongs.

open as a page

How do you check a generated test's expected values when the rule they encode is written down nowhere?

level: middleimportance: must knowfreq 55%

basics

~20 s

Split it in two. Settle what you can alone - unit, scale, sign, which side of the boundary the value falls on - then take what is left to whoever owns the rule, as one concrete case with a yes-or-no answer.

open as a page

Six months in, a manager asks whether AI coding assistants made the team faster — what can you conclude?

level: seniorimportance: must knowfreq 58%

basics

~10 s

Throughput alone settles nothing: over six months the people, the codebase and the work all changed alongside the tool. Report where effort moved and which narrow claims you are willing to defend.

open as a page

You accept an inline suggestion with one keystroke - what can you actually check in that moment?

level: middleimportance: should knowfreq 50%

basics

~20 s

Enough to triage, not to review: whether it does what you were about to write, and whether its names exist here. Anything you cannot settle in that moment should be rejected rather than accepted to check later.

open as a page

Why does a multi-line completion get less trustworthy toward its last line than its first?

level: middleimportance: should knowfreq 55%

basics

~20 s

The first line continues code you wrote and can inspect; every line after it mostly continues text the tool just produced and nobody has checked. One early wrong assumption is then carried, consistently, by everything below it.

open as a page

On a team where only some developers use AI assistants heavily, what changes for everyone else?

level: middleimportance: should knowfreq 46%

basics

~20 s

Reading load rises for people whose own output did not. An assistant multiplies how fast drafts are produced and barely touches how fast anyone reads them, so the constraint moves to review and lands on whoever is absorbing.

open as a page

Which developer skills actually decay when a coding assistant is always available, and which do not?

level: middleimportance: should knowfreq 54%

basics

~10 s

Fluency at producing routine code decays first and returns quickly. Judgement decays only if you stop exercising it, which accepting makes easy. The costlier loss is a model of the system you never built.

open as a page

A code request came back close but wrong — do you amend it in the same thread, or start clean?

level: middleimportance: should knowfreq 42%

basics

~20 s

Amend when the shape was right and one decision was wrong, because everything already established still stands. Restate cleanly when the approach itself was wrong, because corrections there land as patches on a structure you did not want.

open as a page

On one bounded code request, how do you constrain which names the generated code may call?

level: middleimportance: should knowfreq 48%

basics

~20 s

Pin the surface: list the names the code may call with their shapes, close the list against anything new, and ask it to say so rather than substitute when something is missing. Pinning narrows the answer; it does not enforce it.

open as a page

You asked for unit tests on a leave-accrual calculator and got only ordinary dates. What should the request have named?

level: middleimportance: should knowfreq 48%

basics

~20 s

Name the situations, not the quantity. A model drafting from the code produces cases the code already implies. The awkward ones live in the rule, so list them yourself: the period that ends before it starts, the joiner on the boundary.

open as a page

In a service you joined last week, where should you check an inline completer's suggestions hardest?

level: seniorimportance: should knowfreq 42%

basics

~20 s

Wherever this service departs from the widespread way of doing something. A continuation follows shapes that recur, so on your unusual code the recurring shape is the wrong one - and it reads as entirely reasonable to anyone new here.

open as a page

How do you request a structural edit on a file the assistant cannot read in one piece?

level: seniorimportance: should knowfreq 44%

basics

~20 s

Give the tool a complete view of something small, not a partial view of something large: the block being moved, the uses you found yourself, the tests that pin it. What it cannot see, it fills in.

open as a page

How do you review a rename an assistant applied across forty files without reading all forty?

level: seniorimportance: should knowfreq 50%

basics

~20 s

Review by shape, not by file: decide what every hunk should look like, read the ones that break the pattern, and search separately for the names a rename cannot reach - in configuration, stored data or message text.

open as a page

What belongs on a review checklist for AI-assisted changes that the ordinary checklist does not?

level: seniorimportance: should knowfreq 44%

basics

~20 s

Only what the build and the ordinary checklist cannot already cover. In practice a handful of lines: invariants the generator could not see, the caller's authority, provenance for a distinctive block, and whether the author can explain every line.

open as a page

How should a review handle the licence and provenance of generated code while the law is unsettled?

level: seniorimportance: should knowfreq 38%

basics

~20 s

Surface the question, do not rule on it. Reviewers flag blocks distinctive enough to need a provenance answer and route them to whoever owns that risk; the team decides once, and sets a higher bar for code it redistributes.

open as a page

Which security weaknesses deserve a named line on a review checklist for generated code?

level: seniorimportance: should knowfreq 40%

basics

~10 s

The ones whose correctness depends on something outside the file the generator was working in: the caller's authority, the trust boundary the input crossed, how credentials are obtained, and what the failure path discloses.

open as a page

Your coverage number rose after a batch of generated unit tests. Why might the team be no safer?

level: seniorimportance: should knowfreq 46%

basics

~20 s

The number counts code that ran. Generation made running code cheap and left the hard half - deciding what the right answer is - exactly as expensive, so a figure that stood in for effort no longer does.

open as a page

What must a team's policy on what may be sent to an AI coding tool actually decide?

level: principalimportance: should knowfreq 38%

basics

~20 s

Which repositories a tool may be attached to, what it may see once attached, what never goes anywhere, the default for the unlisted case and who answers it quickly. A rule phrased as per-paste judgement decides nothing.

open as a page

Which structural edits do you let a model propose, and which do you insist a deterministic tool perform?

level: principalimportance: should knowfreq 36%

basics

~20 s

Sort the edit by what can check it, not by how good the suggestion looks. Name resolution covers mechanical edits inside the scope it indexes, a build check catches shape, and order, defaults and failure need a test.

open as a page

An inline completer must answer in the pause between keystrokes - what does that deadline cost?

level: middleimportance: nice to knowfreq 35%

basics

~20 s

Your typing sets the deadline, not the tool: a suggestion that arrives after you wrote the line is worthless however good it is. Everything done to meet that deadline narrows what the suggestion could account for.

open as a page

Copyright in model-generated code is unsettled — what can a team still decide for itself?

level: seniorimportance: nice to knowfreq 32%

basics

~20 s

Everything about its own exposure: what it accepts into which products, what its existing contracts and licence obligations already require, and who it asks. The law is not the team's to settle, and stating it as settled is the error.

open as a page

On a code request where the approach is the risk, why ask for that before any code?

level: seniorimportance: nice to knowfreq 34%

basics

~20 s

Asking for the approach first moves your review to the cheapest artefact: four lines read and rejected in seconds, against a working function that is expensive to read and hard to reject once it runs. Use it where the decisions carry the risk.

open as a page

Should a change record that an AI tool helped write it, and what should that record change?

level: principalimportance: nice to knowfreq 22%

basics

~20 s

Record it as a fact, for provenance later, and do not turn it into a scrutiny tier. Review attention belongs on what a change touches and can break, which is verifiable, rather than on a self-reported label.

open as a page

What do you weigh before a batch of generated unit tests joins the build the whole team waits on?

level: principalimportance: nice to knowfreq 30%

basics

~20 s

Weigh what each test would report that nothing else would against what everybody pays for it on every run: minutes of build time, failures that are not about the product, and an obligation to maintain something nobody can explain.

open as a page