Tokenizer3 XP · 1-day streak
Topics / Prompt & Context Engineering

Prompt & Context Engineering

Every AI engineer interview touches this topic because it is the highest-leverage, lowest-cost knob you control in production: most quality problems are context problems, not model problems. Expect it in product-engineering loops ("design the prompt for this feature"), agent-design rounds, and debugging exercises ("this prompt regressed - why?").

0%mastery
0/68questions tried
0due today
0/13cards read

Card 1 of 13

Roles: the prompt is an API surface

System = who the model is and the rules of engagement: persona, capabilities, output contract, safety constraints, tool usage policy. User = the task and the data for this turn. Assistant = model output, and a steering surface: prior assistant turns in few-shot dialogues teach by demonstration. Some APIs have also let you prefill the assistant turn (start it with { to force JSON), but support is shrinking - Anthropic's Claude 4.6 models reject a trailing assistant message outright - so treat prefill as a legacy trick and use native structured outputs for format control. Instructions in the system prompt are weighted more heavily by instruction-tuned models and survive multi-turn drift better than instructions buried in a user turn. Don't put per-request data in the system prompt (it kills caching) and don't put standing policy in user turns (it gets ignored after a few turns).

All 68 Prompt & Context Engineering questions

Basic

  1. What's the difference between zero-shot and few-shot prompting, and when would you use each?
  2. Explain the system, user, and assistant roles. What belongs in each?
  3. What is chain-of-thought prompting? When does it help, and when is it unnecessary or harmful?
  4. What is zero-shot CoT - and why did "Let's think step by step" become famous?
  5. What are the most common prompt anti-patterns you'd flag in a code review?
  6. What is "context engineering," and how is it different from prompt engineering?
  7. When would you ask for JSON, XML tags, or markdown as your output format?
  8. What do temperature and top_p actually do, and how do you choose them per task?
  9. How do you build a prompt template, and what can go wrong when you inject variables into it?
  10. Should you treat your system prompt as a secret? What happens when it leaks?
  11. What is the difference between input guardrails and output guardrails, and why do you need both?
  12. Your chatbot starts losing the thread after about ten turns. What are your options for managing conversation history?
  13. Your model's answers are consistently too long. How do you control output length reliably?

Intermediate

  1. How do you select and order few-shot examples? What are the known pitfalls?
  2. Why does in-context learning work at all? The model's weights don't change.
  3. Explain self-consistency. When is it worth the cost?
  4. When would you decompose a task into multiple prompts instead of one? Explain least-to-most prompting.
  5. Describe the ReAct pattern. How does it relate to modern native tool calling?
  6. How do you design good tool/function definitions for an LLM? What makes tool calling fail?
  7. How do you structure a prompt to be resistant to prompt injection from retrieved or user-supplied content?
  8. You have a 200k-token context with instructions and 50 documents. Where do you put what, and why?
  9. How does prompt caching work, and how should it change the way you structure prompts?
  10. Walk me through your process for systematically improving a prompt that's underperforming.
  11. What changes when your product must handle prompts and content in multiple languages?
  12. How do you version and govern prompts in production? Someone asks which prompt produced a bad output three weeks ago - can you answer?
  13. You want to switch model providers and your prompts break. Why, and how would you have made them portable?
  14. Design an example store for dynamic few-shot selection. What do you get, and what does it cost you?
  15. How should tool results be formatted before they go back into the model's context?
  16. When is prompt compression worth it, and how would you do it?
  17. You have retrieved chunks and a question. How do you actually build the prompt? Assume some documents are irrelevant and two of them contradict each other.
  18. Your model refuses requests that are perfectly legitimate. How do you diagnose and fix over-refusal?
  19. A user reports a bad answer. Walk me through how you debug it.
  20. How is a system prompt for a long-running agent different from one for a single-shot feature?
  21. The model does not know what day it is. How do you handle dates, recency and the knowledge cutoff in your prompts?
  22. What belongs in a repository instruction file such as AGENTS.md or CLAUDE.md for a coding agent, and what should stay out?
  23. Cache writes now cost extra on most major providers. How do you decide whether a prefix is worth caching, which TTL to pay for, and when to use explicit breakpoints instead of automatic caching?

Advanced

  1. Compare JSON mode with schema-constrained decoding. How does constrained decoding actually enforce the schema?
  2. What is context rot, and what compaction strategies do you use in long-running agents?
  3. Explain DSPy-style programmatic prompt optimization. When would you use it over manual iteration?
  4. What is meta-prompting? How would you use a model to improve your prompts - and what are the pitfalls?
  5. How do you decide when to stop prompt engineering and fine-tune instead?
  6. How would you A/B test a prompt change safely in production?
  7. How do reasoning models change prompting practice? What transfers and what becomes obsolete?
  8. Design a token budget for an agent with a 200k context window. How do you allocate it, and how do you enforce it?
  9. Design memory that persists across sessions for an assistant. How is it different from managing context within a session?
  10. Your agent reads web pages and can send email. How do you defend against indirect prompt injection?
  11. The system prompt says one thing, the user asks for another, and a retrieved document says a third. How do you design conflict resolution?
  12. Your prompt change gained 3 points on the eval. How confident are you that it is real?
  13. When should you split an agent into sub-agents, and what do you pass between them?
  14. You moved a prompt from a hosted API to a self-hosted copy of the same open-weight model, and quality dropped below the hosted version. What do you check?
  15. You are running a reasoning model in a multi-turn tool-use loop. What do you do with its reasoning between calls, and what breaks if you drop it?
  16. Reasoning effort can now be changed per message, mid-conversation, without losing the prompt cache. Design an agent policy that raises and lowers effort turn by turn, and explain the effect on cost, latency and cache hit rate.
  17. You make 50 million yes/no and routing decisions a day with an LLM. Would you use a decision endpoint that returns probabilities, structured output with a label, or logprobs you read yourself? How do you set and maintain the thresholds?

Quick-fire

  1. What is context engineering, and why can it matter more than prompt wording?
  2. Walk through the main prompting techniques and when to use each.
  3. How do you get reliable structured output (for example JSON) from an LLM?
  4. What is "lost in the middle" and how do you design around it?
  5. How do you debug a prompt that works most of the time but fails intermittently?
  6. What is few-shot prompting's cost, and when should you avoid it?
  7. How do you manage conversation history in a long chat without blowing the context budget?
  8. What is context rot, and how does it change how you build long-running agents?
  9. What is context compaction, and when do you reach for it?
  10. What is the difference between system, developer, and user roles, and why does it matter for injection safety?
  11. Why structure a prompt with delimiters or tags, and how does it help reliability?
  12. How do you treat prompts as versioned, testable artifacts rather than strings in code?
  13. What is prompt sensitivity, and how do you make a prompt robust to it?
  14. When should you decompose a task into multiple prompts instead of one big prompt?
  15. What is meta-prompting or using a model to improve your prompts?
+3 XP · card read