Prompt Engineering 101: Write Better AI Prompts in 5 Minutes
Master the art of prompt engineering with practical examples for ChatGPT, Gemini, and Claude. Learn the CRAFT framework (Context, Role, Action, Format, Tone) for consistent results.
What Is Prompt Engineering?
Prompt engineering is the skill of communicating effectively with AI systems. Think of it like learning to use a search engine – early Google users who mastered query syntax got vastly better results than those who typed casually. Same with AI: the quality of your output depends directly on the quality of your input.
The good news: You dont need a technical background. Prompt engineering is part logic, part psychology, and part clear writing. Anyone can learn it in under an hour, and master it with a week of practice.
The better news: A well-engineered prompt can turn a mediocre AI response into an outstanding one – often the difference between useless output and exactly what you needed.
The CRAFT Framework
CRAFT is a simple mnemonic for structuring effective prompts:
Context (Background information)
- Who are you? What's the situation?
- What does the reader/listener already know?
- Example: I'm a marketing manager at a 20-person B2B SaaS startup selling to HR directors...
Role (Who should the AI act as?)
- Define expertise level and perspective
- Example: You are a senior copywriter with 15 years of experience writing B2B SaaS landing pages...
Action (What specifically should it do?)
- Clear verb-driven instruction
- Example: Write a cold outreach email that... or Analyze this data and... or Debug this code by...
Format (How should the output look?)
- Structure, length, medium
- Example: Output as a table with columns for Strategy, Effort, and Impact or Keep under 200 words with bullet points
Tone (What voice/style?)
- Formal/casual/professional/friendly/technical
- Example: Tone: authoritative but approachable. Avoid jargon unless necessary.
Full CRAFT example:
[Context] I'm preparing for a job interview at Google for a Product Manager role.
[Role] Act as a former Google PM who conducted 100+ interviews.
[Action] Generate 10 likely interview questions with model answers.
[Format] Table format: Question | Model Answer | What they're really testing | Difficulty (1-5)
[Tone] Insightful, honest, slightly informal (like a mentor talking).
Chain-of-Thought Prompting
For complex problems, ask the AI to think step by step:
Basic: What's 17 x 23?
(Answer might be wrong or lack working)
Chain-of-thought: What's 17 x 23? Think step by step and show your work.
(AI breaks it down: 17*20=340, 17*3=51, 340+51=391)
When to use:
- Math and logic problems
- Multi-step analysis
- Debugging code
- Planning and strategy
- Any task where intermediate reasoning matters
Magic phrases:
- Think step by step
- Let's work through this systematically
- First..., then..., finally...
- Before concluding, consider...
Research shows chain-of-thought prompting improves accuracy on complex reasoning tasks by 40-70%.
Few-Shot Prompting
Show the AI examples of what you want, then ask it to continue:
Zero-shot (no examples):
Classify the sentiment of: 'This movie was amazing!'
(→ Might work, might not)
One-shot (one example):
Classify sentiment:
'This movie was amazing!' → Positive
'The service was terrible' → ?
(→ Will correctly answer Negative)
Few-shot (multiple examples):
Classify sentiment:
'I loved every minute' → Positive
'Total waste of money' → Negative
'It was okay, nothing special' → Neutral
'Disappointed but hopeful' → ?
(→ Correctly identifies nuanced sentiment)
Rule of thumb: The more examples you provide, the more precisely the AI matches your desired output format and quality. Three examples is usually enough to establish a pattern.
Specific Techniques by Use Case
For Writing:
- Give samples of writing style you admire
- Specify audience reading level (explain to a 10-year-old)
- Request iterative refinement: Draft 1, then I'll give feedback
For Coding:
- Include language version: Python 3.11+, use type hints
- Specify constraints: Under 50 lines, O(n) time complexity
- Show input/output examples
- Ask for comments in the code
For Analysis/Data:
- Define the exact output format (Markdown table, JSON, CSV)
- Specify which insights matter most
- Ask for confidence levels on conclusions
- Request visualization descriptions
For Creative Tasks:
- Set constraints to boost creativity (Haiku about coffee, no letter 'e')
- Ask for multiple options: Give me 5 different approaches
- Combine unrelated concepts: Steampunk version of smartphone UX
- Use temperature/creativity parameters if available
Common Mistakes to Avoid
| Mistake | Problem | Fix |
|---|---|---|
| Too vague | Generic, useless output | Be specific about what you want |
| One giant prompt | AI loses focus mid-way | Break into sub-tasks |
| No examples | Output format surprises you | Provide 2-3 examples |
| Ignoring first draft | First response is rarely best | Iterate: Make it shorter/more detailed/different tone |
| Over-constraining | AI can't be creative | Give room for interpretation |
| Not specifying format | Gets verbose wall of text | Explicitly request bullets/table/code |
| Assuming context | AI doesn't know your situation | Provide relevant background |
| Accepting blindly | AI can hallucinate | Fact-check critical claims |
Prompt Templates Library
Email/Draft Template:
Write a [TYPE] email to [AUDIENCE] about [TOPIC].
Tone: [FORMAL/CASUAL]. Length: [WORD COUNT].
Key points to include: [POINT 1], [POINT 2], [POINT 3].
Call to action: [CTA].
Learning Template:
Explain [CONCEPT] like I'm a [LEVEL: beginner/advanced].
Use analogy to [FAMILIAR THING].
Include: definition, why it matters, practical example, common mistake.
Keep it under [WORD COUNT].
Code Template:
Write [LANGUAGE] code to [TASK].
Requirements: [REQ 1], [REQ 2], [REQ 3].
Include error handling and comments explaining logic.
Input: [EXAMPLE INPUT]
Expected output: [EXAMPLE OUTPUT]
Analysis Template:
Analyze [DATA/SITUATION].
Focus on: [ASPECT 1], [ASPECT 2], [ASPECT 3].
Format: [TABLE/BULLET POINTS/NUMBERED LIST]
Include: key finding, implication, recommendation.
Confidence level for each conclusion.
Creative Template:
Generate [NUMBER] creative ideas for [GOAL].
Constraints: [CONSTRAINT 1], [CONSTRAINT 2].
Target audience: [AUDIENCE].
Style: [STYLE REFERENCE].
Make one idea unconventional/surprising.
Practice Exercises
- Exercise 1: Take a prompt you'd normally type (e.g., write a blog post about AI) and rewrite it using the full CRAFT framework. Compare outputs.
- Exercise 2: Give the same task to ChatGPT 3 times with different roles (You are a 5-year-old, You are a Harvard professor, You are a sci-fi novelist). See how role affects output.
- Exercise 3: Take a complex question and solve it twice – once with and once without think step by step. Note the difference in accuracy and depth.
- Exercise 4: Write a prompt that produces terrible output. Then fix it using techniques from this guide. This teaches you what NOT to do.
- Exercise 5: Build your own template library. Every time you write a prompt that produces great results, save it as a template for future use.
Conclusion
Prompt engineering isn't about memorizing tricks – it's about learning to communicate clearly and specifically. The CRAFT framework (Context, Role, Action, Format, Tone) handles 90% of situations. Chain-of-thought handles complexity. Few-shot examples ensure consistency. Master these three techniques and you'll get reliably excellent results from any AI tool. The investment of one hour learning this skill pays returns every single day you use AI.