The prompt that works on the demo input
The hardest part of instruction writing is not making a prompt work; it's making it keep working when the input is empty, the user is hostile, the document is in another language, or the schema field is missing. Edge cases are not exotic — they are the long tail of real traffic.
Edge categories you must name
- Empty input — "" or null user message.
- Wrong-type input — a number where text was expected, an image where text was expected.
- Hostile input — instructions hidden inside the data the model is supposed to summarize.
- Multilingual input — Korean message in an English-only prompt.
- Out-of-scope input — refund question to a code-generation prompt.
- Missing context — required documents not retrieved.
- Truncated context — only the first 5 of 50 documents fit.
The constraint pattern
For each edge, write one sentence in the prompt that names the situation and prescribes the response. "If the input is empty, return {error: 'empty_input'}. If the input is in a language other than English, translate before answering and tag the translation. If a required document is missing, return {status: 'insufficient_context', missing: [...]}."
Yes, this makes prompts longer. It also makes them survive Monday morning.