Prompt Engineering Basics
The same AI model can give you brilliant or terrible results. The difference? How you ask.
Prompt engineering is the skill of crafting inputs that get the outputs you want.
The Fundamental Truth
LLMs want to complete patterns.
If your prompt looks like the start of a helpful answer, you'll get a helpful answer. If it looks like the start of rambling nonsense, you'll get rambling nonsense.
Five Techniques That Actually Work
1. Be Specific
Bad prompt:
Write about dogs.
Good prompt:
Write a 200-word blog post about the health benefits of daily walks for golden retrievers, targeting first-time dog owners.
Why it works: Specificity constrains the output space.
2. Provide Context
Bad prompt:
Is this code good?
Good prompt:
I'm a junior developer learning Python. Review this function that calculates shipping costs. Focus on readability and any obvious bugs. Here's the code: [code]
Why it works: Context shapes the response style and depth.
3. Show Examples (Few-Shot Learning)
Bad prompt:
Convert this to formal English.
Good prompt:
Convert informal text to formal English.
Informal: gonna head out soon Formal: I will be leaving shortly.
Informal: that meeting was a total waste Formal: The meeting was not productive.
Informal: hey can u send me that doc Formal: [Your turn]
Why it works: Examples demonstrate exactly what you want.
4. Assign a Role
Bad prompt:
Explain quantum computing.
Good prompt:
You are a physics professor known for clear explanations. Explain quantum computing to a curious high school student. Use analogies, avoid jargon, and check for understanding.
Why it works: Roles activate relevant knowledge and style.
5. Structure the Output
Bad prompt:
Analyze this business idea.
Good prompt:
Analyze this business idea using this structure:
Strengths: (3 bullet points) Weaknesses: (3 bullet points) Market Opportunity: (1 paragraph) Recommendation: (Yes/No with reasoning)
Why it works: Structure prevents rambling and ensures completeness.
Common Mistakes to Avoid
Being Too Vague
"Make it better" → Better how? More formal? Funnier? Shorter?
Assuming Knowledge
The AI doesn't know your project, your preferences, or what you tried before.
Asking Multiple Things
"Write a tagline, suggest improvements, and translate to Spanish" → Do one at a time.
Not Iterating
First response not perfect? Refine and try again. It's a conversation.
The "Act As" Framework
A simple template that works for most tasks:
Act as a [ROLE] with expertise in [DOMAIN].
Your task is to [SPECIFIC ACTION].
Context: [RELEVANT BACKGROUND]
Requirements:
- [REQUIREMENT 1]
- [REQUIREMENT 2]
- [REQUIREMENT 3]
Output format: [DESIRED STRUCTURE]
Quick Wins
Try adding these to any prompt:
- "Think step by step" — Improves reasoning
- "Be concise" — Reduces fluff
- "If unsure, say so" — Reduces hallucination
- "Ask clarifying questions if needed" — Better results
The Meta-Skill
The best prompt engineers don't memorize templates. They:
- Understand the model's tendencies
- Anticipate failure modes
- Iterate quickly based on results
Start simple. Add detail when the output isn't right. Remove detail when it's over-constrained.
Next up: AI Ethics 101 — The important questions everyone should consider