Prompt Engineering: Introduction
An LLM is only as good as the prompt you give it. Prompt engineering is the practice of writing inputs that reliably get the output you want. It's the most accessible way to control an LLM β no training, no code, just well-crafted instructions β and a small change in wording can make the difference between a vague, unreliable answer and a precise, useful one.
π‘ In one line: Prompt engineering is the skill of writing clear, well-structured instructions that get an LLM to produce the output you actually want.
What is a Prompt?
A prompt is the text you give an LLM as input β your instruction, question, or task, along with any context. The model responds by predicting a continuation of that text. In short: everything you type is the prompt, and the model's whole behaviour depends on it.
What is Prompt Engineering?
It's the skill of designing prompts to get accurate, useful, and consistent outputs. Because LLMs are sensitive to wording, the same request phrased two ways can give very different results. Good prompt engineering combines:
- Clear instructions β say exactly what you want.
- Context β give the background the model needs.
- Examples β show the format or style.
- Output format & constraints β specify how to respond.
β¦and then refines these through iteration.
Why It Matters
- It's the cheapest and fastest way to steer an LLM β no fine-tuning required.
- It turns a vague output into a precise one.
- Same model, better prompt β dramatically better results.
Anatomy of a Good Prompt
A well-built prompt often has several parts β which map neatly onto the rest of this topic:
- Role / instruction β who the model should act as, and what to do.
- Context β background information it needs.
- Examples β demonstrations (zero-, one-, or few-shot).
- Input β the actual question or data.
- Output format & constraints β length, structure (e.g. JSON), tone, plus guardrails.
Bad vs. Good Prompt
The difference is concrete:
- Weak: "Write about dogs."
- Strong: "Write a friendly 100-word paragraph for a pet-shop blog, introducing golden retrievers to first-time owners. Focus on temperament and care."
The strong prompt adds a role, audience, length, topic, and focus β so the model has everything it needs to hit the target.
Prompt Engineering is Iterative
You rarely get the perfect prompt on the first try. The workflow is a loop:
Write β test β inspect the output β refine.
Treat it like debugging: change one thing, see the effect, and improve.
What's Ahead in This Topic
This topic builds up in layers:
- Message roles β system, user, and assistant prompts.
- Prompt templates β reusable, parameterised prompts.
- Best practices β context, constraints, and guardrails.
- Core techniques β zero-/one-/few-shot, role prompting, chain-of-thought, self-consistency, ReAct.
- Structured outputs β JSON output, function calling, and tool calling.
Summary
- A prompt is the input text you give an LLM; prompt engineering is the skill of crafting it well.
- LLMs are sensitive to wording β clear instructions, context, examples, and format matter.
- It's the cheapest, fastest way to control a model β same model, better prompt, better results.
- A good prompt combines role, context, examples, input, and format/constraints.
- It's an iterative craft β write, test, and refine like debugging.