Prompt Engineering for Beginners: Core Techniques, Examples and a Reusable Template
Learn prompt engineering from scratch: role, context, examples, step-by-step reasoning, output format and constraints, with before and after prompts.
The Short Answer
Prompt engineering is the practice of writing instructions that get an AI model to produce the output you actually want. For beginners it comes down to six habits: give the model a role, give it the context it cannot guess, show an example of a good answer, ask it to work through hard problems step by step, say exactly what format you want back, and state your constraints (length, tone, what to avoid). Then read the result, change one thing, and try again.
None of this requires code or a technical background. The same techniques work in ChatGPT, Claude, Gemini, Copilot and most other chat assistants, because all of them are large language models that respond to the text you give them. The official guides from OpenAI, Anthropic and Google describe these techniques in slightly different words, but they agree on the fundamentals covered below.
What Prompt Engineering Is (and Is Not)
A prompt is everything you send to the model: your question, any instructions, pasted documents, examples, and in an app, any hidden system instructions the developer wrote. Prompt engineering is simply the craft of shaping that input on purpose instead of typing the first thing that comes to mind.
It helps to picture the model as a very well-read new colleague who has never met you, does not know your company, cannot see your screen and will not ask clarifying questions unless you invite it to. Most bad AI output is not the model being "dumb". It is the model filling gaps you left with the most generic, average answer it can produce.
What prompt engineering is not:
- Magic words. There is no secret phrase that unlocks hidden intelligence. Clear, specific writing beats clever tricks.
- A replacement for checking facts. A well-engineered prompt still produces text that can be wrong. You remain responsible for verifying anything that matters.
- Only for developers. Developers use the same ideas inside apps (the OpenAI guide describes putting identity, instructions, examples and context into a "developer message"), but everyday users benefit just as much.
If you are still choosing which assistant to use, our ChatGPT vs Claude vs Gemini comparison covers the differences. The techniques here work in all three.
The Six Core Techniques at a Glance
| Technique | What you add | Why it helps | Quick example |
|---|---|---|---|
| Role | Who the model should act as | Sets vocabulary, depth and point of view | "You are a patient high school chemistry tutor." |
| Context | Background the model cannot know | Replaces generic guesses with specifics | "Our audience is first-time homebuyers in Ohio." |
| Examples (few-shot) | One or more samples of a good answer | Shows format and tone better than describing them | "Here are two product descriptions we liked..." |
| Step-by-step | A request to reason before answering, or explicit steps | Improves multi-step logic and math | "First list the assumptions, then calculate." |
| Output format | The exact shape of the answer | Makes results usable without reformatting | "Return a table with columns Task, Owner, Deadline." |
| Constraints | Limits and things to avoid | Prevents rambling and unwanted content | "Under 120 words. No jargon. Do not invent statistics." |
You will rarely need all six in one prompt. A quick question needs none of them. A task you will repeat every week deserves most of them.
Technique 1: Give the Model a Role
A role tells the model which "voice" and expertise level to adopt. Anthropic's documentation lists role prompting among its core techniques, and it is the easiest one to start with.
Before:
Explain inflation.
After:
You are an economics teacher explaining concepts to 14-year-olds.
Explain inflation using one everyday example involving prices a teenager
would notice, like snacks or game subscriptions.
The second version tells the model who it is talking to and what kind of example will land. A role on its own is weak, though. "You are a world-class marketer" adds little if you never say what you are marketing or to whom. Treat the role as a starting point and pair it with context.
Technique 2: Provide the Context It Cannot Guess
Context is the single biggest lever for beginners. Google's Gemini prompting guide makes the point directly: include the information the model needs instead of assuming it already knows. In its example, adding a product's troubleshooting guide to the prompt turned a generic answer into a specific one.
Useful context usually answers these questions:
- Who is the audience? Customers, your boss, a beginner, an expert?
- What is the goal? Inform, persuade, decide, apologize, sell?
- What do you already know or have? Paste the draft, the data, the email thread, the policy.
- What happened before? "We already tried restarting the router" saves a wasted answer.
Before:
Write an email asking for a deadline extension.
After:
Write an email to my manager, Priya, asking to move the Q3 report deadline
from Friday to next Wednesday. Context: two of the five regional data files
arrived three days late, and I have already finished the other three
sections. I want to sound professional, not apologetic, and offer to send
a partial draft on Friday.
The "after" prompt is longer, but it takes thirty seconds to write and saves several rounds of editing.
Technique 3: Show Examples (Few-Shot Prompting)
A prompt with no examples is called zero-shot. A prompt that includes a few sample inputs and outputs is called few-shot. Examples are powerful because they show the model the pattern instead of describing it.
Google's guide goes as far as recommending that you always include few-shot examples, with two caveats worth remembering: keep the formatting of your examples consistent, and do not overdo it, because too many examples can make the model copy them too closely. OpenAI's guide similarly suggests covering a diverse range of inputs with the outputs you want.
Example: classifying customer messages
Classify each customer message as BILLING, TECHNICAL or OTHER.
Message: "I was charged twice this month."
Category: BILLING
Message: "The app crashes when I upload a photo."
Category: TECHNICAL
Message: "Do you have a store in Leeds?"
Category: OTHER
Message: "My invoice shows the wrong company name."
Category:
The model will almost certainly answer "BILLING" in exactly the format you showed, with no extra explanation. Without the examples you might get a paragraph.
Tips for good examples:
- Use real examples from your own work when you can (with personal data removed).
- Vary them. If every example is short and positive, the model may assume every answer should be short and positive.
- Keep the layout identical across examples so the pattern is obvious.
Technique 4: Ask for Step-by-Step Reasoning
For problems with several steps, such as math, planning, comparing options or debugging, asking the model to work through the problem before giving a final answer tends to produce better results. Many current models have a built-in "thinking" or reasoning mode that does this automatically, and the vendor guides note that reasoning models often do best with a clear high-level goal rather than micro-managed steps. For standard chat models, an explicit structure still helps.
Before:
Should we hire a part-time bookkeeper or buy accounting software?
After:
Help me decide between hiring a part-time bookkeeper and buying accounting
software for a 6-person design studio.
Work through it in this order:
1. List the questions that determine the answer.
2. Answer each one using the details below, and say where you are assuming.
3. Compare total yearly cost using the figures I give.
4. Give a recommendation and the main risk of that choice.
Details: about 40 invoices a month, payroll for 6 people, nobody on the team
enjoys bookkeeping, and the owner currently spends roughly 5 hours a month
on it.
Breaking the task into steps does two things: it guides the model's reasoning, and it makes the answer easy for you to audit. If step 2 contains a wrong assumption, you can see it and correct it.
Google's guide also recommends splitting genuinely complex jobs into a chain of smaller prompts: one to outline, one to draft, one to review. That is often more reliable than one giant prompt.
Technique 5: Specify the Output Format
If you need a table, ask for a table. If you need JSON for a spreadsheet import, show the exact fields. If you want three options, say three. The Gemini guide lists response format (table, bullets, keywords, paragraph) as a core strategy, and OpenAI's guide recommends Markdown headings and XML-style tags to separate the parts of a longer prompt.
Before:
Give me some ideas for team-building activities.
After:
Suggest 5 team-building activities for a remote team of 12 across three
time zones. Return a Markdown table with these columns:
Activity | Time needed | Cost (free, low, medium) | Best for
Then add one sentence recommending which to try first and why.
A useful trick from the Gemini guide is the completion strategy: start the answer yourself. If you write the first row of a table or the opening of a JSON object, the model tends to continue in the same pattern.
Technique 6: State Your Constraints
Constraints tell the model what to avoid and where the limits are. Common ones:
- Length: "Under 150 words", "exactly 3 bullet points", "one sentence".
- Tone: "Friendly but not casual", "plain English, no buzzwords".
- Scope: "Only use the information in the document below."
- Honesty: "If you are not sure, say so. Do not make up figures, quotes or sources."
- Audience limits: "Avoid technical terms; the reader is not an engineer."
Positive instructions usually work better than long lists of prohibitions. "Write in short, plain sentences" is more useful than "don't be wordy, don't use jargon, don't be complicated".
Putting It Together: A Full Before and After
Here is how the six techniques combine on a realistic task.
Before:
Write a LinkedIn post about our new product.
After:
Role: You are a B2B copywriter who writes in a calm, practical voice.
Context: We are a 20-person company that sells scheduling software to
dental clinics. We just launched automatic appointment reminders by text
message. The main benefit our pilot clinics mentioned was fewer
front-desk phone calls. Our audience is clinic owners and office managers.
Example of a past post we liked:
"Most clinics don't have a scheduling problem. They have a phone problem.
Here's what changed when one practice moved confirmations to text..."
Task: Write a LinkedIn post announcing the reminder feature.
Format: 120 to 160 words, short paragraphs, one question at the end to
invite comments, no hashtags in the body, 3 hashtags on the last line.
Constraints: No exclamation marks. Do not invent statistics or customer
quotes. Do not claim it reduces no-shows by a specific percentage.
The "after" prompt is not long because length is good. It is long because every line removes a guess the model would otherwise have to make.
Common Beginner Mistakes
- Being vague about the goal. "Make this better" could mean shorter, more formal, more persuasive or more accurate. Say which.
- Leaving out the audience. The same topic needs very different writing for a CEO, a customer and a 10-year-old.
- Asking for everything at once. One prompt that researches, outlines, writes, edits and formats will usually do each step worse than a short chain of prompts.
- Not giving the source material. If you want a summary of a policy, paste the policy. Otherwise the model summarizes what it guesses the policy says.
- Trusting facts, numbers and citations without checking. Models can produce confident, plausible and wrong answers. Ask for sources and then open them yourself.
- Giving up after one try. Prompting is iterative. Google's guide suggests rephrasing, reframing the task, or changing the order of the content when results are off.
- Pasting sensitive data into tools your organization has not approved. Customer records, passwords, health or financial details should stay out of consumer AI tools unless your company's policy explicitly allows it.
How to Iterate When the Answer Is Not Right
When a response misses, diagnose it before rewriting everything:
| Problem | Likely cause | What to change |
|---|---|---|
| Too generic | Missing context | Add audience, goal and specifics |
| Wrong tone | No role or example | Add a role and a sample you like |
| Wrong format | Format not stated | Specify the structure, or start it yourself |
| Too long | No length limit | Give a word or bullet count |
| Made-up details | Model filling gaps | Supply the facts and say "only use what I provided" |
| Logic errors | Task too complex for one shot | Ask for steps, or split into a chain of prompts |
You can also ask the model to help: "Before answering, ask me up to three questions that would improve your answer." This turns the one-way prompt into a short interview and often surfaces context you forgot to include.
A Reusable Prompt Template
Copy this into a notes app and fill in the brackets. Delete any line you do not need.
ROLE
You are [who the model should be, and their level of expertise].
CONTEXT
[Background: who this is for, why it matters, what has happened so far.]
[Paste any source material here, clearly marked.]
TASK
[One clear sentence describing what you want done.]
EXAMPLES (optional)
[One to three samples of good output, in the same format.]
STEPS (optional, for complex tasks)
1. [First step]
2. [Second step]
3. [Final step]
OUTPUT FORMAT
[Table / bullets / email / JSON with these fields / word count.]
CONSTRAINTS
- [Length and tone]
- [What to avoid]
- If anything is unclear or you are unsure, say so instead of guessing.
Once a version of this works well for a recurring task, save it. Most assistants now let you store reusable instructions (custom instructions, projects, Gems and similar features), so you do not have to paste the same context every time.
Where to Learn More
- OpenAI: the prompt engineering guide covers message roles, Markdown and XML formatting, few-shot learning and adding context.
- Anthropic: the prompt engineering overview links to Claude's prompting best practices and a free interactive tutorial on GitHub.
- Google: the Gemini prompting strategies page explains zero-shot versus few-shot prompts, constraints, response formats and prompt chaining.
Once you are comfortable with prompts, the natural next steps are putting them to work: building an AI chatbot for your website relies on a well-written system prompt, and AI writing assistants produce far better drafts when you use the techniques above. If you want to go further, our guide to what AI agents are shows how prompts become instructions for systems that take actions.
FAQ
Is prompt engineering still worth learning now that models are smarter?
Yes. Newer models are better at guessing what you mean, but they still cannot know your audience, your data or your standards unless you tell them. The core skill, clear and specific instructions with the right context, carries over to every model and tool.
What is the difference between zero-shot and few-shot prompting?
A zero-shot prompt gives instructions with no examples. A few-shot prompt includes a small number of example inputs and outputs so the model can copy the pattern. Few-shot prompts are especially useful for classification, formatting and matching a particular writing style.
How long should a prompt be?
As long as it needs to be to remove guesswork, and no longer. A simple question can be one line. A recurring business task may need a paragraph of context, an example and a format specification. Length that adds information helps; length that repeats itself does not.
Do I need different prompts for ChatGPT, Claude and Gemini?
The fundamentals are the same across all three, and the official guides from each company recommend similar techniques. Each vendor also publishes model-specific tips, so if you rely heavily on one assistant, it is worth reading its official guide.
Can a good prompt stop AI from making things up?
It reduces the risk but does not remove it. Supplying source material, telling the model to use only that material, and asking it to say when it is unsure all help. You should still verify facts, numbers and citations before you rely on them.
Want More AI Insights?
Join 10,000+ professionals getting weekly AI news, tool reviews, and tutorials.
Explore More Articles