Giving Context in Prompts: Audience, Purpose and Background

JS
Jai Singh
02 Dec, 2026 4 min read 6 views

Context is the background a model needs to give a useful answer: who the audience is, what the output is for, what has already been decided and which facts it must rely on. Adding the right context usually improves a prompt more than any wording trick.

Why context matters

A model knows a lot in general and nothing about your situation. Ask "How should I structure the project?" and you get a generic answer. Ask the same question after describing the team size, the language, the deadline and the pain points, and the answer becomes specific. The model is not smarter; it is better informed.

Four kinds of useful context

  • Audience: "These notes are for new support agents in their first week."
  • Purpose: "This summary will be pasted into a weekly status email to executives."
  • Situation: "We are migrating from MySQL to PostgreSQL and cannot have downtime."
  • Facts and sources: the actual documents, data or policies the answer should use.

Purpose deserves special attention. "Summarise this meeting" can be answered many ways. "Summarise this meeting so that someone who missed it knows which decisions need their approval" tells the model what to emphasise.

Explain why, not only what

Giving the reason behind an instruction helps the model apply it sensibly to cases you did not foresee. "Do not use bullet points because this text will be read aloud by a text-to-speech system" lets the model also avoid other things that read badly aloud, such as symbols and tables. A bare rule covers only the case it names.

Separate context from instructions

Mixing background, instructions and data into one paragraph makes prompts hard for people and models to read. Label each part. Tags or headings work well, and the next posts cover XML tags in detail.

import anthropic

client = anthropic.Anthropic()

context = """
Team: 4 developers, all comfortable with Python, none with Kubernetes.
Current setup: one VM running a Flask app with systemd.
Constraint: budget for hosting is under 100 dollars per month.
"""

question = "Should we move to Kubernetes?"

prompt = (
    "Background:\n" + context +
    "\nQuestion: " + question +
    "\nGive a recommendation in three sentences, then list two risks."
)

reply = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=600,
    messages=[{"role": "user", "content": prompt}],
)
print(reply.content[0].text)

Expect a recommendation that reflects the small team and low budget, probably advising against Kubernetes for now, followed by two risks. Delete the background and run again to see how generic the answer becomes.

How much context is enough

Include what a thoughtful person would need and no more. Irrelevant text dilutes attention and costs tokens. If a fact would not change the answer, leave it out. If the model gets the answer wrong because it lacked a fact, add that fact. This test-driven approach keeps prompts lean.

Do not pretend context exists

Models cannot see your files, your database or the web page you have open unless you put the content in the request. Phrases such as "see the attached report" fail unless the report text or file is actually in the message. Paste the content, or send the file using the document features covered later.

Ground answers in supplied facts

When correctness matters, provide the source material and tell the model to use only that. Add what to do when the answer is not present, for example "If the documents do not say, reply 'Not stated'". This reduces invented answers, though it does not remove them, so verify important outputs.

A before and after

Try this with any task you do often. Write the shortest prompt you can, and run it. Then rewrite it with the four kinds of context and run it again. Put both outputs next to each other. In most cases the second answer will be more specific, more correctly aimed and need fewer follow-up messages. That saved time is the real return on writing a longer prompt, because a few extra input tokens cost far less than another round trip.

Where context should live

Context that is the same for every request, such as company background or style rules, belongs in the system prompt, where it can be cached. Context that changes with every request, such as the document or the user's question, belongs in the user message. Mixing the two makes prompts harder to reuse and cache.

Checklist

  • Who is the audience?
  • What will the output be used for?
  • What facts must be used, and what is the fallback if they are missing?
  • What constraints apply (length, tone, format)?
Was this article helpful?

Comments

No comments yet. Have a question or a tip? Be the first to share it.

Leave a comment

Comments are reviewed before they appear.