What Is Prompt Engineering?
A practical framework for writing instructions that produce reviewable output, with before-and-after examples and an evaluation loop.
Prerequisites
- • Access to at least one AI assistant
- • A real task you want to improve
What you will learn
- Write a prompt with role, task, context, constraints and output format
- Diagnose vague or inconsistent output
- Build a small evaluation set instead of judging one lucky result
Prompting is specification writing
A prompt is a specification for a task. If the specification is vague, the output will be vague, inconsistent or confidently wrong. Prompt engineering is the discipline of making the request clear enough to review.
A useful structure:
- Role and task. What is the model doing, and for whom?
- Context. The audience, situation and source material.
- Constraints. Length, tone, what not to do, what data not to invent.
- Output format. Headings, table columns, JSON schema or checklist.
- Verification. Ask the model to flag uncertainty or missing evidence.
Before and after
Vague: “Write a blog post about AI for small businesses.”
Specific: “Write a 900-word article for owners of 5–50 person service businesses who have no technical staff. The reader wants to decide whether to adopt an AI meeting-notes tool. Use these sections: the decision, three practical workflows, data risks, a 30-day trial plan. Do not invent statistics or product prices. Mark unsupported claims [VERIFY]. Return the outline first.”
The second prompt is not longer for the sake of length. Every sentence removes a degree of freedom that would otherwise produce generic output.
Evaluate, don't vibe-check
One good output does not prove a prompt works. Build a small test set:
- a typical input,
- a messy real input,
- an ambiguous input,
- an input where the correct answer is “I don't know”.
Score the outputs on factual accuracy, completeness, format compliance and usefulness. Change one variable at a time. Keep the prompt version and the test results together.
When prompting is the wrong fix
If the task needs information the model does not have, prompting cannot solve it. Add retrieval, provide the data, or use a deterministic tool. If the task requires guaranteed calculation, use code. Prompting is for language and reasoning-shaped work, not for replacing a database.
Exercises
Do these before moving on. Reading is not the same as being able to apply it.
Exercise 1
Rewrite a vague prompt
Take “write a summary” and rewrite it with audience, length, purpose and a required structure. Compare both outputs on the same input.
Exercise 2
Build three test cases
Create three inputs for a repeated task: a typical case, an edge case and an ambiguous case. Score both prompt versions.
References
Finished this tutorial? Continue with a guided path.
Browse learning paths →