Learn · Guide
Prompt Engineering Basics
A repeatable way to write instructions that get useful, verifiable answers from a language model.
A prompt is a specification
Most weak prompts are not unclear because the model is stubborn; they are unclear because the task was never specified. A useful prompt usually contains five parts: the role or perspective, the concrete task, the context the model needs, the output format, and the constraints. You do not need all five in every request, but when an answer misses the mark, check which one is missing. Vague inputs produce plausible but arbitrary outputs.
Show the shape of the answer
If you want a table, describe the columns. If you want three bullets, say three. If the answer will be parsed by code, ask for JSON and describe the fields. Output structure is one of the cheapest ways to improve reliability, because it removes guesswork about what counts as done. It also makes errors visible: a malformed row is much easier to spot than a paragraph that quietly drifts off topic.
Give evidence, not adjectives
Phrases like "write professionally" or "be accurate" do not give the model much to work with. Instead, provide a short example of the tone you want, or paste the source text the answer must be grounded in. Ask the model to quote the lines it used. If a fact matters, require a citation to a provided document rather than relying on memory. Models are good at continuing patterns; your examples define the pattern.
Test with a small set
Prompt engineering is closer to debugging than to inspiration. Keep five to ten representative inputs, run your prompt on all of them, and compare the results. Change one thing at a time: the instruction, the example, or the format. Without a fixed test set, every change feels like an improvement until the next surprise. Store the winning version in a prompt template so it can be reused and compared fairly.
Know when to stop prompting
Some failures are not prompt problems. If the task requires exact arithmetic, current data, private records, or character-level manipulation, use a tool or a program for that step. A prompt cannot make a model know something it was not given, and it cannot guarantee factual accuracy on its own. Treat prompting as one layer in a system that also includes retrieval, validation, and human review where the stakes justify it.