Prompt Engineering
Master the art and science of writing effective prompts — from basic principles to advanced frameworks like CO-STAR and Chain-of-Thought.
3 sections · about 35 minutes
Why Prompts Matter
The quality of your prompt directly determines the quality of the AI's response. A vague prompt gets a generic answer. A well-crafted prompt gets a precise, useful, and targeted response. Prompt engineering is the skill of communicating your intent clearly to an AI system.
The Prompt Gap
Studies show that the same AI model can perform at a "beginner" or "expert" level depending entirely on how it's prompted. The difference isn't the model — it's the prompt.
Think of prompting like giving instructions to a brilliant but literal-minded assistant. They'll do exactly what you ask — so the more specific and clear you are, the better the result.
Anatomy of a Great Prompt
Every effective prompt contains some combination of these five elements. You don't always need all of them, but the more complex your task, the more elements you should include.
- Role: Who should the AI act as? (e.g., "You are an experienced data scientist...")
- Task: What specific thing should the AI do? (e.g., "Analyze this dataset and identify trends...")
- Context: What background information is relevant? (e.g., "This data comes from a 2024 customer survey...")
- Format: How should the response be structured? (e.g., "Present findings as a bulleted list with...")
- Constraints: What limitations or boundaries apply? (e.g., "Keep the response under 500 words. Focus only on...")
# Weak prompt:
"Tell me about climate change"
# Strong prompt:
"You are an environmental science educator. Explain the top 3
causes of climate change to a client with no background in the subject. For each cause:
- Explain the mechanism in simple terms
- Give one real-world example
- Rate its relative impact (high/medium/low)
Keep the total response under 400 words."Check yourself
Which element of a prompt helps prevent overly long or off-topic responses?
Iterative Refinement and Evaluation
Great prompts rarely emerge fully formed. The best prompt engineers iterate: write a prompt, test it, analyze the output, and refine. This cycle of improvement is where the real skill lies.
- Start simple: Begin with a basic prompt that captures your core intent
- Test it: Run the prompt and carefully read the output
- Identify gaps: What's missing? What's wrong? What's unnecessary?
- Add specificity: Address each gap with more precise instructions
- Test variations: Try different phrasings, structures, and frameworks
- Evaluate consistently: Use the same test cases to compare prompt versions
The 80/20 Rule of Prompting
You'll often get 80% of the way with a basic prompt. The last 20% — getting the output exactly right — is where frameworks, XML tags, examples, and constraints become essential.
Check yourself
What's the most effective way to improve a prompt that's giving mediocre results?
Responsible AI Use