Courses Understanding Artificial Intelligence Prompt Engineering: Talking to AI

Using AI Effectively

Prompt Engineering: Talking to AI

How to get dramatically better results from AI models

12 min read · Lesson 7 of 18

The Prompt Is Everything

The single biggest factor in the quality of AI output isn't the model — it's your prompt. The same model that produces a vague, useless response to one prompt can produce brilliant, detailed output to another. Learning to write good prompts is the highest-leverage AI skill you can develop.

A prompt is simply the text you send to an AI model. It can be a question, an instruction, a scenario, or a combination. The model generates its response based entirely on what your prompt contains.


Bad Prompts vs. Good Prompts

Let's see the difference with concrete examples:

Example 1: Writing Help

Bad: "Write about marketing."

Good: "Write a 500-word blog post explaining three low-cost marketing strategies for a small bakery that just opened in a suburban neighborhood. Tone: friendly and practical. Audience: first-time business owners."

The first prompt gives the model almost nothing to work with. The second provides topic, length, specificity, tone, and audience — the model can produce something genuinely useful.

Example 2: Coding

Bad: "Fix my code."

Good: "This Python function should return the sum of even numbers in a list, but it's returning the sum of all numbers. Here's the code: [paste code]. What's wrong and how do I fix it?"

Example 3: Analysis

Bad: "Is this a good business idea?"

Good: "I'm considering opening a dog-walking service in downtown Portland. My target market is working professionals with dogs. Startup cost would be about $2,000. Analyze the strengths and weaknesses of this business idea, and identify the three biggest risks."

The pattern is clear: specific prompts get specific, useful answers. Vague prompts get vague, generic answers. The model mirrors the precision of your input.

Key Prompting Techniques

1. Zero-Shot Prompting

This is the simplest approach: just ask directly, with no examples. It works well for straightforward tasks.

"Classify this customer review as positive, negative, or neutral: 'The product arrived on time but the packaging was damaged.'"

2. Few-Shot Prompting

Provide a few examples of the input-output pattern you want, then give the model a new input. This is remarkably powerful for establishing formatting and style.

"Here are some product descriptions and their categories:
'Wireless noise-canceling headphones with 30hr battery' → Electronics
'Organic cotton fitted sheet, queen size' → Home & Bedding
'Stainless steel insulated water bottle, 32oz' → Kitchen & Dining

Now classify: 'Ergonomic mesh office chair with lumbar support' →"

The model picks up the pattern and responds correctly: "Furniture & Office."

3. Chain-of-Thought Prompting

For reasoning tasks, asking the model to "think step by step" dramatically improves accuracy. Without this, models often jump to conclusions. With it, they work through problems methodically.

Without chain-of-thought: "If a store has 15% off and then an additional 10% off, what's the total discount?"
Model might say "25%" (wrong).

With chain-of-thought: "Think step by step: If a store has 15% off and then an additional 10% off, what's the total discount?"
Model works through it: 15% off leaves 85%, then 10% off that leaves 76.5%, so total discount is 23.5%.

4. Role Assignment

Giving the model a role changes how it responds. "You are an experienced tax accountant" produces different output than "You are a creative writing teacher" — even for the same question.

"You are a senior software architect reviewing code for a junior developer. Review this function for potential issues, explaining each concern clearly enough for someone with one year of experience."


System Prompts

Many AI applications use system prompts — special instructions given to the model before the user's message. System prompts set the model's behavior, personality, and constraints for an entire conversation.

When you use an AI assistant through an app or API, there's almost always a system prompt you don't see that says something like: "You are a helpful assistant. Be concise. Don't produce harmful content. If you don't know something, say so."

System prompts are why the same underlying model can power a customer service bot, a coding assistant, and a creative writing tool — each with a different personality and set of constraints.


Practical Tips

  • Be specific about format: "Respond as a bulleted list" or "Give me a table comparing X and Y."
  • Set constraints: "In 200 words or less" or "Using only information from the provided text."
  • Iterate: If the first response isn't right, refine your prompt rather than starting over. "Good, but make it more concise" or "Focus more on the financial aspects."
  • Provide context: The more relevant background you give, the better the response. Paste the actual document, code, or data you're asking about.
  • Ask for alternatives: "Give me three different approaches to this problem" prevents the model from fixating on one solution.

Key Takeaways

  • The quality of AI output depends heavily on the quality of your prompt.
  • Specific, detailed prompts with clear context produce dramatically better results than vague ones.
  • Few-shot prompting (providing examples) is powerful for establishing patterns and formats.
  • Chain-of-thought ("think step by step") improves reasoning accuracy.
  • Role assignment and system prompts shape the model's behavior and perspective.
  • Prompting is an iterative skill — refine and adjust rather than expecting perfection on the first try.
Ask about this lesson