How to Write Better Prompts for AI

Beginner 10 min read

A beginner-friendly introduction to how to write better prompts for ai

prompt-engineering chatgpt practical
📚 Part 1 of 3 Prompt Engineering Mastery

Introduction

Getting good results from AI like ChatGPT depends heavily on how you ask your questions. In this guide, you’ll learn practical techniques to write prompts that get you better, more useful responses from AI systems.

Prerequisites

Basic familiarity with using AI chatbots like ChatGPT is helpful but not required.

Why Prompts Matter

Think of prompting like giving directions. If you tell someone “go that way,” they might end up anywhere. But if you say “walk two blocks north, turn right at the coffee shop,” they’ll get exactly where you want them to go.

AI is similar—the clearer and more specific your instructions, the better the results.

The Basic Principles

1. Be Specific

Bad Prompt: “Tell me about dogs”

Good Prompt: “Explain the differences between Golden Retrievers and Labrador Retrievers in terms of temperament, size, and care requirements”

The second prompt tells the AI exactly what aspects you care about.

2. Provide Context

Bad Prompt: “How do I fix this?”

Good Prompt: “I’m a beginner learning Python. My code gives an ‘IndexError: list index out of range’ error. How do I fix this type of error?”

Context helps the AI understand your level and situation, leading to more appropriate answers.

3. Specify the Format You Want

Bad Prompt: “What should I know about starting a garden?”

Good Prompt: “Give me a step-by-step beginner’s guide to starting a vegetable garden, with each step as a numbered list item”

This tells the AI how to structure the response.

Advanced Prompting Techniques

The Role Technique

Ask the AI to take on a specific role or expertise:

“You are an experienced piano teacher. Explain to a complete beginner how to read sheet music.”

This focuses the AI’s knowledge on the relevant domain.

The Example Technique

Show the AI what you want by giving examples:

“Generate three business name ideas similar to these examples: Netflix, Spotify, Pinterest. They should be: catchy, made-up words, and easy to remember.”

The Step-by-Step Technique

Ask the AI to think through problems step-by-step:

“Let’s solve this math problem step by step. First, identify what we know. Then, determine what we need to find. Finally, work through the solution.”

Breaking it down often leads to better reasoning.

💡 Pro Tip: Combining techniques works wonders! Try “You are a data scientist. Using the example datasets I provided, explain step-by-step how to identify outliers.” Multi-technique prompts often yield the best results.

Common Mistakes to Avoid

Mistake 1: Being Too Vague

Vague prompts get vague answers. If you’re not satisfied with a response, ask yourself: “Could I follow these instructions myself?”

Mistake 2: Assuming Too Much Context

The AI doesn’t remember your previous conversations (in a new chat) or know your personal situation unless you tell it.

Mistake 3: Not Iterating

Your first prompt rarely gives perfect results. Treat it as a conversation:

  1. Start with a prompt
  2. See what you get
  3. Refine and ask follow-up questions
  4. Repeat until satisfied

Real-World Examples

Example 1: Getting Recipe Help

Initial: “How do I make pasta?”

Better: “I have spaghetti, tomatoes, garlic, and olive oil. Give me a simple 30-minute recipe with step-by-step instructions.”

Even Better: “I’m cooking for someone with a gluten allergy. Suggest a pasta substitute and give me a recipe using tomatoes, garlic, and olive oil that takes under 30 minutes.”

Example 2: Learning a Concept

Initial: “Explain blockchain”

Better: “Explain blockchain to someone who understands basic computer concepts but has never heard of cryptocurrency”

Even Better: “Explain blockchain using an analogy to something in everyday life, then describe one practical use case that isn’t cryptocurrency”

Try It Yourself

  1. Practice Specificity: Take a vague question you might ask AI and rewrite it three times, each time adding more specific details.

  2. Test Different Formats: Ask the same question but request different formats (bullet points, table, step-by-step guide) and see how the responses differ.

  3. Role Playing: Try asking the same question with and without the role technique. Compare the responses.

  4. Iteration Exercise: Start with a simple prompt, then ask 3 follow-up questions to refine the answer. Notice how each iteration improves the result.

The Prompt Template

Here’s a template you can use for complex prompts:

[Role/Context]: You are a [expertise]
[Task]: I need you to [specific action]
[Constraints]: Keep it [length/difficulty/style]
[Format]: Present this as [format type]
[Example]: Similar to [example if applicable]

Example using template: “You are a fitness trainer. I need you to create a 3-day workout plan for a beginner who has 30 minutes per day and no equipment. Keep it simple with clear instructions. Present this as a table with columns for Day, Exercise, Sets/Reps, and Tips.”

Key Takeaways

  • Specificity is your best friend—tell the AI exactly what you want
  • Provide context about your situation, knowledge level, and constraints
  • Specify the format you want (list, table, paragraph, etc.)
  • Use techniques like role-playing and examples to guide the AI
  • Don’t be afraid to iterate—refine your prompts based on what you get back
  • Treat it as a conversation, not a one-shot question

Next Steps

Ready to level up your prompt engineering skills?

In Part 2: Advanced Prompt Engineering Techniques, you’ll learn:

  • Few-shot learning for consistent outputs
  • Chain-of-thought prompting for complex reasoning
  • Prompt chaining for multi-step tasks
  • Advanced prompt patterns professionals use
  • How to test and improve prompt reliability

Further Reading

Ready to explore more AI concepts?