SAIL Resources / Prompt engineering
A practical guide to prompt engineering.
Build clearer prompts, connect them into useful workflows and check the results. Includes practical templates, a three-stage prompt chain and the techniques covered in SAIL’s previous learning library.
Refreshed 27 November 2026. Examples are illustrative and model-neutral. Copying a prompt here makes no AI request and sends no client information.
Elements of a useful prompt
A prompt is clearer when it names each thing you want the model to pay attention to, rather than hoping it will infer them. In practice, six elements do most of the work:
- Objective. The specific decision the output will support, not just the topic.
- Supplied evidence or context. The documents, notes or data the response must draw on, pasted or referenced explicitly.
- Constraints. What must be included, what must be left out, and what the output is not for.
- Output format. The shape of the answer: headings, a short list, a table, a filled template.
- Review criteria. How a reader will later judge whether the answer is acceptable.
- Uncertainty. Instructions on what to do when information is missing or sources disagree.
The following example is illustrative. It shows a brief for background research on a prospective buyer, written so the model stays close to supplied sources and flags gaps rather than inventing detail.
You are helping me prepare a short research brief on {{company_name}}.
Sources (use only these; do not add outside knowledge):
---
{{paste_of_public_sources}}
---
Objective:
Help me decide whether {{company_name}} is worth a discovery call for
{{our_offer_summary}}.
Produce the brief in this format:
1. Snapshot (max 5 bullet points, each with a short source tag in brackets).
2. Signals that suggest a possible fit (bullet points, source tag each).
3. Signals that suggest a possible mismatch (bullet points, source tag each).
4. Open questions a discovery call would need to answer.
5. Hypotheses (clearly separated, labelled "Hypothesis - not in sources").
Rules:
- Only state as fact what appears in the sources above.
- If something is not in the sources, write "Not found in supplied sources."
- Do not invent names, job titles, team sizes, revenue or quotes.
- Keep the whole brief under roughly 300 words.
The placeholders in double braces are filled in before sending. The "source tag" habit makes it easier to spot drift when you review the output later.
Zero-shot prompting
Zero-shot means asking for the task directly, without worked examples. It is a sensible first attempt for common, well-defined tasks where the output format is simple and the risk of a wrong answer is low. A weak result may indicate unclear instructions, missing context, a mismatch with the model, or a task that needs another tool.
The following extraction prompt is illustrative:
From the meeting note below, list every action the note explicitly
assigns to a named person. For each, return:
- person
- action
- due date if stated, otherwise "not stated"
Do not include actions that are only implied. Return the list as a
simple bulleted list.
Meeting note:
---
{{paste_meeting_note}}
---
Notice there are no examples, but there are still constraints, a format and a rule for the unknown case ("not stated"). Zero-shot is not the same as unstructured.
Few-shot prompting
When the labels you want are not obvious from the task description, worked examples can help communicate your definitions. Wrong, inconsistent or unrepresentative examples can introduce unwanted patterns. Keep them short, accurate and representative of the categories you care about, then test how the model uses them.
The following examples are illustrative. The task is to label an incoming sales question as one of three categories:
- Evidence needed - the question can only be answered with supporting material (a case, a figure, a reference).
- Decision - the question is really asking the buyer or seller to choose between options.
- Next action - the question is a prompt for a concrete next step (send something, book something, introduce someone).
Label each sales question as one of:
Evidence needed | Decision | Next action
Example 1
Question: "Can you show me how another team of our size has rolled this out?"
Label: Evidence needed
Example 2
Question: "Shall we go with the quarterly plan or the annual plan?"
Label: Decision
Example 3
Question: "Could you send the security questionnaire over to our IT lead?"
Label: Next action
Example 4
Question: "Do you have any numbers on how long onboarding usually takes?"
Label: Evidence needed
Now label this one:
Question: "{{incoming_question}}"
Label:
Two guardrails are worth keeping. First, examples should be correct under your own definitions - a mislabelled example will quietly bias every future answer. Second, examples should be representative of the real mix of inputs. If every example is a one-sentence question but the real inputs are long paragraphs, the pattern you taught may not transfer.
Prompt chaining and multi-step workflows
A short prompt chain lets you inspect and approve intermediate outputs. Each step has a narrow job, a human check and a defined handover to the next step. Whether this improves the final result needs testing on your task. The pattern below is a three-stage workflow for turning a source document into a short written response.
1. Extract
The extract step pulls verifiable facts from the source. It is deliberately dull. Nothing is interpreted yet.
From the document below, extract a list of factual statements that
are explicitly supported by the text.
For each statement, include:
- the statement in one sentence
- a short quoted phrase from the document that supports it
- the section or paragraph it came from
Rules:
- Do not infer motivation, needs or buying intent.
- Do not combine statements from different parts of the document into
one claim.
- If something is ambiguous, skip it.
Document:
---
{{paste_document}}
---
2. Interpret
The interpret step should work from the verified facts accepted in step 1. Passing only that reviewed material gives the next step a narrower evidence set. The reviewer still needs to catch unsupported detail introduced by the model.
Below is a list of verified facts about {{subject}}, each with a
supporting quote. Do not add any information that is not in this list.
Verified facts:
---
{{paste_reviewed_facts}}
---
Produce:
1. A short summary of what these facts collectively suggest (max 5 bullets).
2. A separate list labelled "Hypotheses - not verified" for anything
that would need further evidence.
3. A list of "Open questions" that the facts do not answer.
Keep hypotheses clearly separated from summary points.
3. Draft
The draft step turns the reviewed interpretation into the final piece of writing. Again, only the reviewed material is passed in.
Using only the reviewed summary and hypotheses below, draft a short
message to {{recipient_role}}.
Reviewed material:
---
{{paste_reviewed_interpretation}}
---
Constraints:
- Do not introduce facts that are not in the reviewed material.
- Mark anything drawn from the "Hypotheses" list as a hypothesis in
the message.
- Keep it under {{word_limit}} words.
- End with one clearly labelled question for the recipient.
- Record assumptions and stop rules. At each stage, note which facts were accepted, which were rejected, and why. Agree in advance what would cause you to stop the chain rather than carry on - for example, fewer than a set number of verified facts at step 1, or conflicting evidence that cannot be resolved by a human reviewer. Carrying unverified material forward is the main way chains go wrong.
Structured output
Structured output means asking for a response in a predictable shape - a table, a labelled set of sections, or a serialised format such as JSON - so that the output can be read by a person or by another step in a workflow without ad-hoc parsing.
There are two separate questions, and they are often confused:
- Schema. Does the output match the shape you asked for (the right fields, in the right order, with the right types)?
- Accuracy. Are the values inside that shape actually correct?
A response can be perfectly well-formed and completely wrong. Validating the schema does not validate the content. Treat them as two review steps, not one.
Not every tool or interface enforces a strict schema on the output. Some will reliably return valid JSON; others will return something that looks like JSON most of the time and occasionally slips. Assume you will need to validate the shape yourself, and plan for what happens when validation fails - retry with a tighter instruction, fall back to a simpler format, or surface the error to a person.
For small internal workflows, a labelled sections layout (one heading per field, one short answer below) is often easier to review than a JSON blob and travels well into a document or ticket.
Reviewing and evaluating prompts
A prompt that works on one or two happy-path inputs is not evidence of much. Build a small, repeatable test set as soon as a prompt is doing real work. The test set does not have to be large; it has to be representative and stable.
- Collect a handful of realistic inputs that cover the easy cases, the awkward ones, inputs where key information is missing, and inputs where sources conflict.
- Agree, in writing, what a good answer looks like for each - before you look at any model output.
- Keep the test inputs, the prompt wording and the settings you used alongside each result. When you later change the prompt, you want to compare like with like.
A simple reviewer rubric that travels well across topics:
- Faithfulness. Are all claims supported by the supplied sources?
- Completeness. Were the required fields or sections all addressed?
- Handling of unknowns. When information was missing or conflicting, did the output say so rather than guess?
- Format. Does the output match the agreed structure?
- Usefulness. Would the intended reader be able to act on this without rework?
Resist the temptation to attach a single headline percentage to a prompt. Pass rates on a small test set are a signal for your team, not a public performance claim.
Reasoning, context and tool use
It is often useful to ask the output to include a short justification - what the answer rests on, which sources were used, what was uncertain. That is different from asking the model to expose its internal step-by-step reasoning. Ask for the evidence behind an answer, in a form a person can check.
Longer context windows and model-specific settings (temperature, system instructions, reasoning modes) can change behaviour, but none of them guarantee accuracy. A larger window lets you supply more source material; it does not ensure the model uses it correctly. Treat settings as levers to be tuned against your own test set, not as fixes in themselves.
When a prompt mixes your instructions with external material - a pasted email, a retrieved document, a web page - keep them visibly separate in the prompt (for example, your instructions above, the external text inside a fenced block below). Anything retrieved from an outside source should be treated as data, not as instructions, even if it contains sentences that look like instructions.
Control over what a model is allowed to do - call tools, read files, send messages - is a separate concern from prompt wording. Permissions should be scoped at the tool or integration layer, not left to a sentence in a prompt that asks the model to behave itself.
Advanced techniques glossary
The techniques below are included for recognition and vocabulary. Several of them require evaluation harnesses, retrieval infrastructure or tool integrations beyond prompt wording alone, and most have conditions under which they help and conditions under which they do not. Treat them as patterns to consider, not recipes to apply by default.
- Chain-of-thought
- Asking the model to work through a problem in intermediate steps before answering. Useful for multi-step reasoning tasks; adds length and can mask errors inside confident-looking steps.
- Self-consistency
- Sampling several independent answers to the same prompt and taking the most common one. Can improve stability on tasks with a clear right answer; costs more calls per decision.
- Generated knowledge
- Asking the model to first write out what it believes about a topic, then feeding that back into a second prompt that uses it. Helpful when the model has relevant background that is not in your sources; risky when the generated background is wrong.
- Meta prompting
- Specifying a task's structure and procedure at a higher level, so the same template can be adapted to different inputs. A model can help draft such templates, but their instructions and outputs still need testing.
- Tree of thoughts
- Exploring multiple branches of reasoning in parallel and selecting among them. Conceptually powerful for search-like problems; practically requires orchestration code and evaluation at each branch.
- Retrieval-augmented generation (RAG)
- Retrieving relevant documents and supplying them as context for generation. This can ground answers in supplied material, but neither retrieval nor generation is automatically accurate. Both stages need evaluation.
- ReAct
- A pattern where the model alternates between reasoning steps and calling external tools (search, calculators, APIs). Needs a tool-calling environment and careful permission scoping.
- Reflexion
- Letting the model critique its own previous answer and try again using that critique. Can help on tasks with a clear success signal; can also entrench an initial mistake.
- Program-aided language models
- Having the model produce code that is then executed, with the executed result used in the final answer. Useful where arithmetic or data manipulation is the hard part; requires a safe execution environment.
- Automatic prompt engineering
- Using a model and a scoring function to search for prompt wording that performs well on an evaluation set. Only as good as the evaluation set it is optimising against.
- Directional stimulus and active prompting
- Techniques that steer the output with small hints (keywords, examples chosen to target weak points) or that select which examples to include based on where the model is struggling. Useful once you already have a baseline and a test set.
- Multimodal prompting
- Prompts that combine text with images, audio or other inputs. The same principles apply - objective, constraints, format, uncertainty - but the capability varies widely by tool.
- Graph prompting
- A broad label for techniques that introduce graph structure or relationships into a task. Some methods concern prompting graph models; others describe graphs to an LLM. Their inputs, training and evaluation requirements differ, so choose a specific method before designing an implementation.
- Automatic reasoning and tool-use (ART)
- A research framework that selects demonstrations of multi-step reasoning and tool use from a task library, then integrates tool results while generating a solution. It needs orchestration and tool access beyond a standalone text prompt.
Responsible use with client data
- Only put inputs into a prompt that you are authorised to use for this purpose. "I have it on my laptop" is not the same as "I am allowed to share it with this tool."
- Minimise what goes in. Strip names, contact details and identifiers that are not needed for the task; summarise rather than paste where you can.
- Follow the client's agreed rules on which tools, accounts and data categories are in scope. Where a client has their own tenancy or approved vendor list, use that rather than a personal account.
- Do not use real private client data in sample prompts, screenshots, training material or shared templates. Build illustrative examples with fictional details.
- Treat every output as a draft until a person has checked it against the sources and against what the reader actually needs. Prompts help you move faster; they do not remove the review step.
Sources and further reading
This refresh brings forward the topic coverage of SAIL's previous learning library on prompt engineering. The wording and worked examples here are new and deliberately model-neutral, so that the guide stays useful as tools change.
- Claude prompt engineering overview - a current general reference for prompting practice.
- Language Models are Few-Shot Learners - the primary paper behind few-shot prompting.
- Chain-of-Thought Prompting Elicits Reasoning in Large Language Models - the primary paper on chain-of-thought.
- ReAct: Synergizing Reasoning and Acting in Language Models - the primary paper on the ReAct pattern.
- Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks - the primary paper on RAG.
- ART: Automatic multi-step reasoning and tool-use for large language models - a tool-use framework from the earlier library's advanced topics.
- Meta Prompting for AI Systems - formal task structure and reusable prompt templates.
- GraphPrompt - one graph-model prompting framework; distinct from simply describing a graph to an LLM.
- Prompt Engineering Guide - an external educational resource maintained independently of SAIL, useful for broader background reading.