Home / Blog / AI Engineering / Language Models
Prompt Engineering That Actually Works: Practical Rules
AI Engineering · Language Models · 7 min read
Practical prompt rules that produce useful answers: clear jobs, relevant context, a shown format, and one fix at a time.
Give the model a job it can finish
A good prompt reads like a brief to a capable colleague. It names one job, one reader, and one result. Vague prompts fail because the model has to guess all three. A guess in the wrong direction produces a polished answer to the wrong question.
Prompt engineering is the practice of writing those instructions well. A prompt is the text you send to a language model. Prompt engineering is choosing that text with care, so the output is useful on the first or second try.
Compare a vague request with a finished brief. Vague: “Write about watering plants.” Finished: “Write a 150-word watering guide for a small balcony garden in a hot, dry summer. The reader is a beginner. Use short steps. Do not mention indoor plants.” The second prompt leaves far less to guess. Audience, length, setting, and scope are all fixed.
One job per prompt works best. A request that asks for a summary, three risks, a plan, and a covering email is four jobs in one. Split it. Ask for the summary first. Then use that summary as the input for the next step. Each step stays focused, and each result stays checkable.
Add only the context that changes the answer
Context is background the model needs to answer well. It includes the situation, the material to work from, and any decisions already made. Without it, the model fills gaps with generic material. With too much of it, the important details get buried.
Use a simple test for every detail. Remove the detail in your mind. Would the answer change? If the answer would stay the same, leave the detail out. If the answer would change, keep it. A bakery owner planning a Saturday market stall needs opening hours, best sellers, and a budget. The history of the building does not change the stall plan.
Paste source material instead of describing it from memory. If the model must summarise notes, paste the notes. If it must rewrite a notice, paste the notice. Mark the pasted material clearly, so the model can tell your instructions apart from the source text. A plain label works: “Source notes:” followed by the notes.
Also state what the model does not know. A new conversation carries no memory of your earlier chats. A reference to “the plan we discussed” means nothing unless you paste that plan again. Inside one conversation, the model can use earlier messages. Across conversations, it starts fresh.
Show the shape you want back
Format is the shape of the answer. It might be a table, a numbered list, short paragraphs, or a set of headings. If you do not name a format, the model picks one. That pick is often a long wall of text, even when a short list would serve better.
Name the format in plain words. Ask for a table with named columns when comparison matters. Ask for numbered steps when order matters. Ask for bullets when the reader will scan. Add a length limit when length matters. “In under 200 words” is clearer than “briefly.”
Keep the number of rules small. Three to five key requirements are easy to follow. Ten competing requirements are not. A prompt that demands funny, formal, beginner-friendly, advanced, short, and complete at once will miss half its own rules. Pick the requirements that matter most. Drop the rest, or handle them in a later pass.
Put the most important rule first, and repeat it if it is easy to miss. Rules buried at the end of a long paragraph are often ignored. A short numbered list of requirements, placed near the top of the prompt, survives far better than the same rules hidden inside prose.
Give one example instead of ten adjectives
Examples teach format faster than description. This technique is called few-shot prompting. Few-shot prompting means showing one or two examples of the wanted input and output, then asking for the next one. The model copies the pattern. That pattern covers tone, length, headings, and order.
Suppose you run a neighbourhood bakery and want short shelf labels. A description alone might say “friendly and concise.” An example says far more: “Sourdough loaf — Baked this morning. Keeps two days. Best sliced thick.” One example fixes the voice, the length, and the facts to include. The next label follows the same shape.
Use examples when style or format matters most. Product labels, email subject lines, quiz questions, and table rows all benefit. For a plain factual question, an example adds little. Save the technique for cases where the shape of the answer is half the job.
Keep examples short and consistent. Two examples that follow the same pattern beat five that drift. If the examples disagree with each other, the model has to guess which pattern to follow. Make the pattern obvious, and keep the new item clearly separate from the examples.
Fix one failure at a time
Treat the first answer as a draft. Iteration means revising the prompt and trying again, guided by what went wrong. Most weak answers fail in one clear way. Name that failure before rewriting anything.
Match the fix to the failure. If the answer is vague, narrow the task to one output and name the reader. If part of the instructions is ignored, turn the instructions into a numbered list and put the missed rule first. If the format drifts, show an example of the exact format. If facts are invented, add a missing-information rule.
That missing-information rule matters. Tell the model what to do when the source does not contain the answer. A simple line works: “If the notes do not state a date, write Not stated. Do not guess.” Without that line, the model may fill the gap with a plausible invention. With it, a gap stays visible, and visible gaps can be checked.
Change one thing, then test again. Changing five things at once hides which change helped. Keep a note of prompts that worked, with blanks for the parts that change each time. A prompt that worked once, saved as a template, beats a clever prompt rewritten from scratch every time.
Check facts before you trust them
No prompt guarantees true facts. A language model predicts plausible text. Plausible text can include invented names, dates, quotations, and figures. The risk grows when the topic is recent, obscure, or highly specific, and when no source material is supplied.
Build checking into the workflow. For factual claims, verify against a reliable source. For code, run it. For quotations, confirm they exist. For numbers that drive a decision, confirm them twice. A second prompt asking the model to check itself is not a real check. It can repeat the same plausible error with equal confidence.
A reusable brief pulls the rules together. Start with a role only when it changes the answer, such as “a patient tutor for beginners.” State the task in one sentence, starting with a verb. Add the context that passes the removal test. List three to five constraints. Name the format. Add one example when shape matters. End with the missing-information rule.
That brief is the whole method. One job, relevant context, a named format, one example where needed, one fix at a time, and a check at the end. Prompts written that way do not need tricks. They need the same care as any clear instruction to a colleague.
Questions readers ask
Is prompt engineering still needed with newer models?
Yes, for most tasks. Plain instructions work well with current models. The gains now come from clarity, context, and format, not from secret phrases.
How much context is enough?
Add the detail, then remove it mentally and see if the answer would change. If the answer would stay the same, the detail is noise. If it would change, keep it.
What should I do when the first answer is wrong?
Start with one change that targets the exact failure. If the answer is too long, set a length limit. If the format drifts, show an example. Fix one failure at a time.
Should I trust the first answer on facts?
For anything that matters, verify it. Check facts against a source, run any code, and confirm quotations exist. A fluent answer is not a verified answer.