Code Safari

Chapter 13·Beginner·11 min read

Basic Prompting: How to Write Prompts That Actually Work

What is a prompt and how do you write a good one? A beginner's guide to basic prompting — the anatomy of a strong prompt, being specific, giving context and format, and the common mistakes that make AI answers vague or wrong.

June 29, 2026

Prompt engineering sounds technical, but it starts with something everyone can learn: writing a clear prompt. And because of how LLMs work — they continue your text — the prompt is the single biggest lever you have over the output. Master the basics here, and every advanced technique in this guide builds naturally on top.

This guide pairs well with How Large Language Models Work. Knowing why the model behaves as it does makes good prompting feel obvious rather than magical.

What a prompt actually is

A prompt is simply the text you give a model to steer its response. That's it. But remember the core fact from the LLM guide: the model doesn't "understand your request" so much as continue the text you provide. So your prompt isn't a command to a colleague — it's the setup that makes a good answer the most likely continuation.

The cardinal rule: be specific

If you remember one thing, remember this: vague in, vague out. The most common reason for a disappointing answer is a prompt that left too much to guess.

Vague promptSpecific prompt
"Write about dogs.""Write a 150-word intro for a blog post on why Labradors make good family pets, friendly tone."
"Fix this code.""This Python function throws a KeyError on empty input. Fix it and explain the change in one sentence."
"Give me ideas.""Give me 5 low-budget marketing ideas for a local coffee shop targeting students."

Every detail you add removes a guess the model would otherwise make — often wrongly. Specificity isn't about long prompts; it's about unambiguous ones.

The anatomy of a strong prompt

You don't need a template for everything, but strong prompts tend to contain four ingredients. Think Task, Context, Format, Constraints:

Task: what to do
Context: what it needs to know
Format: how to answer
Constraints: limits & rules
The four parts of a well-formed prompt
  • Task — the core instruction. "Summarise this email."
  • Context — relevant background the model needs. "It's from an angry customer about a late refund."
  • Format — the shape of the answer. "Give me 3 bullet points."
  • Constraints — limits and rules. "Keep it under 50 words; don't promise a specific date."

Put together:

"Summarise this email from an angry customer about a late refund. Give me 3 bullet points covering their issue, their emotional state, and what they want. Keep it under 50 words and don't promise a specific refund date."

That prompt leaves almost nothing to chance — and the answer reflects it.

Give it a role and an audience

Two small additions punch far above their weight: who the model should be, and who the answer is for.

  • Role: "You are an experienced copy editor." This primes the relevant style and standards.
  • Audience: "Explain this to a non-technical manager." This sets depth, tone, and vocabulary instantly.

Compare "Explain how HTTPS works" with "Explain how HTTPS works to a 10-year-old using an analogy." Same topic, completely different — and far more useful — answer.

Show, don't just tell

When you want a particular style or format, describing it is fine — but showing it is better. One example of the output you want often communicates more than a paragraph of instructions.

"Rewrite these product names in this style: 'CozyKnit Wool Scarf' → 'Wrap up warm: the CozyKnit Wool Scarf.' Now do: 'SteelGrip Hammer'."

That one example pins down the format precisely. This is the seed of few-shot prompting, a technique we'll dedicate a whole chapter to — and it's one of the highest-leverage moves in prompting.

Common beginner mistakes

A quick checklist of what quietly sabotages prompts:

MistakeFix
Too vagueAdd task, context, format, constraints
Asking for too much at onceBreak into steps or separate prompts
Assuming hidden contextState it explicitly — the model only sees the prompt
Burying the instructionPut the key ask up front (mind the context window)
Giving up after one tryIterate — refine based on what came back

That last one matters most. Which brings us to the real secret of prompting.

Prompting is iteration

Nobody writes the perfect prompt first try, and you don't have to. Good prompting is a fast loop: send, read what came back, notice what was missing or misread, adjust, resend.

Write prompt
Read response
Spot the gap
Refine & resend
Prompting is a refinement loop, not a single perfect shot

Each round, you're teaching yourself what this model needs to be told explicitly. That intuition — built through iteration — is what prompt engineering really is.

Recap

  • A prompt is the text that steers the model; because the model continues your text, it's your main lever.
  • Be specific — vague in, vague out. Specificity means unambiguous, not long.
  • Strong prompts include Task, Context, Format, Constraints.
  • Set a role and audience to instantly shape tone, depth, and style.
  • Show examples when you want a specific format — telling is good, showing is better.
  • Iterate — good prompting is a refinement loop, not a perfect first try.

You now know how to write a solid prompt from scratch. Next we name the most basic mode of prompting — asking the model to do something with no examples at all — and learn when it works and when it doesn't. Continue to Zero-shot prompting.

Basic Prompting: How to Write Prompts That Actually Work | Code Safari