Prompt Engineering for Beginners: 12 Techniques That Actually Work
You do not need a magic formula to get good answers from an LLM. You need structure, context and a way to verify the output. These 12 techniques cover all three.
There is a persistent myth that prompt engineering is a secret language of magic phrases. It is not. Great prompts are built from a small set of repeatable techniques that give a model context, structure and a way to be checked.
1. Give the model a role and a goal
Start by telling the model who it is and what success looks like. "You are a senior editor. Rewrite the following paragraph for a general audience, keeping it under 100 words." The role narrows the space of possible responses; the goal defines the finish line.
2. Provide context before the question
Models answer better when they know the background. State the audience, the tone, the constraints and the purpose. Context given up front shapes every subsequent token.
3. Use few-shot examples
One example is worth a thousand instructions. Show the model an input and the output you expect, then ask for the next one. This is called few-shot prompting and it often beats elaborate instructions.
Convert product names to slugs:
"AI Writer Pro" → "ai-writer-pro"
"Hello, World 2.0" → "hello-world-2-0"
"Agent Runner" →
4. Ask for step-by-step reasoning
When you need accuracy, ask the model to reason out loud before giving a final answer. This is chain-of-thought prompting. "Work through this step by step, then give a final answer." The intermediate steps keep the model honest.
5. Specify the output format
Do not leave the format to chance. Ask for JSON, a table, a bulleted list, or a specific length. "Return a JSON object with keys name, price, and summary." Models comply with explicit format requests reliably.
6. Use negative instructions sparingly
Saying "do not mention X" works less well than telling the model what to include. If you must exclude something, phrase it as an instruction: "Only discuss verified facts and say 'unknown' otherwise."
7. Break complex tasks into steps
Ask the model to perform one operation at a time. Instead of "summarise and translate and extract quotes", ask it to summarise first, then translate, then extract. Each step gets its own chance to be correct.
8. Ask the model to ask questions
When the task is underspecified, tell the model to ask for clarification first. "Ask me up to three clarifying questions before answering." This turns a guessing model into a careful one.
9. Constrain with delimiters
Wrap the user-supplied text in clear markers so the model knows what is content versus instruction. Triple backticks, XML tags or all-caps labels all work. This also reduces prompt injection risk when you insert outside text.
10. Give it an escape hatch
Always let the model say "I don't know". "If the information is not in the provided sources, reply: 'Not available in the sources.'" You trade a little fluency for a lot of honesty.
11. Iterate on output, not just input
Treat the first response as a draft. "Good, now make it 30% shorter", "more formal", "add a concrete example". Editing the output is cheaper and more controllable than re-engineering the prompt.
12. Build a small evaluation set
Collect ten representative inputs with good expected outputs. When you change a prompt, run it against the set. This turns prompt tweaking from vibes into measurement — and it is the single biggest upgrade most people can make.
The best prompt engineers are not more creative. They are more precise about what they ask for and more rigorous about checking what they get.
Written by
Alex Morgan
Alex has spent a decade building software and five years writing about it. At AIComets they focus on prompt engineering, AI agents and honest product testing.
More articles by Alex Morgan →Frequently asked questions
How long does it take to read this article?
Most readers finish in under ten minutes. Use the table of contents to jump to the section you need.
Do I need previous experience to follow along?
No. We explain every concept as it appears, and the code examples are self-contained.