In short
Talking to an LLM is not like running a Google search. Google tolerates approximation — it infers what you mean. An LLM, on the other hand, takes your wording literally. If you are vague, it answers vaguely. If you are precise, it can be too.
Prompting is the art of phrasing clear instructions to get useful answers. It is not manipulation, nor some mysterious skill reserved for experts. It is precise communication with a tool that needs it.
Explanation
What a prompt is
A prompt is everything you send to the model before it generates a response: a question, an instruction, a document to analyze, a role to play, examples to follow. The model only sees that. It has no access to your intent, your professional context, or your implicit expectations.
This constraint is fundamental: anything you do not say, the model either invents or ignores.
Clarity and specificity
The first principle is also the simplest. A vague question produces a vague answer.
Compare these two phrasings:
- “Explain the code.” → The model may paraphrase, summarize, analyze the structure, or all of the above.
- “Explain what this Python function does, line by line, assuming a reader who has never programmed.” → The answer is constrained from the start.
Specificity shrinks the space of possible answers. It forces the model to go where you want it to go.
Explicit context
An LLM has no memory between sessions. It does not know who you are, which project you are working on, or who you are writing for. All that context has to be provided in the prompt itself.
Providing the expected role, the desired output format, and the important constraints reduces unnecessary back-and-forth and improves the relevance of answers from the first try.
Delimiters
When a prompt mixes instructions and data (a text to analyze, code to fix, a document to summarize), the model can confuse the two. Delimiters — triple quotes, XML tags, explicit separators — clearly indicate where instructions end and where data begins.
Summarize the following text in 3 bullet points:
"""
[text to summarize]
"""
This principle becomes critical in automated applications where the prompt is built programmatically.
System messages
Most LLM APIs distinguish the system prompt (global instructions, defined before the conversation) from the user message (the specific request). The system prompt is where you define the general behavior: register, language, format, role, permanent constraints. The user message is the request of the moment.
This separation avoids repeating the base instructions at every conversation turn.
Iteration
The first prompt is rarely optimal. Prompting is an empirical process: test, observe the limits of the response, adjust one variable at a time. It is no different from writing — the first draft exists so you can see what is missing.
In short: six practical rules sum up everything — be precise, give context, separate instructions and data with delimiters, use the system prompt for permanent rules, vary one parameter at a time during iteration. Everything else flows from there.
Concrete examples
Zero-shot: ask the question directly
Zero-shot means sending the question with no prior example. The model relies solely on what it learned during training.
Classify this customer review as positive, negative, or neutral:
"Delivery was fast but the packaging was damaged."
Effective for common, well-defined tasks. Not enough for non-standard output formats or unusual tasks.
Few-shot: show before asking
Few-shot provides two to five input/output examples before the actual question. The model infers the pattern and applies it to the new input. More robust than zero-shot for specific formats or tasks where defining a “good answer” is hard to put into words.
Input: "Delivery was fast."
Output: POSITIVE
Input: "The product arrived broken."
Output: NEGATIVE
Input: "Delivery was fast but the packaging was damaged."
Output:
The model naturally completes the pattern.
Chain-of-thought: reason before answering
Chain-of-thought (CoT) consists in asking the model to spell out its reasoning steps before giving the final answer. This technique significantly improves performance on multi-step reasoning tasks — math, logic, structured analysis.
The zero-shot version is simple: adding “Think step by step” at the end of the prompt is often enough to trigger the behavior.
A train leaves at 2:00 PM and arrives at 5:30 PM. It stops for 20 minutes along the way.
What is the actual travel time without the stops?
Think step by step.
Why it works: forcing the model to externalize its reasoning reduces “jumping” errors — premature conclusions drawn without checking the intermediate steps.
Role prompting: anchor the expertise
Assigning a role to the model shifts the register and depth of the answers. It is not a trick — it leverages the fact that the model was trained on texts produced by experts in specific contexts.
You are a network security expert with 15 years of enterprise experience.
A junior developer asks you why their application exposes port 22 in production.
Explain the problem and the risks, without unnecessary jargon.
The role constrains the level of abstraction, the vocabulary, and the angle of approach. It is especially useful when the same information must be presented differently depending on the audience.
| If your task is… | Main technique | Why |
|---|---|---|
| Simple, well-documented question (definition, translation, short summary) | Zero-shot | Sufficient most of the time, no overhead. |
| Non-trivial output format (table, specific JSON, fine classification) | Few-shot (2 to 5 examples) | Visual patterns beat text description. |
| Computation, multi-step reasoning, logic | Chain-of-thought (“think step by step”) | Reduces jump errors, improves precision by 30 to 40% on GSM8K. |
| Content addressed to specific audience (vulgarization, precise expertise) | Role prompting | Aligns register, vocabulary, and depth with the assigned role. |
| Complicated task mixing instructions and data | Explicit delimiters + system prompt | Prevents the model from confusing data with instruction. |
In short: good mental hygiene = each problem = one main technique, not a stack. If you feel you are accumulating zero-shot + few-shot + CoT + role in the same prompt, it is often that the task deserves to be cut in two.
What to remember
- Precision is the core skill. Anything you do not specify, the model interprets according to its own defaults. Specifying the role, the format, the target expertise level, and the important constraints reduces the share of interpretation left to the model.
- Few-shot beats zero-shot as soon as the output format is non-trivial. Describing a format in words is often less effective than showing two examples. The model is trained to complete patterns — exploiting that is more reliable than writing out a textual spec.
- Chain-of-thought is the most powerful lever for reasoning. On multi-step tasks, asking the model to reason out loud before concluding improves accuracy measurably. It is an instruction, not an incantation.
- Prompting is empirical, not magical. There is no universal formula. A good prompt for one task does not necessarily transfer to another. Iteration is the method — one variable at a time.