Prompt Techniques
The Toolbox Every AI Power User Needs
You've learned to talk to AI. You know that being specific matters. But there's a whole level above that β prompt techniques. These are proven strategies that researchers and power users have discovered to get dramatically better results from AI.
Think of it like cooking. Anyone can follow a recipe (basic prompting). But a skilled chef knows techniques β how to sear for a good crust, when to rest meat, how to balance acidity. These techniques work across any recipe. Prompt techniques work across any AI task.
Let's learn the five most powerful ones.
1. Zero-Shot: Just Ask
Zero-shot prompting means giving the AI a task with no examples. You describe what you want, and the AI figures it out from its training.
Classify this movie review as positive or negative: "The acting was wooden and the plot made no sense."
This works surprisingly well for straightforward tasks. The model has seen enough examples during training to understand what "classify as positive or negative" means without you showing it how.
When to use it: Simple, well-defined tasks. Classification, translation, summarization, factual questions. If the task is common and clear, zero-shot often suffices.
2. Few-Shot: Show Me First
Few-shot prompting means giving the AI a few examples of what you want before asking it to do the task. It's like showing someone sample work before asking them to do their own.
Instead of just saying "classify this," you show the AI 2-3 completed examples first:
Review: "Absolutely brilliant, best film of the year" β PositiveReview: "Boring and predictable, waste of time" β NegativeReview: "The acting was wooden and the plot made no sense" β
The AI sees the pattern and follows it. This technique is incredibly powerful because it lets you teach the AI your specific format and your specific standards without any fine-tuning.
When to use it: Tasks with a specific format, unusual classification categories, consistent output structure, or when zero-shot gives inconsistent results.
3. Chain-of-Thought: Think Step by Step
This one is almost magical. Simply adding "Think step by step" or "Let's work through this" to your prompt dramatically improves the AI's reasoning ability. It's called chain-of-thought (CoT) prompting.
Without CoT:
If a shirt costs $25 and is 20% off, and you have a $5 coupon, how much do you pay?
The AI might jump to an answer and get it wrong.
With CoT:
If a shirt costs $25 and is 20% off, and you have a $5 coupon, how much do you pay? Think step by step.
Now the AI will write out: "Step 1: Original price is $25. Step 2: 20% off = $25 Γ 0.80 = $20. Step 3: Apply $5 coupon: $20 - $5 = $15. The answer is $15."
Why does this work? When the AI writes out intermediate steps, each step becomes part of the context for the next step. The model can use its own reasoning as scaffolding. It's like how you solve math problems β writing down work helps you think.
When to use it: Math problems, logic puzzles, multi-step reasoning, coding problems, any task that requires thinking through multiple steps.
4. Role Prompting: Become Someone
Role prompting means telling the AI to act as a specific expert or character. This subtly shifts how the model responds β it draws on the patterns associated with that role.
You are a senior software engineer at Google with 15 years of experience. Review this code for production-readiness.
The AI will now focus on things a senior engineer would care about: error handling, edge cases, performance, security, maintainability. Without the role, it might give a more generic review.
Other examples:
You are a patient kindergarten teacher. Explain quantum physics.β gets simpler, friendlier explanationsYou are a strict academic reviewer. Evaluate this essay.β gets more critical, detailed feedbackYou are a creative writing coach. Help me improve this story.β focuses on narrative, character, and voice
When to use it: When you want a specific perspective, expertise level, or communication style.
5. Output Formatting: Tell the AI What Shape You Want
One of the most practical techniques is explicitly specifying the output format. Most people forget this and then spend time reformatting the AI's response.
Instead of: List some healthy breakfast ideas
Try: List 5 healthy breakfast ideas. For each one, give the name, prep time, and main ingredients in this format:
**[Name]** (prep: X min)
Ingredients: ingredient1, ingredient2, ingredient3
You can ask for:
- JSON β
Return the result as a JSON object with keys: name, age, city - Tables β
Format as a markdown table with columns: Feature, Pros, Cons - Bullet lists β
Give me exactly 5 bullet points, each under 20 words - Code β
Write the solution as a Python function with type hints and a docstring
When to use it: Always. Specifying format is almost always a good idea. It saves you time and makes the AI's output immediately usable.
Prompt Techniques in Python
"You are a math tutor. Solve this problem step by step. Format each step as a numbered list with the calculation shown." Combining techniques is what separates beginners from power users.Choosing the Right Technique
Here's a quick guide for when to use each technique:
- Zero-shot β your default. Try it first. If the task is common (translate, summarize, classify), zero-shot often works great.
- Few-shot β when you need a specific format or the task is unusual. Whenever the AI doesn't "get it" on the first try, show it examples.
- Chain-of-thought β anything involving math, logic, or multi-step reasoning. The magic words "think step by step" cost almost nothing and often dramatically improve accuracy.
- Role prompting β when you need a specific perspective or expertise level. Great for code review, writing feedback, teaching, and creative tasks.
- Output formatting β almost always. Specifying the output format saves you time and makes results more consistent and usable.
Remember: these techniques aren't mutually exclusive. The best prompts often combine two or three of them. A senior engineer (role) who thinks step by step (CoT) and returns structured JSON (formatting) will give you better code reviews than any single technique alone.