Prompt Engineering
Prompt Engineering
Here’s something that surprised me early on: the same AI model can give you a mediocre answer or a brilliant one, depending entirely on how you ask. The model doesn’t change. Your input does.
Prompt engineering is the skill of communicating clearly with AI. It’s part writing, part psychology, part structured thinking. And it’s probably the single most practical AI skill you can develop right now — no code required.
The Principles That Actually Matter
After a lot of experimentation, these are the ones that consistently make a difference:
1. Be specific about what you want. Not “write something about AI safety” but “write a 200-word summary of the EU AI Act’s risk categories, aimed at a non-technical business audience.”
2. Give context. The model only knows what you tell it. Front-load the situation, the constraints, and who the output is for.
3. Show, don’t tell. One example is worth fifty words of instruction. Two examples is worth a hundred.
4. Structure your input. Headers, bullet points, XML tags, numbered steps — all of these help the model parse your intent. Messy input → messy output.
5. Iterate. Your first prompt is a draft. Refine it based on what comes back. Prompting is a conversation, not a single shot.
The Techniques
Zero-Shot
Just ask. Works for simple, well-defined tasks.
Summarise this article in 3 bullet points: [article] Few-Shot
Show examples of what you want. The model picks up the pattern.
Convert to formal English:
"hey whats up" → "Hello, how are you doing?"
"gonna head out" → "I will be leaving now."
"nah thats wrong" → Chain-of-Thought
Ask the model to think step by step before answering. This dramatically improves reasoning on hard problems.
Solve this problem. Work through your reasoning step by step, then give your final answer. System Prompts
Set role, personality, and constraints before the conversation starts.
You are a senior software engineer reviewing code.
Be concise. Flag bugs and security issues. Suggest improvements with code examples. Advanced Patterns
| Pattern | When to use it | |
|---|---|---|
| Chain-of-Thought | Maths, logic, multi-step reasoning | |
| Tree-of-Thought | Problems with multiple valid approaches | |
| Self-Consistency | When you need reliability (generate 5 answers, pick the consensus) | |
| ReAct | Constitutional | “Does this response follow these principles?” |
The Anti-Patterns
Things I’ve learned to stop doing:
- ❌ “Be creative” — Too vague. Creative how? In what direction?
- ❌ Contradictory instructions — “Be concise but cover everything in detail”
- ❌ Assuming context — The model hasn’t read your mind or your codebase
- ❌ Giant walls of text — If you can’t parse it, neither can the model
- ❌ “Do it perfectly” — Not actionable. Define what “good” looks like instead.
Why This Is Worth Learning
A well-prompted model is a different tool than a poorly-prompted one. The gap is enormous:
- Turn generic responses into expert-level analysis
- Cut hallucinations by grounding with context
- Get structured output (JSON, tables, specific formats) reliably
- Save money — shorter, better prompts = fewer tokens = lower cost
And this skill compounds. The better you get at prompting, the better you get at using AI Agents, building RAG systems, and designing AI products.
Go Deeper
- AI Agents — Prompting is how you program agent behaviour
- RAG & Retrieval — Prompting + context injection = grounded answers
- Training & Fine-Tuning — When prompting isn’t enough, fine-tuning is next
- How LLMs Work — Understanding the model helps you prompt it better
Best Resources
- Anthropic Prompt Engineering Guide (docs.anthropic.com) — The best structured guide
- “Prompt Engineering for Developers” (DeepLearning.AI) — Free short course
- Lilian Weng “Prompt Engineering” — Technical deep dive with research citations
- Just practice — Honestly, the best way to learn is to use AI daily and notice what works