ai-workflowAnswer last reviewed July 2026

When the output has to be production code, how do you actually prompt the assistant?

A strong answer treats the prompt like an engineering spec with acceptance criteria, written down before the model generates a single line

What an AI-prepared candidate might say

I give it as much context as I can. What the code should do, the language and framework, our conventions, and I paste in relevant snippets from the codebase so the output actually fits in. I try to be specific about requirements, and I break big asks into smaller steps. If the first answer misses, I refine the prompt and run it again until it converges. I usually ask for tests along with the implementation too, and sometimes I'll have the model explain its approach first so I can course-correct before it writes any code. Treating it like a very fast junior developer works pretty well for me. Clear instructions go in, decent code comes out. The quality of what you get back tracks the quality of what you asked for, basically.

Senior
Locked

Writing the prompt as a spec, inputs, outputs, invariants, error behavior, non-goals, and why an underspecified prompt hands you the training data's median implementation.

Unlock the depth
Staff
Locked

Why spec quality moves a team more than anything else downstream, prompts and plans living as PR artifacts, and what the drift between stated spec and shipped diff tells you in review.

Unlock the depth
Follow-up chain
When the output has to be production code, how do you actually prompt the assistant? | NodeBook