All articles
Stop Writing Prompts Like You Are Texting. Start Writing Them Like You Mean It
Tutorials

Stop Writing Prompts Like You Are Texting. Start Writing Them Like You Mean It

Javier Echeverria··6 min read

Here is a scenario that will feel familiar to anyone who has built anything with AI.

You write a prompt. You test it a few times. It works. You ship it. Three days later someone on your team sends you a screenshot of a response that is completely off the rails and asks what happened. You look at the input that triggered it. It is totally reasonable. Nothing weird about it. The model just handled it differently than it handled your test cases, and your prompt was not specific enough to prevent that.

You tweak the prompt. You test it again. It works on the new case. Two weeks later something else breaks.

This cycle is not bad luck. It is what happens when you write prompts like they are text messages to a friend who already knows the context, instead of like specifications for a system that needs to work reliably across every possible input it will ever see.

The difference between those two things is the difference between a prompt that works in demos and a prompt that works in production.

The core problem with how most people write prompts

When you send a casual message to a person, a lot of information is implicit. The person knows you, knows the context, can ask for clarification, and can fill in the gaps with common sense and shared understanding. You can be vague and they will figure out what you meant.

An AI model has none of that. Every single request is evaluated in isolation based on exactly and only what is in the prompt. The model will make inferences and fill in gaps, but those inferences are based on statistical patterns from training data, not on knowledge of your specific situation, your specific standards, or what you meant when you were vague.

This means that every ambiguity in your prompt is an opportunity for the model to make a choice you did not intend. And on the inputs you tested, those unintended choices happened to match what you wanted. On the inputs you did not test, they might not.

A reliable prompt is one where the number of unintended choices available to the model is as small as possible. Not zero, you cannot anticipate everything, but as small as you can make it given what you know about your use case.

What makes a prompt specific enough to be reliable

There are a few dimensions of specificity that matter more than others when you are trying to build something that works consistently.

The task definition is the most important one. Not just what you want the model to do but what success looks like. Not "summarize this document" but "write a three sentence summary that captures the main argument, the supporting evidence, and the conclusion, written for someone who has not read the document and does not have domain expertise." The second version leaves far less room for interpretation.

The output format is the second most important. If you care about how the response is structured, you have to say so explicitly. The model will pick a format if you do not specify one, and it will pick a different format for different inputs based on what seems most appropriate for each. If you need consistency across inputs, you need to specify the format explicitly every time.

The edge cases are the third dimension that most people skip entirely. What should the model do if the input does not fit the expected pattern? What should it do if the information needed to complete the task is missing? What should it do if the user asks for something outside the scope of what the prompt is designed for? Prompts that do not address these cases produce unpredictable behavior when they arise, and they will arise.

According to Hamel Husain's field guide to improving AI products, error analysis, actually looking at the specific cases where your prompt fails and understanding why, is the single highest-ROI activity in AI development. Most teams skip it because they assume the problem is the model. It almost never is.

The test that reveals whether your prompt is actually reliable

Here is a test that will immediately show you how reliable your current prompts are.

Take your ten most important prompts. For each one, write down five inputs that are slightly unusual, slightly edge-case, slightly outside the happy path you tested on. Not crazy inputs. Just the kinds of inputs that real users with real needs will definitely send at some point.

Run those inputs through your prompts and look at the outputs honestly. How many of them are exactly what you would want? How many are close but not quite right? How many are clearly wrong?

If you are getting clean results on all fifty of those test inputs, your prompts are probably in good shape. If you are getting significant variation across inputs that should produce similar results, you have reliability problems that will show up in production whether you find them in this test or not.

The difference between finding them now and finding them when a user reports a bug is the difference between a ten minute prompt fix and a support ticket, an investigation, a fix, and a new deployment.

Prompts as artifacts, not throwaway text

One of the most useful mindset shifts you can make about prompts is to start treating them as first-class engineering artifacts rather than disposable inputs.

That means version controlling them. It means documenting what each prompt is designed to do, what inputs it handles, and what edge cases it accounts for. It means having a process for testing changes before deploying them. It means reviewing them periodically as your use case evolves rather than writing them once and forgetting about them.

As Eugene Yan writes in his work on building LLM applications for production, the same engineering discipline that makes software systems reliable, versioning, testing, systematic iteration, needs to be applied to prompts if you want AI features to behave reliably in production. A prompt is a piece of software. Treat it like one.

The specific habits that make prompts more reliable over time

Writing more specific task definitions is the starting point. For every prompt you currently have that describes what you want in vague terms, rewrite it to describe what success looks like in concrete terms.

Adding explicit format instructions is the next step. For every prompt where the format of the output matters, specify it explicitly. Do not assume the model will pick the right format based on context.

Building a small test suite for each important prompt is the habit that prevents regression. It does not need to be elaborate. Ten to twenty representative inputs that cover your happy path and your most likely edge cases, run every time you change the prompt, is enough to catch most problems before they reach users.

And reading the outputs that surprise you, the ones where the model did something you did not expect, and asking what in the prompt allowed that to happen, is the feedback loop that makes each iteration better than the last.

The Prompt Toolbox is a useful place to iterate on prompts and test them systematically, which is faster than going back and forth through an API and gives you a clearer view of how small changes affect outputs.

The thing most people do not want to hear

Writing reliable prompts takes longer than writing quick prompts. There is no way around that. A prompt that works once takes five minutes. A prompt that works every time takes thirty minutes of thought, some testing, and probably a few iterations.

Most people are not willing to invest that time until something breaks badly enough that they have to. And then they invest it reactively, under pressure, on a prompt that is already causing problems in production.

The teams that build the most reliable AI features are the ones that invest that time upfront, before shipping, when fixing something is cheap and easy and does not involve angry users. That is not a complicated insight. It is just a discipline that requires treating prompts with the same seriousness you would treat any other piece of code that runs in production.

Advertisement

Try the tools