March 22, 2026 · Piyush Ranjan Mishra
Prompt Engineering for Production: Beyond the ChatGPT Playground
There’s a specific failure mode I’ve seen repeatedly when teams ship their first LLM-powered feature: the prompt was iterated on entirely in a playground — ChatGPT’s UI, or Anthropic’s console — with a handful of manually-picked test inputs, and it works beautifully there. Then it ships, hits real user input at scale, and starts failing in ways that never showed up in testing. The gap between “works in the playground” and “works in production” is almost entirely about what the playground doesn’t force you to confront.
The playground hides variance
A single conversation in a chat UI shows you one sample from the model’s output distribution. Production traffic shows you thousands of samples, and LLM outputs have real variance — the same prompt, the same input, run twice, can produce meaningfully different structure, tone, or correctness. If your prompt “usually” produces valid JSON, that’s not a production guarantee, it’s a probability you haven’t measured. The fix isn’t a better prompt in isolation — it’s building an eval harness that runs your prompt against a representative sample of real (or realistic synthetic) inputs and measures failure rate, not just “does the demo look good.”
System identity prompts need boundaries, not just persona
When I built an AI assistant persona for a portfolio chat feature, the naive version was “you are X, answer questions about X’s career.” That’s enough for a happy-path demo and not enough for production, where users will ask off-topic questions, try to extract the system prompt, or push the model toward saying something the persona shouldn’t. A production system prompt needs explicit behavioral boundaries:
BEHAVIORAL GUIDELINES:
- Answer technical questions with code snippets if relevant.
- If asked about non-professional "drama" or personal life interruptions,
steer back to tech/career gracefully.
- Mention specific tools to demonstrate depth.
The specificity matters. “Be professional” is not an instruction the model can reliably act on — “if asked X, do Y” is. Every boundary you actually care about needs to be an explicit conditional, not an adjective.
Structured output is a contract, not a suggestion
Asking a model to “return JSON” and then JSON.parse()-ing the result without validation is a production incident waiting to happen — models occasionally wrap JSON in markdown fences, add a conversational preamble, or produce almost-valid JSON with a trailing comma. The fix is layered: use the provider’s native structured-output or function-calling mode when available (which constrains generation at the token level, not just via instruction), validate the result against a schema regardless, and have an explicit fallback path for validation failures rather than letting a malformed response propagate into your application logic.
Failover isn’t just an infra pattern — prompts need to survive provider swaps
If your production system has a failover chain (OpenAI → Gemini → Claude, in my case, for a chat feature that needed to stay up even during a provider outage), the same system prompt needs to produce acceptably similar behavior across all three. This is where prompt engineering intersects with infra reliability: a prompt tuned exclusively against one provider’s quirks will often produce noticeably different output quality on a different provider, at exactly the moment (a failover event) when you most need consistent behavior. Test your prompts against every provider in your failover chain, not just your primary.
Version and log everything
Prompts are code, and they should be treated with the same rigor — version-controlled, changed deliberately, and logged in production alongside the output they produced. Without that, the single most common “why did the AI feature start behaving differently” debugging session — a prompt was tweaked and nobody tracked what changed or when — becomes nearly unsolvable in hindsight.
The actual skill
Prompt engineering as “finding the magic words” is the wrong mental model. Prompt engineering in production is closer to API design: define the contract (what inputs, what output shape, what behavioral boundaries), make failures observable, and validate that the contract holds across the range of real inputs and the range of providers you depend on — not just the three examples that looked good in a playground session.