Skip to content

General

Prompt Engineering Examples: Techniques and Prompts That Work

Practical prompt engineering examples for zero-shot, few-shot, chain-of-thought, roles, CRISPE, output formats, ReAct, RAG and more, with prompts to copy.

Large language models such as ChatGPT, Claude and Gemini respond to what you write, not to what you meant. The same model can give you a vague paragraph or a precise, well-formatted answer depending on how the request is framed. Prompt engineering is the practice of framing it well.

This guide collects the prompting techniques that come up again and again in real work, from the simplest (just ask) to the more involved (let the model reason, branch, call tools or read your documents). Each section explains how the technique works, shows example prompts you can adapt, and lists where it helps and where it gets in the way. At the end you will find a comparison table, a short guide to choosing a technique, and the mistakes that cause most bad outputs.

You do not need to use every technique. Most good prompts combine two or three of them: a clear instruction, a little context, an example or two, and a defined output format.

What every good prompt contains

Before the named techniques, it helps to know the building blocks they all rearrange. A strong prompt usually covers some or all of these:

  • Task. What you want done, stated as a direct instruction: "Summarize", "Classify", "Rewrite", "Compare".
  • Context. The background the model cannot guess: who the output is for, what it will be used for, what has already been tried.
  • Input. The material to work on, clearly separated from the instructions, for example inside triple quotes or tags.
  • Examples. One or more samples of what a good answer looks like.
  • Format. The shape of the output: a bulleted list, a table, JSON with named fields, three sentences, under 200 words.
  • Constraints. What to avoid or respect: no jargon, cite sources, do not invent figures, use British spelling.

Here is a weak prompt and a stronger version of the same request:

Text
Write about our new feature.
Text
Write a 120-word announcement of our new CSV export feature for existing
customers. Audience: operations managers who are not technical.
Tone: friendly and plain. Mention that exports include all custom fields
and run in the background. End with one sentence telling them where to
find it (Settings > Data > Export). Return plain text, no headings.

The second prompt is not clever. It simply removes guesswork. Every technique below is a structured way of removing guesswork for a particular kind of problem.

Zero-shot prompting

Zero-shot prompting means asking the model to perform a task without giving it any examples of how it should be done. The model relies entirely on what it learned during training to interpret the instruction and produce an answer. It is the default way most people use AI tools, and for common tasks it works well.

Typical zero-shot prompts:

Text
Translate this text to French: "Hello, how are you?"
Text
Summarize the following article in three sentences for a busy executive.
"""
[article text]
"""
Text
Explain quantum computing to a 10-year-old in under 100 words.

None of these include a sample answer. They work because translation, summarization and simple explanation are tasks the model has seen countless times.

When to use it. Zero-shot is the right first move for straightforward, common tasks, for quick prototyping, and for testing what a new model can do on its own. If the result is good, you are done. If it is inconsistent or misses the format you need, move on to few-shot or a more structured technique.

Strengths:

  • Fast to write, with no examples to gather or curate.
  • Works well for tasks inside the model's general knowledge.
  • Reveals a model's baseline capability, which is useful when comparing models.

Limitations:

  • Results can vary between runs, especially for nuanced requests.
  • Less control over format and style.
  • Weaker on specialized, novel or multi-step tasks.

Tips:

  • Be clear and specific. Ambiguity is the main cause of off-target zero-shot answers.
  • State the output format explicitly: a list, a paragraph, a table, a word count.
  • Use the domain's own terminology so the model knows which context applies.
  • Break large tasks into a sequence of smaller prompts.
  • Try two or three phrasings. Small wording changes can noticeably change the output.

Few-shot prompting

Few-shot prompting gives the model a small number of input and output pairs before the real input. Instead of describing what you want, you show it. The model picks up the pattern, format and style from the examples and applies them to the new case. This is often called in-context learning, because the model adapts within the prompt without any retraining.

The technique was popularized by the 2020 OpenAI paper "Language Models are Few-Shot Learners" (Brown et al.), which showed that large models can perform new tasks from a handful of demonstrations.

A sentiment classifier:

Text
Classify the sentiment of each review as Positive, Negative or Neutral.

Review: "This movie is fantastic."
Sentiment: Positive

Review: "I hated every minute of it."
Sentiment: Negative

Review: "It was an okay film."
Sentiment: Neutral

Review: "The restaurant was better than I expected."
Sentiment:

A product categorizer:

Text
iPhone 13 -> Electronics
War and Peace -> Books
Trail running shoes -> Sports
Cast iron skillet ->

A structured extraction that teaches a JSON shape by example:

Text
Text: "Maria Lopez, 34, joined as Head of Design on 3 March."
JSON: {"name": "Maria Lopez", "age": 34, "role": "Head of Design"}

Text: "Our new CFO is Tom Becker, who is 51."
JSON: {"name": "Tom Becker", "age": 51, "role": "CFO"}

Text: "Priya Shah (29) is the team's first data engineer."
JSON:

Few-shot works just as well for translation pairs, short summaries, code that follows a house style, or poems in a particular form.

When to use it. Reach for few-shot when zero-shot answers are inconsistent, when you need a precise format, or when the requirement is easier to demonstrate than to explain, such as a tone of voice or a labeling scheme.

Strengths:

  • Much more consistent output than zero-shot for formatting and labeling tasks.
  • Captures nuance that is hard to put into words.
  • No fine-tuning needed; everything happens in the prompt.

Limitations:

  • Examples use tokens and leave less room for the actual input.
  • The model copies your examples closely, including their mistakes and biases.
  • Results depend on how representative the examples are.

Tips:

  • Two to five examples are usually enough. More is not always better.
  • Keep the formatting identical across examples and the final input.
  • Cover the variety you expect, including an edge case or two.
  • Order examples from simple to complex when the task has levels of difficulty.
  • Separate examples clearly with labels, blank lines or numbering.
  • Place the examples directly before the new input.

Chain-of-thought prompting

Chain-of-thought (CoT) prompting asks the model to reason through a problem in explicit steps before giving the answer. Instead of jumping straight to a conclusion, the model writes out the intermediate steps, which makes errors less likely on tasks that involve arithmetic, logic or several dependent decisions. Google researchers described the technique in 2022 (Wei et al.), and a follow-up study (Kojima et al.) showed that simply adding "Let's think step by step" can trigger the same behavior without any examples.

A zero-shot CoT prompt:

Text
Think step by step, then give the final answer on its own line.
What is 13 x 27 - 15 x 4?

A good response shows its work: 13 x 27 = 351, 15 x 4 = 60, 351 - 60 = 291.

A word problem where step-by-step reasoning prevents a quick wrong guess:

Text
36 students are going on a field trip. 7 parents have volunteered to
drive, and each car holds 4 students. How many more drivers are needed?
Let's think step by step.

The reasoning: 7 cars carry 28 students, which leaves 8 students, and 8 divided by 4 is 2 more drivers.

A few-shot CoT prompt includes a worked example so the model copies the reasoning pattern:

Text
Q: A shop sells pens at 3 for $2. How much do 12 pens cost?
A: 12 pens is 4 groups of 3. Each group costs $2. 4 x 2 = 8. The answer is $8.

Q: A train travels 180 km in 2 hours, then 120 km in 1.5 hours.
What is its average speed for the whole trip?
A:

CoT is not only for math. It helps with logic puzzles, debugging (walk through what the code does line by line), and business decisions (list the criteria, score each option, then recommend).

Strengths:

  • Noticeably better accuracy on multi-step reasoning.
  • Transparent: you can see where the reasoning went wrong.
  • Easy to add to almost any prompt.

Limitations:

  • Longer responses use more tokens and take longer.
  • Unnecessary for simple lookups or short creative tasks.
  • A wrong early step still leads to a wrong answer, presented confidently.

Tips:

  • Ask for the reasoning first and the final answer last, clearly labeled.
  • In few-shot CoT, make sure your worked examples are correct and concise.
  • Check the logic, not just the final number.
  • Many current models reason internally before answering. With those, a short "think it through carefully" is often enough, and you may prefer to ask only for the conclusion plus a brief justification.

Self-consistency prompting

Self-consistency builds on chain-of-thought. Instead of trusting one reasoning path, you ask the same question several times independently and take the answer that comes up most often. If different reasoning paths converge on the same result, that result is more likely to be correct. Google researchers introduced the method in 2022 in the paper "Self-Consistency Improves Chain of Thought Reasoning in Language Models" (Wang et al.).

In practice it looks like this:

  1. Write a chain-of-thought prompt for a problem with a definite answer.
  2. Run it several times with some randomness enabled (a temperature above zero), so the model takes different routes.
  3. Extract the final answer from each run.
  4. Take the majority answer. If the runs disagree widely, treat that as a sign the prompt is ambiguous or the problem is beyond the model.
Text
Solve the problem below. Reason step by step, then write the final
answer on the last line in the form "ANSWER: <number>".

A warehouse ships 240 orders a day. Each picker handles 35 orders a day.
How many pickers are needed to cover a 10% increase in orders?

Running this five or more times and counting the "ANSWER:" lines turns several noisy attempts into one more reliable result. A fixed answer line makes the vote easy to automate.

Where it fits: math, logic, classification with a correct label, and code where you can compare outputs or run tests. It works poorly for subjective writing, where there is no single right answer to vote on.

Strengths:

  • Reduces the impact of a single bad reasoning path.
  • The level of agreement gives you a rough confidence signal.

Limitations:

  • Costs several times as much as a single call.
  • If the model has a systematic misconception, all runs can agree on the same wrong answer.
  • Needs some code or manual effort to collect and compare answers.

Tree of thoughts prompting

Tree of thoughts (ToT) extends step-by-step reasoning from a single line into a branching search. At each step the model proposes several possible next thoughts, evaluates how promising each one is, keeps the best, and abandons dead ends. It can backtrack, which a straight chain of thought cannot. The method was described in 2023 by researchers from Princeton and Google DeepMind (Yao et al., "Tree of Thoughts: Deliberate Problem Solving with Large Language Models").

The classic demonstration is the Game of 24: combine four numbers with basic arithmetic to make 24. A linear chain often commits to a bad first operation. A tree explores several first operations, scores which ones can still reach 24, and continues only from those.

A single-prompt approximation you can use in a chat:

Text
Imagine three experts working on this problem. Each expert writes down
one step of their thinking and shares it with the group. Then all of them
move to the next step. If an expert realizes their path is wrong, they
drop out. Continue until the group agrees on an answer.

Problem: Using 4, 7, 8 and 8 once each with +, -, x and /, make 24.

Full ToT is usually implemented in code: a program asks the model for candidate steps, asks it again to rate each candidate, and manages the search (breadth-first, depth-first or a beam that keeps only the top few paths at each level).

Good fits: planning problems, puzzles, strategy decisions with several viable options, and creative work where you want to explore alternative plotlines or concepts before committing.

Strengths:

  • Better results on problems where the first idea is often wrong.
  • Produces several candidate solutions you can compare.

Limitations:

  • Many model calls, so cost and latency grow quickly with depth.
  • Requires clear evaluation criteria for what makes a branch promising.
  • Overkill for anything a single chain of thought can solve.

Tips: define how branches are scored, cap the depth and the number of branches kept per level, and prune early. Combining ToT with a final self-consistency vote across the surviving branches is a common pattern.

Role-based prompting

Role-based prompting tells the model to answer as a specific expert, professional or character. The role frames the vocabulary, depth, tone and priorities of the response. "Explain the benefits of intermittent fasting" and "Act as a registered dietitian explaining intermittent fasting to a client who has type 2 diabetes" produce very different answers, and the second is usually more careful and more useful.

Example prompts:

Text
Act as a senior Python developer. Review the function below for
correctness, readability and performance. List issues by severity,
then show a corrected version.
"""
[code]
"""
Text
You are a medieval historian. Explain the significance of the Battle of
Hastings for a general audience in about 300 words.
Text
You are a patient maths teacher helping an adult beginner understand
fractions. Use one everyday example and check understanding with a
question at the end.
Text
Take the role of a critical business analyst. Evaluate the market for
the product described below. Cover target customers, competitors,
risks, and what evidence would change your view.
"""
[product description]
"""

The same idea powers system prompts. When you set a role once at the start of a conversation or in an assistant's configuration, every later answer stays in that frame. The ChatGPT system prompt guide covers that in more depth.

Strengths:

  • Pulls in domain vocabulary and the priorities an expert would have.
  • Keeps tone and perspective consistent across a long answer or conversation.
  • Lets you dial explanations up or down for the audience.

Limitations:

  • A role does not add knowledge the model lacks. An "expert" persona can sound confident while being wrong.
  • Vague roles can produce stereotyped or jargon-heavy responses.
  • The style can overwhelm the substance if the task itself is underspecified.

Tips:

  • Be specific about the role's expertise and seniority, and name the audience.
  • State the goal: review, teach, persuade, critique.
  • For technical roles, name the methods or standards to apply.
  • Say whether accuracy or accessibility matters more.

Persona-based audience targeting

Role-based prompting defines who is speaking. Audience targeting defines who is listening. You describe the reader in detail so the model can choose the right vocabulary, examples, length and arguments. Marketers, educators and UX writers use this constantly.

A useful audience description covers:

  • Demographics: age range, profession, location, level of education.
  • Goals and pain points: what they are trying to achieve and what is getting in the way.
  • Existing knowledge: what they already know about the topic, so the model neither over-explains nor skips steps.
  • Preferences: reading level, preferred tone, terms they use and terms that put them off.
  • Objections: doubts they are likely to have, so the content can address them.

Example:

Text
Write a 150-word product description for a reusable water bottle.

Audience: office workers aged 25 to 35 who care about sustainability
but are skeptical of greenwashing. They read on their phones, skim, and
dislike marketing clichés. Their main objection: "Is this actually
better than a cheap plastic bottle?"

Lead with a concrete fact about the materials, address the objection
directly, and end with one short call to action.

The same structure adapts educational material ("middle school students with mixed reading levels") or health information ("older adults who are not comfortable with technical terms; use plain language and practical steps").

Strengths: content that fits its readers, consistent tone, and fewer rewrites. Limitations: personas built on assumptions rather than research can produce stereotyped copy, and very narrow targeting can exclude readers outside the persona. Base personas on what you actually know about your audience.

Instruction following and task specification

This technique treats the prompt as a specification. Instead of a single sentence, you give the model a structured brief: the objective, the steps, the output format, and the constraints. It is the most predictable way to prompt and the standard approach for anything that runs in production, such as automated reports, documentation generation or data cleaning.

A task specification often looks like this:

Text
Objective: Turn the support ticket below into a bug report for engineers.

Steps:
1. Identify the product area and the user's environment.
2. Extract the steps to reproduce, in order.
3. State the expected and the actual behavior.
4. Rate severity as Low, Medium or High using the rules below.

Severity rules:
- High: data loss, security issue, or no workaround.
- Medium: feature broken but a workaround exists.
- Low: cosmetic or minor inconvenience.

Output format: Markdown with the headings Area, Environment,
Steps to reproduce, Expected, Actual, Severity.

Constraints: Do not guess missing details. Write "Unknown" instead.

Ticket:
"""
[ticket text]
"""

Common uses include content briefs with a style guide, API documentation with a fixed structure, data analysis with exact output requirements, and code generation that must follow specific conventions.

Strengths:

  • High control and consistent results across many runs.
  • Easy to review and improve, because each requirement is explicit.
  • Works well as a reusable template.

Limitations:

  • Takes time to design and test.
  • Too many rules can make output stiff or cause the model to miss the main goal.
  • Less suited to open-ended creative work.

Tips: use plain, unambiguous language, number the steps, say what to do when information is missing, test with unusual inputs, and refine the spec when outputs drift.

The CRISPE framework

CRISPE is a checklist for building structured prompts. It stands for Capacity and Role, Insight, Statement, Persona and Execution. It combines several of the techniques above into one template, which makes it a good default for complex requests.

  • Capacity and Role: the expertise the model should bring. "Act as a seasoned marketing consultant."
  • Insight: background, data and constraints. "Our product is a refillable cleaning spray; sales are strong online but weak in stores."
  • Statement: the task itself. "Develop three campaign ideas to increase in-store sales."
  • Persona: the audience or perspective. "Target environmentally conscious shoppers in their 20s and 30s."
  • Execution: format, length and style. "For each idea, give a tagline, the core message and two channels, as a bulleted list."

Put together:

Text
Act as a seasoned marketing consultant for consumer goods.

Context: We sell a refillable cleaning spray. Online sales are strong,
but in-store sales are weak. Our budget is modest and we cannot run TV ads.

Task: Develop three campaign ideas to increase in-store sales.

Audience: environmentally conscious shoppers aged 20 to 39 who buy
groceries weekly.

Format: For each idea, give a tagline, the core message, two channels
and one way to measure success. Use a bulleted list, under 250 words total.

The same template works for a lesson plan (role: history teacher; insight: curriculum and class level; statement: a 45-minute lesson; persona: 14-year-olds; execution: outline with objectives and activities) or a business analysis (role: analyst; insight: the data; statement: three recommendations; persona: the leadership team; execution: a short formal report).

Tips: start with the Statement and build the rest around it, skip elements a simple task does not need, and be most detailed in Insight when the task depends on facts the model cannot know.

Output format control

Output format control means telling the model exactly what shape its answer must take: JSON with specific fields, a CSV, a Markdown table, HTML, or a fixed set of headings. It is essential whenever another program or a template will consume the output.

The most reliable approach is to show the exact structure:

Text
Extract every product mentioned in the review below. Return only valid
JSON, with no text before or after it, matching this shape:

{
  "products": [
    {
      "name": "string",
      "sentiment": "positive | negative | neutral",
      "rating": "integer from 1 to 5, or null if not stated"
    }
  ]
}

Review:
"""
[review text]
"""

Other examples:

  • "Return the comparison as a Markdown table with the columns Tool, Price model, Best for."
  • "Output CSV with the header date,amount,category and no other text."
  • "Use exactly these headings: Summary, Risks, Next steps."

Strengths: machine-readable, consistent output with less post-processing, and easy integration into scripts, spreadsheets and APIs.

Limitations: models occasionally break a format, especially long or deeply nested ones, and strict formats leave little room for nuance.

Tips:

  • Give a template or a filled example, not just a description.
  • Use delimiters such as triple quotes or tags to separate instructions from input.
  • State validation rules: allowed values, ranges, required fields.
  • Say what to do with missing data (null, "Unknown", omit the field).
  • Ask the model to check its output against the format before finishing.
  • For production systems, prefer the structured output or function calling features many model APIs provide, and validate the result in code. Repairing broken JSON or checking a pattern against sample data is exactly the kind of job a deterministic tool does better than another model call.

ReAct prompting: reasoning plus actions

ReAct, short for Reasoning plus Acting, has the model alternate between thinking and doing. Each cycle has three parts: a Thought about what to do next, an Action such as a search or a calculation, and an Observation of the result. The observation feeds the next thought, and the loop continues until the model has enough to answer. The technique comes from the 2022 paper "ReAct: Synergizing Reasoning and Acting in Language Models" (Yao et al., Princeton and Google).

A trace for a simple research question looks like this:

Text
Thought: I need the current SSL certificate expiry date for example.com.
I cannot know this from training data, so I should check it.
Action: ssl_check("example.com")
Observation: Certificate valid, issued by a public CA, expires in 41 days.
Thought: I have the answer and it came from a live check.
Answer: The certificate for example.com is valid and expires in 41 days.

A zero-shot ReAct prompt describes the loop and the available actions without examples:

Text
Answer the question by working in steps. For each step write:
Thought: what you need next and why
Action: one of search(query), calculate(expression), or finish(answer)
Observation: the result of the action

Use at most 5 steps. Stop with finish() as soon as you can answer.

Question: Which of our three cloud providers had the lowest total cost
last quarter, based on the invoices in the attached spreadsheet?

ReAct suits research and fact-checking, troubleshooting (read the error, test a hypothesis, try a fix), and decisions that need fresh data, such as comparing hosting providers.

Strengths:

  • Grounds answers in observed results rather than memory, which reduces hallucination.
  • The trace makes the process auditable.
  • Handles multi-step tasks that need outside information.

Limitations:

  • Uses more tokens and more calls.
  • Without real tools behind the actions, the model may simply imagine the observations.
  • Needs guardrails to avoid loops.

Tips: list the allowed actions and their format explicitly, cap the number of steps, define when to stop, and connect real tools for anything beyond experiments. This is the idea behind modern AI agents and tool calling: the model plans, the tools act.

Retrieval-augmented generation (RAG)

Retrieval-augmented generation gives the model relevant documents at the moment it answers. A retrieval step searches a knowledge base (a vector database, a search index or a folder of files) for passages related to the question, and those passages are inserted into the prompt. The model then answers from that material instead of from memory alone. The term comes from a 2020 paper by Lewis et al. at Facebook AI Research.

Even without a full RAG system, you can apply the prompting half by pasting the source material yourself:

Text
Answer the question using only the documents below. Quote or cite the
document number for each claim. If the documents do not contain the
answer, say "Not found in the provided documents."

Document 1:
"""
[text]
"""

Document 2:
"""
[text]
"""

Question: What is our refund policy for annual plans cancelled after 30 days?

Typical uses are support assistants that answer from product documentation, internal knowledge bases, research summaries with citations, and legal or policy work that must reference specific clauses.

Strengths:

  • Answers stay current and can use private information the model never saw.
  • Citations make claims verifiable.
  • No fine-tuning required.

Limitations:

  • Quality depends on retrieval. If the right passage is not found, the answer suffers.
  • Adds infrastructure and latency.
  • Contradictory sources can confuse the model.

Tips: split documents into chunks that keep enough context, combine keyword and semantic search, filter out irrelevant passages, instruct the model to cite sources, and tell it what to do when the answer is not in the material.

Iterative refinement

Iterative refinement treats prompting as a conversation. You start with a reasonable first draft, review it, and then give targeted feedback in follow-up prompts until the result is right. It mirrors how people work with an editor or a colleague, and it is how most high-quality AI-assisted writing and code actually gets made.

A typical sequence:

Text
1. Draft a 600-word blog post introduction about remote onboarding for
   HR managers at mid-sized companies.

2. Good start. Make the opening more concrete: replace the general
   statement with a short scenario of a new hire's first day.

3. Cut the third paragraph; it repeats the second. Add one practical
   checklist item managers can use this week.

4. Now tighten the whole piece to 450 words without losing the scenario
   or the checklist.

Each prompt builds on the previous output and changes one or two things. The same pattern works for code (write the function, then add error handling, then add tests, then optimize), for design briefs, and for research analysis that narrows as findings come in.

Strengths:

  • Higher final quality than a single prompt for complex work.
  • You can correct course early instead of starting over.
  • Breaks large tasks into manageable steps.

Limitations:

  • Takes more time and more calls.
  • Requires your judgment at every step.
  • Very long conversations can lose track of early instructions.

Tips:

  • Start broad, then get specific.
  • Give concrete, actionable feedback ("shorten the second paragraph to two sentences") rather than general criticism ("make it better").
  • Change one or two aspects per round.
  • Restate key requirements when a conversation gets long.
  • Save good intermediate versions, and set a clear stopping point.
  • When a refinement pattern works, turn it into a reusable prompt or template.

Prompting techniques compared

Technique Effort to write Cost per answer Best for Main advantage
Zero-shot Low Low Common, simple tasks Fast, no setup
Few-shot Low to medium Medium Formats, labels, house style Consistent output
Chain-of-thought Low Medium Math, logic, multi-step analysis Fewer reasoning errors, visible logic
Self-consistency Medium High (several runs) Problems with one correct answer More reliable answers through voting
Tree of thoughts High Very high Planning, puzzles, strategy Explores and compares alternatives
Role-based Low Low Expert explanations, reviews Right vocabulary and perspective
Audience targeting Medium Low Marketing, education, UX copy Content fits the reader
Task specification Medium to high Low to medium Production workflows Predictable, reviewable results
CRISPE Medium Low to medium Complex briefs in any domain Complete, unambiguous prompts
Output format control Low to medium Low Data for apps, scripts, tables Machine-readable output
ReAct High High Research, troubleshooting, live data Grounded in real observations
RAG High (needs retrieval) Medium to high Answers from your documents Current, citable answers
Iterative refinement Medium Medium to high Writing, code, design Highest final quality

How to choose a technique

A simple decision path covers most situations:

  1. Start with a clear zero-shot prompt that states the task, context, format and constraints. Many requests end here.
  2. If the format or style is wrong, add examples (few-shot) or a template (output format control).
  3. If the answer needs reasoning, ask for steps (chain-of-thought). If correctness really matters, run it several times and compare (self-consistency).
  4. If there are several plausible approaches and the first is often wrong, explore branches (tree of thoughts).
  5. If the answer depends on expertise or a particular audience, add a role and describe the reader, or use CRISPE to cover everything at once.
  6. If the answer depends on facts the model cannot know, provide documents (RAG) or give it actions with real tools (ReAct).
  7. If it will run repeatedly, turn the prompt into a task specification and test it against edge cases.
  8. For anything long or important, plan on iterative refinement rather than a single perfect prompt.

Combinations are normal. A production prompt might use a role, a task specification, two examples and a JSON template, with chain-of-thought hidden in a reasoning field.

Giving an AI agent real tools

Several techniques above, especially ReAct and output format control, run into the same limit: a language model is good at language but unreliable at exact work. It can describe how to check a DNS record but cannot look one up from memory. It can produce JSON that is almost valid. It can guess what a regular expression matches instead of testing it.

The modern answer is to let the model call tools. The Model Context Protocol (MCP) is an open standard for connecting AI assistants and agents to tools, and an MCP server exposes a set of them through one endpoint. When the model reaches the Action step of a ReAct loop, it calls a real tool and gets a real observation back.

MultitaskAI is a remote MCP server built for this. It gives agents 166 exact tools, including DNS, WHOIS and SSL lookups, JSON repair, regex testing, unit and format conversions, and image resizing, and it works with Claude, ChatGPT, Claude Code, Cursor, VS Code, Windsurf, Gemini CLI, Codex CLI and any other MCP client (see the supported clients). Connectors sign in with OAuth and editors and CLIs use an API key. Every signed-in account gets 100 free requests a day, and the docs show how to connect it.

With tools connected, prompts get simpler and more reliable. Instead of "write a regex for UK postcodes and explain what it matches", you can say "write a regex for UK postcodes and test it against these ten samples", and the agent will actually run the test.

Common prompting mistakes

  • Vague tasks. "Help me with marketing" gives the model nothing to aim at. Name the deliverable.
  • Missing context. The model does not know your product, audience or constraints unless you say so.
  • No format. If you need a table, a word limit or JSON, ask for it.
  • Mixing instructions and input. Separate the material to process from the instructions with quotes or tags, especially when the material itself contains instructions.
  • Too many goals in one prompt. Split complex work into steps or use iterative refinement.
  • Trusting confident answers. Roles and reasoning traces make answers sound authoritative, not necessarily correct. Verify facts, numbers and code.
  • Asking the model to do exact work from memory. Lookups, calculations, validations and conversions belong in tools or code.
  • Never testing the prompt. For anything reused, run it on varied inputs, including awkward ones, before relying on it.

For a broader set of habits, see the prompt engineering best practices guide.

Frequently asked questions

What is the most useful prompt engineering technique?

For everyday work, a clear zero-shot instruction with context and a defined format solves most problems. After that, few-shot examples and chain-of-thought give the biggest improvements for the least effort.

What is the difference between role-based prompting and audience targeting?

A role sets who the model speaks as, such as a senior developer or a dietitian. Audience targeting describes who it speaks to. They work well together: "As a dietitian, explain this to a newly diagnosed patient with no medical background."

Do these techniques work with every model?

The principles apply to ChatGPT, Claude, Gemini and open models alike, but each model responds a little differently. Test important prompts on the model you will actually use, and recheck them when you switch models or versions.

When should I use RAG instead of a long prompt?

If the relevant material fits comfortably in the prompt, paste it in and ask the model to answer only from it. Use a retrieval system when the material is too large, changes often, or has to be searched across many documents.

Is chain-of-thought still needed with reasoning models?

Models that reason internally need less explicit prompting for steps, but asking for a brief justification or a clearly labeled final answer still helps you check the result and makes outputs easier to parse.

Give your agent 433 tools in a minute

Connect MultitaskAI to your MCP client and ask in plain words. 100 requests a day are free.