Prompt Engineering Fundamentals
The CRAFT framework. Zero-shot, few-shot, and chain-of-thought prompting techniques.
What Is Prompt Engineering?
Prompt engineering is the practice of crafting effective instructions for AI language models to get accurate, useful, and relevant outputs. Think of it as learning to communicate clearly with a highly capable but literal assistant — the quality of what you get out is directly tied to the quality of what you put in.
As AI models like Claude, GPT-4, and Gemini have become more powerful, the skill of writing good prompts has become one of the most valuable abilities in the modern workplace. Whether you're drafting emails, analyzing data, generating reports, or brainstorming ideas, better prompts lead to dramatically better results.
The CRAFT Framework
CRAFT is a structured approach to writing prompts that consistently produce high-quality outputs. Each letter stands for a key element you should consider when writing a prompt. You don't need to use every element in every prompt, but thinking through each one helps you craft more effective instructions.
C — Context
Context is the background information the AI needs to understand your situation. Without context, the AI has to guess about your circumstances, audience, and constraints — and those guesses are often wrong.
Weak prompt:
"Write an email about the project delay."
Strong prompt with context:
"I'm a project manager at a software company. Our mobile app launch has been delayed by 2 weeks due to unexpected QA issues. I need to inform our client, Acme Corp, who has been a partner for 3 years. They're expecting the launch next Friday."
R — Role
Assigning a role tells the AI what perspective or expertise to bring to the task. This shapes the vocabulary, depth, and approach of the response.
Example roles:
- "Act as an experienced marketing strategist."
- "You are a patient math tutor for middle school students."
- "Respond as a senior financial analyst reviewing quarterly earnings."
- "You are a technical writer creating documentation for non-technical users."
A — Action
The action is the specific task you want the AI to perform. Be explicit and precise about what you want. Vague actions lead to vague outputs.
Vague action:
"Help me with my presentation."
Specific action:
"Create an outline for a 15-minute presentation with 8–10 slides. Include speaker notes for each slide and suggest one data visualization per section."
F — Format
Format tells the AI how to structure the output. This is one of the most impactful elements because it determines whether the response is immediately usable or requires heavy editing.
Common format instructions:
- "Format as a numbered list with bold headers."
- "Present this as a comparison table with pros and cons."
- "Write this as a 3-paragraph executive summary, no more than 200 words."
- "Structure as: Problem → Analysis → Recommendation → Next Steps."
- "Output as JSON with keys for name, category, and priority."
T — Tone
Tone sets the voice and style of the response. The same information can be delivered in wildly different ways depending on tone, so matching tone to your audience is critical.
Tone examples:
- "Use a professional but approachable tone, as if writing to a colleague."
- "Keep the language simple and jargon-free — this is for a general audience."
- "Write in a formal, academic style with citations."
- "Be concise and direct. No filler. Every sentence should carry weight."
Prompting Techniques
Zero-Shot Prompting
Zero-shot prompting means asking the AI to perform a task without providing any examples. You rely entirely on the model's training to understand what you want. This works well for straightforward tasks where the expectation is clear.
Zero-shot example:
"Classify the following customer review as positive, negative, or neutral: 'The product arrived on time but the packaging was damaged. The item itself works fine though.'"
Zero-shot works best when the task is common (summarization, classification, translation), the desired output format is obvious, and you don't need the AI to follow a specific pattern.
Few-Shot Prompting
Few-shot prompting means providing one or more examples before asking the AI to perform the task. The examples teach the model the pattern, format, and style you expect. This is one of the most powerful techniques available because it lets you "show, not tell."
Few-shot example:
"Convert these product descriptions into one-line taglines:
Product: A lightweight laptop with 20-hour battery life and a carbon fiber body.
Tagline: Power that goes the distance. Impossibly light.
Product: Noise-canceling headphones with spatial audio and 40-hour battery.
Tagline: Silence the world. Hear everything.
Product: A smart water bottle that tracks hydration and syncs with fitness apps.
Tagline:"
Chain-of-Thought Prompting
Chain-of-thought (CoT) prompting asks the AI to show its reasoning step by step before arriving at an answer. This dramatically improves accuracy for tasks that require logic, math, analysis, or multi-step reasoning.
Without chain-of-thought:
"A store has 45 apples. They sell 60% on Monday and half the remaining on Tuesday. How many are left?"
With chain-of-thought:
"A store has 45 apples. They sell 60% on Monday and half the remaining on Tuesday. How many are left? Think through this step by step, showing your work at each stage before giving the final answer."
The magic phrase is often as simple as adding "Think step by step" or "Let's work through this reasoning carefully." Research from Google and others has shown that chain-of-thought prompting can significantly boost accuracy on reasoning tasks.
System Prompts vs User Prompts
When using AI tools through their APIs or advanced interfaces, you'll encounter two types of prompts:
System Prompt
Sets the overall behavior, personality, and constraints for the AI. Think of it as the "job description" given before the conversation starts.
- Defines the AI's role and persona
- Sets rules and guardrails
- Persists across the entire conversation
- Usually hidden from the end user
User Prompt
The actual message or question sent by the user during the conversation. This is the turn-by-turn input.
- Contains the specific request or question
- Changes with every message
- Provides task-specific context
- Visible to the user
Prompt Template Library
Here are reusable templates you can adapt for common tasks. Copy them, fill in the brackets, and customize as needed.
Template 1: Content Creation
You are a [ROLE, e.g., content strategist]. I need to create [CONTENT TYPE, e.g., a blog post] about [TOPIC]. Audience: [DESCRIBE TARGET AUDIENCE] Goal: [WHAT SHOULD THE READER DO/FEEL/KNOW AFTER?] Length: [WORD COUNT OR SECTION COUNT] Tone: [PROFESSIONAL / CASUAL / ACADEMIC / ETC.] Please include: - A compelling headline and subheadline - An engaging opening hook - [NUMBER] main sections with headers - A clear conclusion with a call to action Avoid: [ANY TOPICS, WORDS, OR APPROACHES TO SKIP]
Template 2: Analysis and Decision Making
I need to make a decision about [DESCRIBE DECISION]. Here is the context: - Current situation: [DESCRIBE] - Constraints: [BUDGET, TIME, RESOURCES] - Stakeholders: [WHO IS AFFECTED] - Goals: [WHAT SUCCESS LOOKS LIKE] Please analyze this by: 1. Identifying the top 3–5 options 2. Listing pros and cons for each 3. Rating each option on feasibility, impact, and effort (1–5 scale) 4. Recommending the best option with reasoning 5. Outlining 3 immediate next steps Present as a structured comparison table followed by your recommendation.
Template 3: Learning and Research
I want to understand [TOPIC] at a [BEGINNER / INTERMEDIATE / ADVANCED] level. My background: [RELEVANT EXPERIENCE OR KNOWLEDGE] My goal: [WHY I'M LEARNING THIS] Time available: [HOW DEEP TO GO] Please: 1. Start with a one-paragraph overview 2. Explain the 3–5 most important concepts 3. Use analogies to explain complex ideas 4. Provide a real-world example for each concept 5. End with 3 questions I should explore next 6. Recommend 2–3 resources for further learning If I have misconceptions based on what I've said, please correct them.
Template 4: Email and Communication
Write a [TYPE: email / Slack message / memo] to [RECIPIENT AND RELATIONSHIP]. Purpose: [WHAT I NEED TO COMMUNICATE] Key points to include: - [POINT 1] - [POINT 2] - [POINT 3] Tone: [FORMAL / FRIENDLY / URGENT / DIPLOMATIC] Length: [BRIEF (2–3 sentences) / MEDIUM (1–2 paragraphs) / DETAILED] Call to action: [WHAT I WANT THEM TO DO NEXT] Additional context: [ANY SENSITIVE ASPECTS OR RELATIONSHIP DYNAMICS]
Template 5: Meeting Preparation
Help me prepare for a meeting about [TOPIC]. Meeting details: - Attendees: [WHO WILL BE THERE AND THEIR ROLES] - Duration: [LENGTH] - My role: [PRESENTER / PARTICIPANT / FACILITATOR] - Objective: [WHAT SHOULD THE MEETING ACCOMPLISH] Please create: 1. A structured agenda with time allocations 2. 3 key talking points I should raise 3. Potential questions I might be asked, with suggested answers 4. A one-page pre-read summary I can send to attendees 5. Follow-up action item template
Common Prompting Mistakes
| Mistake | Why It's a Problem | Fix |
|---|---|---|
| Being too vague | The AI fills in gaps with assumptions that may not match your needs | Be specific about what you want, for whom, and in what format |
| Overloading a single prompt | Asking for too many things at once leads to shallow treatment of each | Break complex tasks into sequential prompts (prompt chaining) |
| Not iterating | Accepting the first response even when it's not quite right | Refine your prompt based on what was missing or wrong in the output |
| Ignoring the audience | The AI defaults to a generic tone that may not suit your readers | Always specify who the output is for |
| Skipping format instructions | You get a wall of text instead of a structured, usable output | Tell the AI exactly how to structure the response |
| Not providing enough context | The AI produces generic content that doesn't fit your specific situation | Include relevant background, constraints, and goals |
Resources
Prompt Engineering Guide
Anthropic
Anthropic's official guide to prompt engineering with Claude, covering techniques from basic to advanced with practical examples.
Prompt Engineering Best Practices
OpenAI
OpenAI's guide to getting better results from their models, with strategies and tactics for effective prompting.
ChatGPT Prompt Engineering for Developers
DeepLearning.AI
A free short course by Isa Fulford (OpenAI) and Andrew Ng covering prompt engineering principles and best practices.
Key Takeaways
- 1The CRAFT framework (Context, Role, Action, Format, Tone) provides a reliable structure for writing effective prompts.
- 2Zero-shot works for simple tasks; few-shot prompting with examples dramatically improves consistency for complex or nuanced tasks.
- 3Chain-of-thought prompting — asking the AI to think step by step — significantly improves accuracy on reasoning and multi-step problems.
- 4System prompts set persistent behavior and rules; user prompts contain specific turn-by-turn requests.
- 5Prompt templates save time and ensure consistency — build a personal library of templates for your recurring tasks.
- 6Always iterate on your prompts. The first draft is rarely the best version.
Test Your Understanding
Module Assessment
5 questions · Score 70% or higher to complete this module
You can retake the quiz as many times as you need. Your best score is saved.