Skip to content

Prompt Fundamentals

Welcome, Word Wizards!

Polly waving welcome Time to talk to AI! This is where the real fun begins. You know what's happening inside the machine — now let's learn how to talk to it. Think of this chapter as your first conversation class, except your conversation partner has read most of the internet. No pressure.

What Is a Prompt?

A prompt is simply the text you send to an AI model. That's it. Whether you type "What's the capital of France?" or write a 500-word instruction with examples, formatting requirements, and persona definitions — it's all a prompt.

But here's the thing: not all prompts are created equal. The difference between a mediocre AI response and a brilliant one almost always comes down to the quality of the prompt. This is the core insight of prompt engineering — the systematic practice of crafting prompts that consistently produce excellent results.

If prompt engineering had a bumper sticker, it would read: "Garbage in, garbage out. Gold in, gold out."

The Input-Output Paradigm

Every interaction with a large language model follows the input-output paradigm: you provide input (the prompt), the model processes it, and it returns output (the response). Simple, right?

What makes this interesting — and what separates skilled prompt engineers from everyone else — is that you have enormous control over the output by changing the input. Small changes to your prompt can produce dramatically different responses.

Consider these two prompts asking the same thing:

Prompt Likely Response
"Tell me about dogs." A generic, rambling overview of dogs
"List 5 differences between Golden Retrievers and Labrador Retrievers in a markdown table with columns for Feature, Golden Retriever, and Labrador." A precise, well-formatted comparison table

Same topic. Completely different results. The second prompt succeeds because it applies the principles we're about to learn.

Prompt Structure: The Anatomy of a Great Prompt

Prompt structure refers to how you organize the different elements of your instruction. A well-structured prompt typically contains some combination of these components:

  • Role — Who should the AI pretend to be? ("You are an experienced data scientist...")
  • Task — What should the AI do? ("Analyze this dataset and identify trends...")
  • Context — What background information does the AI need? ("The data covers sales from 2020-2024...")
  • Constraints — What limitations should the AI follow? ("Keep your response under 200 words...")
  • Output format — How should the response be structured? ("Present your findings as a numbered list...")

Not every prompt needs all five components. A quick question like "What year was the Eiffel Tower built?" works fine as a standalone task. But for complex requests, including more components consistently produces better results.

Here's a real example putting it all together:

1
2
3
4
5
Role: You are a nutritionist writing for a health magazine.
Task: Create a 7-day meal plan for someone trying to eat more vegetables.
Context: The person is a busy professional who has 30 minutes max for cooking.
Constraints: No recipes requiring more than 5 ingredients. Avoid nuts (allergy).
Format: Present as a markdown table with columns for Day, Breakfast, Lunch, Dinner.

That prompt is going to get you a much better response than "Give me a meal plan."

Instruction Clarity: Say What You Mean

Instruction clarity is perhaps the single most important principle in prompt engineering. Clear instructions leave no room for the model to guess what you want.

The challenge is that AI models take your words literally — but not always in the way you intend. When you say "make it better," the model has to guess what "better" means. Shorter? More formal? More detailed? Funnier? More accurate? The model will pick something, and it might not be what you had in mind.

Key Insight

Polly thinking Words matter - let's get them right! Here's Polly's golden rule: if two different people could reasonably interpret your prompt in two different ways, the AI definitely will too. Rewrite until there's only one reasonable interpretation.

Compare these instructions:

  • Vague: "Improve this email."
  • Clear: "Rewrite this email to be more concise (under 150 words), use a professional but friendly tone, and add a clear call-to-action in the final sentence."

The clear version tells the model exactly what "improve" means in this context. That's instruction clarity in action.

Specificity: The Devil Is in the Details

Specificity goes hand-in-hand with clarity. While clarity is about what you want, specificity is about providing enough detail that the model doesn't have to fill in gaps with assumptions.

Specificity means including:

  • Quantities — "Give me 5 examples" not "Give me some examples"
  • Dimensions — "Write 300 words" not "Write a short paragraph"
  • Scope — "Focus on renewable energy in Southeast Asia since 2020" not "Tell me about energy"
  • Quality criteria — "Include at least one statistic per point" not "Make it informative"
  • Audience — "Explain for a 10-year-old" not "Explain simply"

Every detail you don't specify is a decision the model makes for you. Sometimes that's fine. But when the output matters, specificity is your best friend.

Ambiguity Avoidance: Close the Loopholes

Ambiguity avoidance means actively identifying and eliminating words, phrases, or structures in your prompt that could be interpreted multiple ways.

Common sources of ambiguity in prompts:

Ambiguous Phrase The Problem Better Alternative
"Make it better" Better how? "Make it more concise and formal"
"A few examples" How many is "a few"? "Exactly 3 examples"
"Recent data" How recent? "Data from 2023 onward"
"Important points" Important to whom? "The 5 points most relevant to budget decisions"
"Keep it short" How short? "Maximum 100 words"

A helpful technique: after writing your prompt, read it as if you were a very literal-minded person who wants to do the least work possible. Any loophole you'd exploit? The model might exploit it too.

Task Decomposition: Breaking Big Jobs into Small Ones

Task decomposition is the practice of breaking a complex request into smaller, manageable steps. This is one of the most powerful techniques in prompt engineering because it mirrors how the model actually works — generating tokens one at a time, building on what came before.

Instead of asking:

"Write a complete marketing strategy for my new product."

Try decomposing it:

  1. "Identify the top 5 target demographics for a sustainable water bottle aimed at outdoor enthusiasts."
  2. "For each demographic, suggest 3 key messaging themes."
  3. "Write a 200-word product description targeting the most promising demographic."
  4. "Create 5 social media post ideas based on the messaging themes."

Each step is clear, focused, and builds on the previous result. The AI can concentrate on one thing at a time, and you can course-correct between steps if something goes off track.

This is also much better for your token budget. A single mega-prompt that goes sideways wastes all those tokens. Decomposed steps let you catch problems early.

Prompt Length: Finding the Sweet Spot

Prompt length matters more than you might think. Too short, and you haven't given the model enough to work with. Too long, and you risk burying your actual instruction in noise.

Here's the general principle:

  • Too short: "Write about climate change." (The model will produce something generic because you gave it no direction.)
  • Too long: A 2,000-word prompt with every possible detail about what you want, including lengthy examples, edge cases, and tangential background. (The model may lose focus or miss key instructions buried in the middle.)
  • Just right: Clear task, relevant context, specific constraints, desired format. Usually 50-300 words for most tasks.

Polly's Tip

Polly giving a tip Use your words! But not ALL of them. The sweet spot for most prompts is the minimum length that leaves nothing important ambiguous. Every sentence should earn its place. If a sentence in your prompt doesn't change the output, cut it.

The Art of Iteration

Now we arrive at the secret weapon that separates good prompt engineers from great ones: prompt iteration. Almost nobody writes a perfect prompt on the first try. The real skill is in the refinement cycle.

Prompt iteration follows a simple loop:

  1. Write your initial prompt
  2. Send it to the model
  3. Evaluate the response
  4. Diagnose what went wrong (or right)
  5. Refine the prompt based on your diagnosis
  6. Repeat until the response meets your standards

This isn't failure — this is the process. Professional prompt engineers iterate constantly. The difference is they iterate systematically, changing one thing at a time so they understand what's working.

Prompt Testing: Being Scientific About It

Prompt testing takes iteration a step further by applying a more rigorous approach. Instead of just "does this look good?", testing means running your prompt multiple times and across different inputs to see how consistently it performs.

Key testing practices:

  • Run the same prompt multiple times — AI responses have some randomness. A prompt that works once might fail the next time.
  • Test with different inputs — If your prompt is a template ("Summarize this article: {article}"), test it with articles of different lengths, topics, and complexity.
  • Compare variations — Try two versions of a prompt and see which consistently produces better results.
  • Document what works — Keep notes on which prompts succeeded and why.

This might sound like overkill for casual use, but for any prompt you plan to use repeatedly (business workflows, content creation, data analysis), testing saves enormous time in the long run.

Evaluating Response Quality

How do you know if a response is "good"? Response quality and response evaluation require clear criteria. Here are the four dimensions that matter most:

Relevance

Does the response actually address what you asked? Relevance means the output is on-topic and answers the question or completes the task. A beautifully written response that doesn't answer your question scores zero on relevance.

Accuracy

Is the information correct? Accuracy is about factual correctness. AI models can produce confident-sounding information that's completely wrong (this is called hallucination, which we'll cover in Chapter 8). Always verify critical facts.

Completeness

Did the response cover everything you asked for? Completeness means all parts of your request were addressed. If you asked for 5 examples and got 3, that's incomplete — even if the 3 are excellent.

Conciseness

Is the response appropriately brief? Conciseness means no unnecessary padding, repetition, or filler. Some responses are accurate and complete but bury the useful information in paragraphs of fluff.

These four dimensions often trade off against each other. A very concise response might sacrifice completeness. A very complete response might sacrifice conciseness. Part of becoming a skilled prompt engineer is knowing which dimension matters most for each task.

Dimension Question to Ask Red Flag
Relevance Does this answer my question? Response wanders off-topic
Accuracy Is this factually correct? Specific claims without sources
Completeness Did it cover everything I asked? Missing items from my request
Conciseness Is every sentence necessary? Repetitive paragraphs, filler phrases

Natural Language Commands: Talking Like a Human

A natural language command is simply an instruction written in everyday language rather than code or formal syntax. This is what makes prompt engineering so accessible — you don't need to learn a programming language. You just need to write clearly.

However, "natural language" doesn't mean "casual language." The best prompts use natural language that is:

  • Direct — "List the top 5 causes" not "Could you maybe think about listing some causes if you don't mind?"
  • Specific — "In 200 words or less" not "Keep it shortish"
  • Structured — Use numbered steps, bullet points, or sections to organize complex instructions
  • Actionable — Start with a verb: "Write," "Analyze," "Compare," "Create," "List"

One common mistake is being overly polite. While there's nothing wrong with saying "please," phrases like "I was wondering if perhaps you might be able to..." waste tokens and add ambiguity. The model doesn't have feelings to hurt. Be direct.

You Can Do This!

Polly encouraging Let's craft the perfect prompt! Here's the wonderful truth: you already know how to communicate clearly with humans. Prompt engineering is just applying that same skill to AI — with a few extra tricks. And the best part? Unlike humans, AI never judges you for rephrasing the same question five times until you get it right.

Putting It All Together

Let's see these principles in action with a before-and-after example.

Before (unfocused prompt):

Write something about productivity tips for remote workers.

After (applying all principles):

Write a listicle of 7 practical productivity tips for remote workers who struggle with work-life boundaries. Target audience: professionals aged 25-40 who work from home full-time. For each tip, include a one-sentence explanation and one concrete example of how to implement it. Tone: conversational and encouraging, not preachy. Format: numbered list with bold tip titles. Length: 400-500 words total.

The second prompt applies instruction clarity, specificity, ambiguity avoidance, and output format specification. It will produce a dramatically better response — and it took about 30 seconds longer to write.

That 30 seconds is the best investment in quality you'll ever make.

Diagram: Prompt Iteration Cycle

Prompt Iteration Cycle

Type: infographic sim-id: prompt-iteration-cycle
Library: p5.js
Status: Specified

Purpose: Visualize the iterative prompt refinement loop showing how each cycle improves response quality.

Bloom Level: Understand (L2) Bloom Verb: explain, summarize Learning Objective: Explain the iterative process of prompt refinement and how each step contributes to improving response quality.

Layout: Circular diagram with 5 nodes arranged in a clockwise cycle, with a quality indicator in the center.

Nodes (clockwise from top): 1. "Write Prompt" (blue) — Hover: "Draft your initial prompt with clear structure and specific instructions" 2. "Send to Model" (blue) — Hover: "Submit the prompt and receive the AI's response" 3. "Evaluate Response" (orange) — Hover: "Check relevance, accuracy, completeness, and conciseness" 4. "Diagnose Issues" (orange) — Hover: "Identify what went wrong: too vague? missing context? wrong format?" 5. "Refine Prompt" (blue) — Hover: "Make targeted changes based on your diagnosis"

Center: Quality gauge that fills from red to green as iterations increase (animated).

Arrows: Curved arrows connecting each node to the next in clockwise order.

Interactive features: - Click any node to see a concrete example (e.g., clicking "Diagnose Issues" shows: "Response was too generic → Diagnosis: prompt lacked specificity → Fix: add word count and audience") - Quality gauge in center advances with each click-through of the cycle - Reset button to start over

Color scheme: Blue for action steps, orange for evaluation steps, green for the quality indicator.

Responsive: Must adapt to window width.

Instructional Rationale: A cyclical diagram reinforces that iteration is a loop, not a failure. The quality gauge in the center makes the abstract concept of "improvement" tangible. Click-through examples ground each step in practice.

Implementation: p5.js canvas with interactive nodes and animated center gauge

Diagram: Prompt Quality Evaluator

Prompt Quality Evaluator

Type: microsim sim-id: prompt-quality-evaluator
Library: p5.js
Status: Specified

Purpose: Let students evaluate sample prompts against the four quality dimensions (relevance, accuracy, completeness, conciseness) and see how their ratings compare to expert ratings.

Bloom Level: Evaluate (L5) Bloom Verb: assess, judge Learning Objective: Assess the quality of AI prompts and responses using the four evaluation dimensions.

Layout: - Top area: Display a sample prompt and response pair - Middle area: Four slider controls (one per quality dimension, 1-10 scale) - Bottom area: Score comparison panel showing student rating vs. expert rating

Controls: - "Next Prompt" button to cycle through 5 pre-loaded prompt/response examples - Four sliders: Relevance (1-10), Accuracy (1-10), Completeness (1-10), Conciseness (1-10) - "Check My Ratings" button to reveal expert scores

Pre-loaded examples (5 pairs): 1. A vague prompt with a wandering response (low relevance) 2. A specific prompt with a factually incorrect response (low accuracy) 3. A good prompt with a partial response (low completeness) 4. A good prompt with a bloated response (low conciseness) 5. An excellent prompt with an excellent response (high on all dimensions)

Visual feedback: - Green highlight when student rating is within 2 points of expert - Yellow highlight when student rating is within 3-4 points - Red highlight when student rating is 5+ points away - Overall score displayed as percentage match

Responsive: Must adapt to window width.

Instructional Rationale: Active evaluation practice (rating then comparing to experts) builds assessment skills at Bloom's Evaluate level. Students internalize quality criteria through calibration rather than passive reading.

Implementation: p5.js with text rendering and slider controls

Key Takeaways

  • A prompt is your instruction to the AI; prompt engineering is the art of writing great ones
  • The input-output paradigm means you control the output by controlling the input
  • Great prompts have clear structure: role, task, context, constraints, format
  • Clarity and specificity eliminate guesswork; ambiguity avoidance closes loopholes
  • Task decomposition breaks complex jobs into manageable steps
  • Prompt iteration is the process, not a sign of failure — iterate systematically
  • Evaluate responses on four dimensions: relevance, accuracy, completeness, conciseness
  • Use natural language commands that are direct, specific, and actionable

Remember: prompt engineering is always evolving, but the fundamentals in this chapter are timeless. Clear communication has always been a superpower — now it just has a new application.

Concepts

  1. Prompt
  2. Prompt Engineering
  3. Input-Output Paradigm
  4. Prompt Structure
  5. Instruction Clarity
  6. Specificity
  7. Ambiguity Avoidance
  8. Task Decomposition
  9. Prompt Length
  10. Prompt Iteration
  11. Prompt Testing
  12. Response Quality
  13. Response Evaluation
  14. Relevance
  15. Accuracy
  16. Completeness
  17. Conciseness
  18. Natural Language Command

Prerequisites