Week 2 • Lesson 6 of 6 • 45 mins
Prompt Engineering Fundamentals Deep Dive
The foundational techniques that every AI user should master.
Prompt Engineering: The Core Skills
Prompt engineering is not about magic words. It's about clear communication with a very literal, pattern-matching system.
Why Prompting Feels Like Talking to a Smart but Literal Person
Think of AI as a brilliant employee who is exceptionally good at pattern matching but has no real-world experience. They understand instructions perfectly but can also misunderstand you in ways a human would never.
The Literalness Problem: If you say "Make it more professional," AI might:
- Add corporate jargon (which feels LESS professional to most readers)
- Use longer sentences (professional doesn't mean wordy)
- Add hedging language (professional people are confident, not wishy-washy)
If you say "Don't be too wordy," AI might:
- Remove so much context that the answer becomes useless
- Interpret "not too wordy" as "minimum viable response"
The Pattern Matching Reality: AI doesn't "understand" your intent. It matches your prompt to patterns in its training data. This means:
- The closer your prompt structure matches successful patterns in training data, the better the output
- Vague prompts get matched to vague, generic responses
- Specific prompts get matched to more targeted, useful responses
The PCTC Framework: Every Prompt Has Four Parts
Every effective prompt contains these four elements. Missing one is the #1 cause of poor output.
P - Persona (Who should respond?)
What it is: Who is the AI acting as? What expertise, perspective, and constraints should it have?
Why it matters: When AI acts as "a senior software architect with 15 years of experience," it activates different patterns than when acting as "a helpful assistant." The same question gets answered differently.
How to specify it:
- Role: "You are a senior marketing manager at a B2B SaaS company."
- Expertise: "You've launched 20+ product features and have seen what works."
- Perspective: "You're skeptical of buzzwords and care about metrics."
- Constraints: "You always back claims with data or specific examples."
Examples:
Weak: "You are a teacher."
Strong: "You are a 10-year veteran high school physics teacher who specializes in making complex concepts accessible. You're patient, use sports analogies freely, and have a reputation for getting 'math-hating' students to understand physics."
C - Context (What's the situation?)
What it is: Background information the AI needs to answer correctly.
Why it matters: The same question can have different correct answers depending on context.
Example: "Help me write an email" could mean:
- A cold sales email (direct, confident, brief)
- A customer service response (empathetic, solution-focused)
- A follow-up to a meeting (referencing specific points made)
How to specify it:
- Situation: "I just finished a job interview with [Company] for [Role]."
- Background: "The interviewer seemed interested but asked tough questions about my lack of experience in [Skill]."
- Constraints: "I need to send a follow-up within 24 hours."
- Goal: "I want to reinforce their positive impression and address the experience gap."
The 5Ws Framework for Context:
- Who is involved?
- What are we trying to achieve?
- When does this need to happen?
- Where does this apply?
- Why is this important?
T - Task (What exactly should it do?)
What it is: The specific action the AI should take.
Why it matters: "Improve this" is vague. "Make the headline punchier, reduce word count by 20%, and add a call-to-action" is specific.
How to specify it:
- Action verb: Write, create, analyze, compare, explain, summarize, etc.
- Output format: In what form should the answer come?
- Scope: What should be included/excluded?
Examples:
Weak: "Write something about our product."
Strong: "Write a 3-paragraph product description for our new project management tool, targeting small creative agencies. Paragraph 1: Hook (the problem they face). Paragraph 2: Solution (what our tool does). Paragraph 3: Call to action (start free trial). Total: 150-200 words."
C - Constraints (What are the boundaries?)
What it is: Limitations, requirements, and things to avoid.
Why it matters: Without constraints, AI defaults to generic, safe, middle-of-the-road output.
How to specify it:
Include:
- "Use 3 bullet points maximum"
- "Include specific examples from our product documentation"
- "Write in a conversational tone with short sentences"
Exclude:
- "Never use words like 'synergy', 'leverage', or 'game-changer'"
- "Don't mention pricing"
- "Avoid paragraphs longer than 3 sentences"
Format:
- "Format as a table with columns: Feature, Benefit, Price"
- "Use markdown with headers for each section"
- "Output as JSON with keys: title, description, action_items"
Zero-Shot vs. Few-Shot Prompting
Zero-Shot Prompting
What it is: Giving AI a task with no examples to guide the response.
When to use:
- Simple, well-defined tasks
- Tasks where you want AI to use its general knowledge
- Quick tasks where accuracy isn't critical
Example: "Translate this paragraph to Spanish."
Limitation: Without examples, AI has to guess what "good" looks like for your specific case.
Few-Shot Prompting
What it is: Providing 2-5 examples of the task done correctly before asking AI to do it.
When to use:
- Complex or nuanced tasks
- Tasks with specific format requirements
- Tasks where you've been disappointed by generic output
Example:
Here are 3 examples of good cold outreach emails:
Example 1:
Subject: [Specific observation about their company]
Body: I noticed you're using [tool]. We helped [similar company] achieve [result]. Here's how: [brief explanation]. Would you be open to a 15-minute chat?
Example 2:
Subject: [Question about their challenge]
Body: I was reading your post about [topic]. Your point about [specific thing] resonated. We work with companies facing similar challenges. Quick question: [specific thing they might want help with]?
Example 3:
Subject: [Contrarian take on their industry]
Body: Most [their industry] companies approach [problem] wrong. We found [different approach] gets [better result]. Tested with [X] companies. Interested in seeing if it applies to yours?
Now write a cold email for [our company] targeting [prospect profile].
Why it's more effective:
- Examples provide a "target" for pattern matching
- Reduces ambiguity about what's "good" for your specific case
- Often 3-5x more accurate than zero-shot for complex tasks
When to Use Which
| Situation | Approach |
|---|---|
| Simple task, don't care about specific format | Zero-shot |
| Complex task, need specific tone/format | Few-shot |
| AI keeps giving generic responses | Few-shot |
| Quick question, general knowledge sufficient | Zero-shot |
| Task has nuance you can't easily describe | Few-shot |
| You're comparing AI outputs to decide | Few-shot |
Temperature and Creativity Settings
Understanding Temperature
Temperature controls how "random" the AI's responses are. It's on a scale from 0 to 1 (or sometimes 0 to 2), but the practical range is:
Temperature 0.1-0.3: "Precise Mode"
- Very predictable, consistent output
- Sticks to facts and established patterns
- Low "creativity" (but not low quality)
- Good for: coding, data analysis, factual questions
Temperature 0.5-0.7: "Balanced Mode"
- Mix of consistency and variety
- Good default for most writing tasks
- Neither too predictable nor too wild
- Good for: content creation, general writing
Temperature 0.8-1.0: "Creative Mode"
- More surprising, varied output
- Explores less obvious paths
- Higher chance of interesting insights AND higher chance of errors
- Good for: brainstorming, creative writing
Practical Temperature Guide
| Task | Recommended Temp |
|---|---|
| Code generation | 0.1-0.2 |
| Fact extraction | 0.1-0.3 |
| Technical writing | 0.2-0.4 |
| Business writing | 0.5-0.7 |
| Marketing copy | 0.6-0.8 |
| Brainstorming | 0.7-0.9 |
| Creative storytelling | 0.8-1.0 |
| Roleplay/simulations | 0.7-0.9 |
The Temperature Experiment
The best way to understand temperature is to see it in action:
Ask the same question at different temperatures:
Question: "Give me ideas for a sci-fi movie plot."
Temperature 0.1:
[Probably a very conventional sci-fi plot]
Temperature 0.5:
[A balanced plot with some interesting elements]
Temperature 1.0:
[A wild, unexpected plot with bizarre twists]
Then ask: Which would you actually watch?
When to Adjust Temperature
Lower temperature (0.1-0.4) when:
- Accuracy matters more than creativity
- You're doing something technical (code, math, data)
- You want consistent, predictable output
- You're building automated systems
- Hallucinations would be costly (medical, legal, financial advice)
Higher temperature (0.7-1.0) when:
- You're brainstorming and want unexpected connections
- Writing creative fiction
- Trying to break out of a mental stuck point
- You want surprising angles on a problem
- "Close enough" is fine and diversity is valuable
Advanced Prompt Patterns
The Template Pattern
Create reusable prompt templates for tasks you do repeatedly:
# [TASK TYPE] Template
## Context
[Standard context that always applies]
## Task
[Standard task description with placeholders]
## Constraints
[Standard constraints for this task type]
## Output Format
[Standard format for results]
---
## Current Request:
[Specific inputs here]
Example - Meeting Summary Template:
## Role
You are a precise meeting analyst who extracts actionable insights from transcripts.
## Context
This is a [type] meeting: [internal/external/client/coworker]
Attendees: [list]
Meeting purpose: [purpose]
## Task
Extract and organize:
1. Key decisions made
2. Action items (with owners and deadlines if mentioned)
3. Open questions or unresolved issues
4. Important context or background that was referenced
5. Any concerns or risks identified
## Constraints
- If information wasn't explicitly stated, mark it as "inferred"
- Keep descriptions concise but complete
- Use the exact wording from speakers when possible for decisions
## Output Format
Format as a structured document with clear sections.
---
## MEETING TRANSCRIPT:
[paste transcript]
The Chain-of-Thought Pattern
For complex reasoning, explicitly ask AI to show its work:
Before answering, work through this step-by-step.
Step 1: Identify what the question is actually asking.
Step 2: Note what information is given.
Step 3: Determine what rules or principles apply.
Step 4: Work through the application of those principles.
Step 5: Identify any edge cases or ambiguities.
Step 6: Formulate your answer.
Then give your final answer clearly.
This works especially well for:
- Math problems
- Logic puzzles
- Multi-step calculations
- Analysis with multiple factors
The Reflexion Pattern
Ask AI to critique and improve its own output:
[Initial response here]
Now review your answer:
1. What assumptions did I make that might be wrong?
2. What's the weakest part of this reasoning?
3. What would someone who disagrees say?
4. What information would I need to strengthen this?
Revise the answer based on this self-critique.
The Persona + Constraints Pattern
Combining persona with tight constraints often produces best results:
You are [detailed persona with expertise, personality, and constraints].
Task: [specific task]
Constraints:
- Must include: [list]
- Must not include: [list]
- Tone: [description]
- Format: [description]
- Length: [specific constraint]
Context:
[paste relevant background]
Common Prompting Mistakes
Mistake #1: Vague Instructions
Bad: "Make this better."
Better: "Make this more concise by removing redundant phrases. Reduce word count by 30% without losing the key arguments. Maintain a professional but friendly tone."
Why it matters: "Make it better" could mean anything. Specific instructions give AI a clear target.
Mistake #2: Contradictory Instructions
Bad: "Be very creative but make sure everything is 100% accurate."
Better: "Generate 10 creative headlines. For each, note whether it's 100% factually accurate or slightly hyperbolic. I'll tell you which to use."
Why it matters: AI (like humans) gets confused by contradictions and tries to compromise in ways that may not be what you wanted.
Mistake #3: Missing Context
Bad: "Write an email to the client."
Better: "Write a follow-up email to [Client Name] after our meeting on [Date] where we discussed [topics]. The meeting went well and they're interested in proceeding. I want to confirm next steps and address their concern about [specific issue they raised]. Keep it under 200 words."
Why it matters: The more context AI has, the more relevant and useful the output.
Mistake #4: Unclear Output Format
Bad: "Give me some ideas."
Better: "List 5 ideas for [topic]. For each, provide:
- One-line description
- Expected impact (High/Medium/Low)
- Implementation effort (1-5 scale)
- A risk or potential downside
Format as a markdown table."
Why it matters: "some ideas" could mean anything. The table format ensures you get comparable, useful outputs.
Mistake #5: Forgetting the Human in the Loop
AI output should always be reviewed. Even excellent prompts can produce:
- Hallucinated facts
- Inappropriate tone
- Off-target content
- Subtle errors that matter in specific contexts
The fix: Build review into your workflow:
- Generate with AI
- Review critically (read it as if a junior employee wrote it)
- Edit for accuracy, tone, completeness
- Use the final output
The Prompt Refinement Process
Great prompts are built iteratively. Use this process:
Step 1: First attempt Write your prompt as best you can. Get the output.
Step 2: Analyze what's wrong
- Is it factually incorrect?
- Wrong tone?
- Missing information?
- Too long/short?
- Wrong format?
Step 3: Refine the specific issue For each problem, adjust the prompt:
- "Add a specific example" to fix vagueness
- "Use contractions and shorter sentences" to fix tone
- "Include [specific context]" to fix missing information
- "Format as bullet points" to fix format issues
Step 4: Test with different inputs If you'll use this prompt repeatedly, test with different inputs:
- Does it work for easy cases?
- Does it handle edge cases?
- Does it stay consistent?
Step 5: Save as template Once you've refined it, save it as a reusable template with notes about what worked.
Summary: The PCTC Checklist
Before sending any prompt, verify:
Persona:
- Who is the AI acting as?
- What expertise should they have?
- What perspective should they have?
Context:
- Is the situation clear?
- Does the AI have enough background?
- What does the AI need to know that I might take for granted?
Task:
- Is the action clear (write, analyze, compare, etc.)?
- Is the scope defined?
- Is the output format specified?
Constraints:
- Length specified?
- Tone described?
- Things to avoid listed?
- Format requirements stated?
What's Next: Now that you understand the fundamentals, let's explore how to use AI for advanced coding tasks.
Resources & Downloads
Hands-on Practicals
Take 5 prompts you've used recently. Analyze each one against the PCTC framework: Which components are present? Which are missing? Rewrite each prompt to include all 4 elements and compare results.
Find 3 examples of well-written emails in your inbox (positive ones). Ask AI: 'Analyze the tone, structure, and key elements of these 3 emails. Now write a new email in this style about [topic].' Compare the result to zero-shot prompting.
Ask the same complex question 3 times with temperatures 0.1, 0.7, and 1.0. Compare: 1) Accuracy, 2) Creativity, 3) Readability, 4) Confidence. Document which temperature works best for what purpose.
Knowledge Check
In the PCTC framework, what does the 'Constraints' component define?
Why is few-shot prompting often more effective than zero-shot prompting?
When should you use a low temperature setting (0.1-0.3)?