Get Better AI Results: 5 Prompting Techniques Explained

✍️ What is Prompting?
Imagine you walk into a restaurant and say:
Give me food.
The waiter will look confused. What cuisine? Veg or non-veg? Spicy or mild? How hungry are you?
Now instead, you say:
I’d like one plate of paneer tikka, medium spicy, with garlic naan on the side.
Suddenly — perfect service 🚀.
That’s prompting. The AI is your waiter. The better you explain what you want, the better it serves you.
🧠 In AI terms:
Prompt = Your request (“What you say”)
Output = AI’s response (“What it gives you back”)
Prompting = The art of making that request clear, complete, and purposeful
It’s not magic. It’s communication.
💡 Why Smart Prompting Matters (and How GIGO Can Ruin It)
Think of AI like a high-performance car — Ferrari-level smart. But here’s the catch: you’re the driver.
If you don’t know where you’re going or how to steer, even the Ferrari won’t help.
That’s the GIGO trap — Garbage In, Garbage Out.
🧃 Example:
You walk into a coffee shop and say:
“Give me a drink.”
The barista shrugs and hands you a random bitter espresso.
You hate it. That’s GIGO — vague input → disappointing output.
Now try this:
I’d like a medium iced caramel latte with oat milk — no whipped cream.
Boom 💥 — perfect drink, first try.
🧰 Prompting Techniques — From Basic to Smart
Not all prompts are created equal. Here are 5 prompting techniques — that help you guide AI like a pro:
1. 🥚 Zero-Shot Prompting
"Just ask the question — no context, no examples."
This is the most basic form of prompting. You ask the AI to do something directly, without giving it prior examples or steps.
Example:
Explain what blockchain is in simple words.
When to use it: For basic facts, summaries, or direct answers.
2. ✌️ Few-Shot Prompting
"Show a few examples, then ask the AI to follow the pattern."
Here, you give the model 2–3 examples of what you want before asking it to generate a similar output.
💡 Example:
Q: What’s the capital of France?
A: Paris
Q: What’s the capital of Germany?
A: Berlin
Q: What’s the capital of Japan?
A:
When to use it: When you want consistent formatting or behavior across outputs.
3. Chain-of-Thought Prompting (CoT)
This technique asks the AI to think out loud — breaking down its reasoning step by step instead of jumping straight to the final answer.
Just like how humans solve problems:
We first read, then understand, then work through the steps, and finally double-check before answering.
In CoT, we guide the model to do the same:
Analyse → Think → Output → Validate → Result
💡 Example:
If a pen costs ₹10 and a notebook costs ₹40, and you buy 2 pens and 1 notebook, how much do you spend? Let’s solve this step by step.
The AI will now break it down like:
2 pens = ₹20
1 notebook = ₹40
Total = ₹60 ✅
✅ Why this works better:
Helps AI make fewer mistakes
Makes reasoning more transparent
Slightly longer outputs — but much smarter ones
4. Self-Consistency Prompting
This technique focuses on improving accuracy by asking the AI to generate multiple responses to the same question — then letting it compare those responses to pick the most reliable one.
Think of it like getting a second, third, and fourth opinion — and then choosing the smartest answer.
💡 Example:
Imagine you’re stuck on a tricky math problem.
Instead of solving it once, you try three different methods, then review all the answers to see which one makes the most sense.
That’s exactly what Self-Consistency Prompting does — just with AI doing the heavy lifting.
⚠️ Things to keep in mind:
⏱️ Slower – It runs multiple completions
💸 Costlier – More tokens = more compute = more $$
🧠 Best used when correctness matters more than speed
✅ Why use It?
🎯 Better accuracy – Reduces random or flaky outputs
🔍 Deeper reasoning – AI explores multiple paths to a solution
💬 More confidence – Especially for complex logic, math, or reasoning tasks
5. Persona-Based Prompting
This technique guides the AI to take on a specific role or personality — like a teacher, doctor, CEO, mentor, or even a sarcastic best friend.
It’s not just about what you ask, but who the AI becomes while answering. This controls tone, depth, and style.
🛠️ How it works:
You define the role in the prompt:
Act as a coding mentor.
You’re a friendly therapist.
Speak like a strict but caring school teacher.
It often combines with few-shot prompting to help the AI stick to the persona — especially when aiming for consistent tone and behavior.
💡 Example:
You are a senior web developer. Review this React code and explain it like you're teaching a junior dev.
✅ Great for:
🎓 Custom learning bots
📢 Brand voice assistants
💼 Chatbots with personality
💡 I built a chatbot that talks just like Hitesh Choudhary — using this exact technique. You can check out my full blog about it here.
Happy prompting! 🚀
Subscribe to my newsletter
Read articles from Yash Mantri directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Yash Mantri
Yash Mantri
An engineer by profession and a JavaScript Lover by heart. First and foremost, I love writing code. Ever since writing my first program in C and manipulating it to produce the desired output. I believe in the power of programming to transform and improve the lives of people around the world. My curiosity levels are as fresh as when I was a child. I believe in eternal learning and deliberate effort as they are the only way to become the smartest in the room. I am a good timekeeper, always willing to learn new skills and use them in real-life problems. An ambitious individual with a desire to succeed. A Cricket fanatic. A student who likes to take risks and does not shy away from experimenting with various combinations in life. Striving to do a lot. Wish me good luck 🙏🏼 My primary interest is in Web Development and Mobile Application Development. Tech Stack:- ReactJS, NextJS, NodeJS, MongoDB, GraphQL, Javascript Version Control:- Git, Gitlab