Prompt Engineering Fundamentals: The Core Techniques
Role, context, constraints, format, examples. The six building blocks that underpin almost every strong prompt — explained with examples you can reuse.

Ask two people to write a prompt for the same job and you'll get two very different results out of the same model. The gap is rarely the model. It's the instructions. A strong prompt is assembled, not guessed at, and once you know the parts it's built from you can put them together on purpose instead of rewriting the same request eight times hoping one version sticks. Six pieces do most of the work, and two habits separate people who wrestle with the model from people who steer it.
Give the model a role
A role sets the model's vocabulary, assumptions, and default depth before you've asked for anything. "Explain this bug" and "You are a senior backend engineer reviewing a junior's pull request; explain this bug" pull answers from different places. The second one knows to mention edge cases, naming, and the fix a reviewer would actually leave.
Keep the role specific and tied to the outcome you want. "You are a helpful assistant" adds nothing. "You are a technical editor for a developer audience who cuts filler and flags unsupported claims" changes every sentence that follows.
State the task with an action verb
The task is the single thing you want done, and it should start with a verb that leaves no room for interpretation. "Summarize," "compare," "rewrite," "classify," "extract," "draft," "critique." Vague openers like "help me with" or "look at" force the model to guess whether you want a summary, an opinion, or a rewrite, and it often guesses wrong.
One prompt, one primary verb. If you catch yourself stacking three requests, that's usually two prompts wearing a trench coat. Split them. A request to "extract the action items and then rank them by urgency and then draft emails" is cleaner as steps you can check between.
Add the context it can't guess
The model knows language. It doesn't know your situation. Context is everything specific to your case that changes the right answer: who the audience is, what's already been tried, what the source material actually says, what "good" looks like here.
- Who is this for, and what do they already know?
- What's the source text, data, or constraint the answer must respect?
- What did earlier attempts get wrong that you want avoided?
Paste the real material instead of describing it. "Summarize our refund policy" gives a generic answer. Pasting the policy and asking for a summary gives your answer. If you're not sure how much background to include, our walkthrough on writing prompts from scratch shows how to layer context without burying the task.
Set constraints and pin the output format
Constraints are the guardrails: length, tone, and the things to avoid. Format is the shape you want back. Both matter because a model with no boundaries defaults to a medium-length, medium-formal paragraph, which is almost never exactly what you need.
Spell out the limits you care about:
- Length: "under 80 words," "exactly three bullets," "one sentence."
- Tone: "plain and direct, no exclamation points," "warm but professional."
- Must-avoid: "no jargon," "don't mention pricing," "avoid the word 'solution.'"
- Format: JSON with named keys, a Markdown table, a numbered list, a single code block.
When you need structured output, describe the structure exactly and the model will hold to it.
Once you have a prompt that mostly works, a pass through the prompt analyzer will point out where your constraints are still vague, and the prompt optimizer can tighten the wording for you.
Show it an example
Telling the model what you want is good. Showing it is better. One or two worked examples pin down tone, structure, and edge-case handling more precisely than a paragraph of description ever will. This is the difference between zero-shot and few-shot prompting, and it's worth understanding when each pays off, which the zero-shot versus few-shot guide covers in depth.
An example acts as a template the model pattern-matches against. Show the input and the exact output you'd accept, then give it the real input.
Two examples that cover different cases (a long note, a chatty one) teach the model the boundaries faster than five near-identical ones. Quality and variety beat quantity.
Ask it to reason, then iterate
For anything with steps, comparisons, or a chance of a wrong turn, ask the model to reason before it answers. "Think through the trade-offs step by step, then give your recommendation" reliably improves accuracy on logic, math, and multi-part decisions, because the model works through intermediate steps instead of jumping to a guess. When you want the reasoning shaped and consistent across runs, a scaffold like the chain-of-thought prompt builder lays out the steps for you.
One caution: if you need a clean final answer for a downstream system, ask the model to reason internally and then output only the result, or the reasoning will land in your JSON.
The second habit is iteration. Your first prompt is a draft. Run it, read what came back, and treat every miss as a missing instruction rather than a broken model. Too long? Add a length cap. Too formal? Name the tone. Wandered off topic? Tighten the task verb or add a must-avoid line. Change one variable at a time so you know what fixed it.
- Run the prompt and compare the output to what you actually wanted.
- Find the single biggest gap and add one instruction that closes it.
- Repeat until it's boring and reliable, then save that prompt as your template.
That loop is the whole craft. To answer the common worry directly: better models don't remove the need for this. They raise the ceiling, but consistency and control still come from the prompt, not from hoping. Once these six blocks feel automatic, the advanced techniques guide covers what comes next, including prompt chaining, self-critique, and evaluation.


