Prompting Techniques

Core Prompting Techniques

Prompting techniques are structured ways of writing instructions for an AI model (such as Claude, ChatGPT or Gemini) so that you get accurate, useful and consistent answers. The same model can give a weak answer or an excellent one depending entirely on how you ask. This guide explains the most important techniques, when to use each one, and shows copy-and-paste examples.

Table of Contents

What Is Prompt Engineering?

A prompt is the text you give an AI model. Prompt engineering is the practice of designing that text carefully: choosing the right words, context, examples and format so the model understands exactly what you want. Think of the model as a very capable new colleague who knows nothing about your situation. The more clearly you brief them, the better the work they hand back.

Good prompting does not require coding skills. It requires clarity, context and a willingness to test and improve.

Anatomy of a Good Prompt

Most strong prompts contain some or all of these building blocks:

  • Role: who the model should act as.
  • Task: what exactly needs to be done.
  • Context: background information, audience, purpose.
  • Constraints: length, tone, things to include or avoid.
  • Examples: samples of the input and the desired output.
  • Output format: list, table, JSON, essay, HTML and so on.

1. Clear and Specific Instructions

This is the foundation of every other technique. Vague prompts produce vague answers. State the task, the audience, the length and the goal.

Weak prompt

Write about climate change.

Strong prompt

Write a 300-word explanation of how climate change affects crop yields
in India, for high-school students. Use simple language, include two
real-world examples, and end with one question for class discussion.
Tip: Tell the model what to do, not only what to avoid. "Write in short, plain sentences" works better than "Don't be complicated".

2. Role (Persona) Prompting

Assigning a role steers the model's vocabulary, depth and perspective. A "senior tax accountant" answers differently from a "friendly teacher".

You are an experienced career coach who helps fresh graduates.
Review my resume summary below and suggest three specific improvements.
Be encouraging but honest.

Resume summary: "Hardworking graduate looking for a job in IT."

Best for: writing style, domain-specific advice, tone control, simulations and role-play practice.

3. Zero-Shot Prompting

You give the instruction with no examples, relying on what the model already knows. It is the fastest approach and works well for common, well-defined tasks.

Classify the sentiment of this review as Positive, Negative or Neutral:
"The delivery was late, but the product quality is fantastic."

Use when: the task is simple and standard (summaries, translations, basic classification).
Limitation: results can be inconsistent for unusual formats or niche tasks. That is where few-shot helps.

4. Few-Shot Prompting

You include a handful of examples (usually 2 to 5) that show the exact pattern you want. The model imitates the pattern. One example is called one-shot; several are few-shot.

Convert each product name into a catchy tagline.

Product: Reusable water bottle
Tagline: Sip smart. Waste less.

Product: Noise-cancelling headphones
Tagline: Silence the world. Hear yourself.

Product: Standing desk
Tagline:
Tips for good examples:
  • Keep them diverse so the model does not copy a single narrow pattern.
  • Keep the format identical across examples.
  • Include edge cases if they matter.
  • Wrapping examples in labels such as <example> tags makes them easy to separate from instructions.

5. Chain-of-Thought (CoT) Prompting

You ask the model to reason step by step before giving the final answer. This sharply improves accuracy on maths, logic, planning and multi-step analysis, because the model works through intermediate steps instead of jumping to a conclusion.

A shop sells pens at 12 rupees each. Buying 10 or more gives a 15% discount
on the total. How much do 14 pens cost?

Think through this step by step, then give the final answer on its own line.

Variants

  • Zero-shot CoT: simply add "Let's think step by step."
  • Few-shot CoT: provide examples that include the reasoning, not just the answers.
  • Structured thinking: ask for reasoning inside one section and the final answer in another, so you can read or hide either.
Note: Some newer models reason internally by default. In that case a short instruction like "Explain your reasoning briefly" is usually enough. Always test on your own task.

6. Self-Consistency

Instead of trusting one reasoning path, you generate several independent answers to the same question and pick the most common result (majority vote). It reduces random errors in tricky reasoning problems.

Solve the problem below in three different ways, showing the full working
for each. Then compare the three results and state which answer is most
likely correct and why.

Problem: [paste problem here]

Best for: maths, logic puzzles, estimations and any task where a wrong answer is costly.

7. Tree of Thoughts

An extension of chain-of-thought where the model explores multiple branches of ideas, evaluates each, discards weak ones and continues with the best. It mimics how people brainstorm and then decide.

I want to increase traffic to my cooking blog.
1. Propose three distinct strategies.
2. For each strategy, list its pros, cons, cost and time needed.
3. Score each from 1 to 10 for expected impact.
4. Pick the best strategy and expand it into a 30-day action plan.

Best for: planning, strategy, creative problem solving and decisions with trade-offs.

8. ReAct (Reason + Act)

ReAct combines reasoning with actions such as searching the web, running code or calling a tool. The model alternates: think, act, observe the result, think again. It is the backbone of many AI agents.

Thought: I need the current population of Pune.
Action: Search["Pune population latest census estimate"]
Observation: [search result appears here]
Thought: Now I can compare it with Nagpur's population.
Action: Search["Nagpur population latest census estimate"]
Observation: [search result appears here]
Final Answer: ...

Best for: tasks that need fresh facts, calculations or external tools, and for reducing made-up answers.

9. Prompt Chaining

You split a big job into a sequence of smaller prompts, feeding each output into the next. Each step is simple and focused, so quality is higher and errors are easier to find.

Example: writing a blog post

  1. Prompt 1: "Give me 10 blog topic ideas about healthy breakfast for busy professionals."
  2. Prompt 2: "Create a detailed outline for topic #4."
  3. Prompt 3: "Write the introduction and first section using this outline."
  4. Prompt 4: "Review the draft for clarity and suggest an SEO title and meta description."
Tip: Chaining is the best cure for prompts that have become long and confusing. If a prompt asks for five different things, consider five prompts.

10. Structured Prompts and Delimiters

When a prompt mixes instructions, documents and examples, the model can confuse them. Use clear separators such as headings, triple quotes, or XML-style tags to label each part.

<instructions>
Summarize the article in exactly three bullet points for a busy manager.
</instructions>

<article>
[paste article text here]
</article>

<format>
Plain text bullets. Maximum 20 words each.
</format>

This also protects against accidental instruction mix-ups when the pasted text itself contains commands or questions.

11. Output Format Control

Tell the model exactly how the answer should look. This is essential when the output feeds into a spreadsheet, a website or another program.

Extract the details from the email below and return ONLY valid JSON with
these keys: name, phone, city, requested_date.
If a value is missing, use null. Do not add any explanation.

Email: "Hi, I'm Rohit from Jaipur. Please call me on 98xxxxxx10 to book a slot."

Other formats you can request: Markdown tables, numbered steps, CSV, HTML, "no more than 100 words", "reading level of a 10-year-old", and so on.

12. Step-Back Prompting

Before answering a specific question, the model first asks a broader, more general question about the underlying principle, then uses that to answer. This avoids getting lost in details.

Question: Why does my sourdough bread come out dense?

First, step back: list the key scientific principles that decide how bread
rises and develops its crumb. Then use those principles to diagnose the most
likely causes for my dense loaf and suggest fixes.

Best for: science, troubleshooting and any problem where the right principle matters more than the surface details.

13. Generated Knowledge Prompting

You first ask the model to write down relevant facts or background, and then ask it to answer using that knowledge. This works like a quick research step before writing.

Step 1: List 8 important facts about drip irrigation and its benefits
for small farms.
Step 2: Using only those facts, write a short persuasive pitch for farmers
in a drought-prone region.
Caution: Models can state wrong "facts" confidently. For anything important, verify the generated knowledge or supply trusted sources yourself (see RAG below).

14. Self-Refine and Reflection

You ask the model to produce an answer, critique it, and then improve it. Using a second pass catches errors, weak arguments and missing points.

1. Write a 150-word product description for a handmade leather wallet.
2. Critique your own draft: identify three weaknesses in clarity, tone
   or persuasion.
3. Rewrite the description fixing those weaknesses.
Show only the final improved version.

Best for: writing, code review, essays, email drafts and quality checks.

15. Meta Prompting

You ask the AI to write or improve the prompt itself. This is handy when you are not sure how to phrase a request.

I want an AI assistant to help me plan weekly meals for a family of four
on a budget. Ask me the questions you need, then write the best possible
prompt I can reuse every week for this task.

You can also paste an existing prompt and say: "Improve this prompt to make it clearer and more likely to give consistent results. Explain your changes."

16. Retrieval-Augmented Prompting (RAG)

You give the model your own trusted documents or data inside the prompt and instruct it to answer only from them. This keeps answers accurate, current and specific to your situation, and greatly reduces invented information.

Answer the question using ONLY the policy text below. If the answer is not
in the text, reply "Not found in the policy."

<policy>
[paste company leave policy here]
</policy>

Question: How many casual leaves can I carry forward to next year?

Large systems automate this by searching a document database and inserting the most relevant passages into the prompt, but you can do the same manually by pasting text.

17. Iterative Refinement

The first answer is rarely the final one. Treat prompting as a conversation: review the output, then give targeted feedback.

  • "Make it shorter and more conversational."
  • "Keep paragraph 2, but replace the examples with ones from healthcare."
  • "This is too formal. Rewrite it as if talking to a friend."
  • "You missed the budget constraint. Redo the plan under 20,000 rupees."

Specific feedback beats "try again". Note which instructions improved the result and save them in your own prompt library.

Comparison Table: Which Technique Should I Use?

TechniqueBest ForEffortKey Benefit
Clear instructionsEverythingLowRemoves ambiguity
Role promptingTone, expertise, styleLowFocused perspective
Zero-shotSimple, common tasksVery lowSpeed
Few-shotCustom formats, patternsMediumConsistency
Chain-of-thoughtMaths, logic, analysisLowAccuracy
Self-consistencyHigh-stakes reasoningMediumFewer random errors
Tree of thoughtsStrategy, planningHighExplores alternatives
ReActTool use, researchHighGrounded in real data
Prompt chainingLarge, multi-part workMediumQuality and control
Delimiters / structureLong, mixed promptsLowClarity
Output format controlData extraction, appsLowUsable output
Step-backPrinciple-driven problemsLowBetter reasoning
Self-refineWriting and reviewLowPolished results
Meta promptingCreating reusable promptsLowSaves time
RAGFact-sensitive answersMediumAccuracy, fewer fabrications

Common Mistakes to Avoid

  1. Being vague: "Make it better" does not say better in what way.
  2. Overloading one prompt: too many unrelated tasks lower quality. Split them.
  3. Skipping context: the model does not know your audience, goal or constraints unless you say so.
  4. Contradicting yourself: "Be detailed but keep it very short" confuses the output.
  5. Trusting blindly: always verify facts, figures, quotes and code before publishing or using them.
  6. Sharing sensitive data: never paste passwords, private customer data or confidential documents into a tool you do not trust.
  7. Giving up after one try: refine and re-run. Small wording changes can make a large difference.

A Reusable Master Template

Copy this structure and fill in the brackets for almost any task:

ROLE: You are a [role/expert].

TASK: [Clearly describe what you want done.]

CONTEXT: [Background, audience, goal, any relevant details.]

CONSTRAINTS:
- Length: [e.g. 200 words]
- Tone: [e.g. friendly and professional]
- Must include: [...]
- Must avoid: [...]

EXAMPLES (optional):
Input: [...]
Output: [...]

OUTPUT FORMAT: [e.g. bullet list / table / JSON / HTML]

Before answering, think step by step. If anything is unclear,
ask me questions first.

Final Checklist

  • ☐ Is the task stated clearly and specifically?
  • ☐ Did I give enough context about audience and purpose?
  • ☐ Did I set the length, tone and format?
  • ☐ Would an example help the model understand the pattern?
  • ☐ Is this a complex problem that needs step-by-step reasoning?
  • ☐ Should I break it into smaller prompts?
  • ☐ Have I verified the facts in the answer?
  • ☐ Did I refine the result with follow-up feedback?

Conclusion

Prompt engineering is less about secret tricks and more about clear communication. Begin with clear instructions, add role and context, use examples when the pattern matters, ask for step-by-step reasoning on hard problems, and always iterate. As you practise, you will build your own library of prompts that save hours of work every week.

Found this guide useful? Share it with a friend and tell us in the comments which prompting technique worked best for you!

Post a Comment

0 Comments