⚡
AI Learning
Prompt Engineering Cheat Sheet
Every prompt technique you need — chain-of-thought, few-shot, role-based, structured outputs and more.
Back to Notes Library
Prompt Engineering Cheat Sheet
Core Techniques
1. Role-Based Prompting
text
You are a [ROLE] with expertise in [DOMAIN].
[Your task here]2. Chain-of-Thought (CoT)
text
Think through this step by step:
1. First, analyze...
2. Then, consider...
3. Finally, conclude...3. Few-Shot Prompting
text
Input: [example 1 input]
Output: [example 1 output]
Input: [example 2 input]
Output: [example 2 output]
Input: [your actual input]
Output:4. Structured Output
text
Return the result as JSON:
{
"field1": "value",
"field2": ["item1", "item2"]
}5. Negative Prompting
text
Do NOT use: [word/phrase/format]
Avoid: [thing to avoid]
Never: [absolute constraint]Quick Templates
| Use Case | Prompt Starter |
|---|---|
| Writing | "You are an expert writer. Write a..." |
| Code | "You are a senior developer. Write clean..." |
| Research | "Act as a research analyst. Analyze..." |
| Teaching | "Explain [topic] to a 10-year-old..." |
| Review | "Review this and provide detailed feedback on..." |
| Summary | "Summarize the following in 3 bullet points..." |
| Debug | "Debug this code and explain the issue..." |
The Perfect Prompt Formula
text
[ROLE] + [CONTEXT] + [TASK] + [FORMAT] + [CONSTRAINTS]Example:
text
You are a senior Python developer (ROLE).
I have a Flask REST API with slow endpoints (CONTEXT).
Refactor the code below to use async/await (TASK).
Return the full updated code with comments (FORMAT).
Keep the same function signatures (CONSTRAINTS).Power Modifiers
- More creative: imagine, envision, creatively explore, think outside the box
- More precise: exactly, specifically, precisely, word for word
- More structured: step-by-step, systematically, in order, as a numbered list
- More critical: challenge, critique, find flaws in, devil's advocate
- More concise: in one sentence, in under 100 words, briefly
Advanced Techniques
ReAct Prompting
text
Think: [reasoning step]
Act: [action to take]
Observe: [what you see]
Think: [next reasoning step]
Answer: [final answer]Persona Stacking
text
You are a debate panel with 3 experts:
- Expert A (optimist): argues FOR the idea
- Expert B (critic): argues AGAINST the idea
- Expert C (neutral): provides balanced analysis
Discuss: [topic]Self-Consistency
text
Generate 3 different approaches to solve this problem.
Then select the best approach and explain why.
Problem: [your problem]Common Mistakes to Avoid
- Being too vague: "write something about AI"
- No context: just pasting code without explanation
- No format specified: AI gives walls of text
- Too many tasks at once: combine 5 requests in 1 prompt
- Not iterating: accepting first response without refinement
10K+ Members Growing Daily
Get Free AI Notes Daily
Join AiTechWorlds on Telegram and get daily AI tips, prompt engineering templates, coding resources, and exclusive content — 100% free!
📚 Free Study Notes🤖 AI Tips Daily⚡ Prompt Templates💻 Coding Resources
Join Free Channel
No spam. Leave anytime.