Zero to AI Engineer

Module 13 of 54

Module 13: Prompting & Using LLMs

4 min read779 words
What you'll learn
Write clear, effective promptsUse the four parts of a strong promptApply techniques like few-shot and step-by-stepImprove prompts through iteration

"The model is only as clear as your request. Prompting well is the fastest, cheapest way to get dramatically better AI output."

Level: Beginner · Time: ~13 min · Prerequisites: Module 12

Learning Objectives

By the end of this module, you will be able to:

  • Write clear, effective prompts
  • Use the four parts of a strong prompt
  • Apply techniques like few-shot and step-by-step
  • Improve prompts through iteration

1. A Prompt Is a Brief

A prompt is the instruction you give an LLM. Prompting well is less about secret tricks and more about clear communication — like briefing a capable new assistant.

Strong prompts usually have four parts:

  • Instruction — what to do ("Summarize…", "Write…")
  • Context — who it's for, background
  • Examples — show the style you want
  • Constraints — length, format, tone

Explain like I'm new: "Write about dogs" is a vague brief and gets a vague result. "Write a friendly 100-word intro for first-time dog owners, warm tone, one tip, end with a question" is a clear brief — and the output transforms.

Think about how you'd hand a task to a smart new colleague. You wouldn't just say "handle the report" — you'd say what report, for whom, by when, and in what format. The LLM has no way to read your mind or ask a clarifying question mid-task, so every detail you don't give it becomes a detail it has to guess. Prompting is simply the discipline of guessing less on the model's behalf.

2. Bad Prompt vs. Better Prompt

❌ Vague✅ Improved
"Fix my email.""Make this email more polite and under 5 sentences, friendly tone: [paste]"
"Explain APIs.""Explain APIs to a beginner using a restaurant analogy, under 120 words."

The improved versions add audience, format, length, and tone — same model, far better output.

Key idea: Adding specifics (audience, format, constraints) is the single biggest lever in prompting. You're removing the model's guesswork and pointing it at exactly the target you want.

3. Reliable Techniques

  • Few-shot: show 1–3 examples of the input→output you want. Powerful for steering style/format. (Giving zero examples and just asking is called zero-shot.)
  • Step-by-step: "think through this step by step" often improves reasoning and accuracy — nudging the model to show its work instead of blurting a final answer. This is often called chain-of-thought prompting.
  • Role: "You are a patient tutor" sets tone and depth.
  • Format: ask for a table, bullet list, or JSON — especially useful when another program will read the output.

Real-world use case: In an app, developers write a system prompt once ("You are a support agent for a bakery; only answer from these facts…") that shapes every user interaction. Prompt design is a core skill in building LLM products — and LangChain (next modules) helps manage prompts at scale.

4. Iterate

Prompting is a loop: write, see where the output falls short, fix that one thing, run again. Pros rarely nail it first try — they refine. Treat it like debugging code: if the output is too long, add a length limit and rerun; if the tone is off, name the tone and rerun. Because you change one thing at a time, you always know which tweak helped — and you slowly build a personal library of phrasings that reliably work.

Common mistake: Rewriting the whole prompt from scratch when one detail is off. Change a single variable — add an example, tighten a constraint — and see what improves. You'll learn faster and keep what worked.

Hands-On: Try This

Try this: Take a vague request you'd normally type and rewrite it adding three things: who it's for, how long, and what format. Run both versions and compare. The upgrade is almost always obvious.

✅ Checkpoint

  1. Name the four parts of a strong prompt.
  2. What is few-shot prompting?
  3. What's the right way to improve a prompt that's slightly off?

Answers: 1) Instruction, context, examples, constraints. 2) Showing the model a few examples of the desired input→output. 3) Change one variable at a time and iterate.

Key Takeaway: A prompt is a clear brief — instruction, context, examples, constraints. Adding audience, format, length, and tone dramatically improves output. Use few-shot examples, step-by-step reasoning, and roles; in apps, a system prompt shapes every interaction. Improve prompts by iterating one change at a time.

Further Learning

Part of "Zero to AI Engineer." Adapted from Microsoft's open curricula (MIT License).