productinterview.tools
MenuClose

Prompting and Context Engineering: Getting Reliable Behaviour From LLMs

Getting reliable behaviour from a model through its context.

Foundations3 lessons5 questions

What this module covers

  • The building blocks of a prompt that works reliably
  • Context engineering: choosing what the model sees, not just how you ask
  • Treating prompts like code: versioned, tested and changed one step at a time

Builds on

Prompting and context engineering

Why it matters, by role

  • Applied AI PMProduct Manager. Decides what a product should do, for whom, and why. Read the full explanation: prompts are often the fastest lever on product quality.
  • Forward Deployed EngineerForward Deployed Engineer. An engineer embedded with customers who scopes, builds and ships AI solutions into production. Read the full explanation: customer pilots live or die on prompt and context design.
  • AI Product Engineer: you'll own prompts in production.
  • Product Builder: prompting well is how you build quickly.

Lessons

  1. The parts of a good prompt
  2. Context engineering
  3. Improving prompts with evals

The parts of a good prompt

A reliable prompt usually has:

  1. Role and goal: who the model is acting as, and what it's trying to achieve.
  2. Instructions: clear and specific, including what not to do and what to do when unsure.
  3. Context: the facts it needs: documents, user data, tool results.
  4. Examples: a few input–output pairs, including tricky cases. Examples often beat long explanations.
  5. Output format: exactly what to return, especially if code will parse it.

Common fixes for poor output: say what good looks like instead of hinting; give the model a way out ("if the document doesn't say, answer 'not stated'"); and split one overloaded prompt into steps.

Context engineering

Context engineering is deciding what goes into the context window for each request. Often this matters more than the wording of the instructions, because the model can only use what it sees.

The decisions:

  • Selection: which documents, history and data to include. Too little and it guesses; too much and it gets distracted and costs more.
  • Ordering: put instructions and key facts where they won't be lost; very long contexts can bury details in the middle.
  • Compression: summarise old conversation turns and long tool outputs.
  • Freshness and permissions: include only data the user is allowed to see, and that's current.

When a model "doesn't follow instructions", check first whether the context gave it what it needed.

Improving prompts with evals

Prompt changes are code changes: they can fix one case and break three others. Treat them that way:

  1. Version prompts and record which version produced each output.
  2. Keep an eval set of real cases, including past failures.
  3. Change one thing at a time and run the eval set before and after.
  4. Read the flips, not just the score: which cases got better, which got worse.
  5. Ship through the same gates as other changes.

"I tweaked the prompt until the demo looked good" is a red flag in interviews; "I changed it against an eval set" is the answer they want.

Questions

Foundations

QuestionTypeRolesAsked atSource
Walk me through how you'd write the system prompt for a support assistant at an online bank.buildForward Deployed Engineer, AI Product Engineer, Applied AI PM–Representative

Advanced

QuestionTypeRolesAsked atSource
Your coding assistant has a large context window. Design what goes into the context when a developer asks it to fix a bug.designAI Product Engineer, AI Platform PM, Forward Deployed Engineer–Representative

Rubric

Dimension Weak Passable Strong
Prompt design One vague instruction Instructions and format Role, instructions, context, examples and format, with an "unsure" path
Context Ignores it Adds documents Selection, ordering, compression and permissions
Iteration Tweaks by feel Tests on a few cases Versioned prompts, eval set, one change at a time, reads flips
Diagnosis Blames the model Rewrites the prompt Checks the context first, then the instructions

Next modules