Walk me through how you structure a production prompt for a customer workflow.
Answer it out loud first, then compare. That's what makes it stick.
I split it into labelled parts: role and goal, rules with the reason behind each, context, examples, and the input. I wrap each in XML tags so the model cannot confuse instructions with data. Long documents go at the top and the actual question at the end. I include three to five diverse examples, specify the output format, and give permission to say 'I don't know'. Then I version the prompt and run it against a golden set before changing anything.
- Role and goal, stated plainly
- Rules with reasons, positive wording
- Context and long documents first, in tags
- 3-5 diverse examples in example tags
- Output format and an allowed 'I don't know', question last
- Version it and gate changes on evals
A production prompt is an interface contract, not a clever paragraph. My layout follows Anthropic's current prompting guidance.
1. Be explicit and give reasons. Anthropic's example: instead of 'never use ellipses', say the output feeds a text-to-speech engine that cannot pronounce them. The model generalises from the reason.
2. Tag the parts. Wrap instructions, context, examples and variable input in separate XML tags (for example <instructions>, <documents>, <input>). This stops a customer's email text from being read as a command, which is also a first line of defence against injected instructions.
3. Order matters. Put long documents near the top, each in <document> tags with <source> metadata, and the question or task at the end. Anthropic reports up to 30 percent better quality on complex multi-document inputs.
4. Examples. 3-5 examples that are relevant, diverse (include an edge case and a refusal case) and wrapped in <example> tags.
5. Output contract. State format, length and fields. For machine-read output use structured outputs rather than hoping.
6. Uncertainty path. Tell the model it may answer 'not enough information' and what to do then, which cuts fabricated answers.
7. Thinking. On current models thinking is adaptive and steered by an effort setting; do not hand-write chain-of-thought for tasks that do not need it.
Notes for newer models: prefilling the assistant turn is no longer supported from Claude 4.6 onward (a 400 error). Use structured outputs, direct instructions or XML output tags instead.
Lifecycle. Store the prompt in version control with a change log, pair it with a golden set of 100-300 cases, and require no regression on guardrail checks before shipping. Keep per-request data out of the stable prefix so it stays cacheable.
Close with the customer angle: I leave them a prompt they can read and edit, with the rationale in comments, not a black box.
- How do you stop user-supplied text from overriding your instructions?
- How many examples are too many?
- What did you used to do with prefill, and what replaces it?
- Prompting best practices - Claude docs (docs, 2026-11) XML tags, 3-5 examples, context-and-reasons, documents first and query last, and prefill removal on 4.6+.
- Anthropic Forward Deployed Engineer interview guide (prep, unknown) Says interviewers want to see your prompt-engineering approach and how you structure a workflow.
- Forward deployed engineer interview questions - FDE Pulse (prep, unknown) Says AI-company FDE interviews typically include prompt engineering questions, naming OpenAI, Anthropic, Cohere and Databricks.