Back to Learn

Prompt Engineering

The art and science of writing effective AI prompts

What is Prompt Engineering?

Prompt engineering is the practice of crafting inputs (prompts) to get better outputs from AI models. The same AI can give dramatically different results depending on how you ask.

It's like learning to ask the right questions—a skill that becomes more valuable as AI becomes more capable.

Key Principle

AI doesn't read minds. The more context and specificity you provide, the better results you'll get.

Core Techniques

Be Specific

Vague prompts get vague results.

  • ❌ "Write about dogs"
  • ✅ "Write a 200-word article about why golden retrievers make great family pets, aimed at first-time dog owners"

Provide Context

Tell the AI who you are, what you need, and why.

  • ❌ "Explain machine learning"
  • ✅ "I'm a marketing professional with no technical background. Explain machine learning in terms I can use when talking to our data science team"

Specify Format

Tell the AI exactly how you want the output structured.

  • "Give me a bullet list"
  • "Format as a markdown table"
  • "Write in the style of a tweet"

Use Examples (Few-Shot)

Show the AI what you want by providing examples.

"Convert these sentences to past tense:
Input: I run → Output: I ran
Input: She sings → Output: She sang
Input: They jump → Output:"

Advanced Techniques

Chain of Thought

Ask the AI to think step by step. This dramatically improves reasoning on complex problems.

"Solve this math problem step by step, showing your work..."

Role Prompting

Assign the AI a persona or role.

"You are an experienced Python developer. Review this code for bugs and suggest improvements..."

Constraints

Set boundaries on the response.

"Explain quantum computing in 3 sentences, using only words a 10-year-old would understand."

Common Mistakes

  • Too vague — "Help me with my project"
  • Too long — Burying the key request in paragraphs of context
  • Assuming knowledge — Not providing necessary background
  • Not iterating — Accepting the first response instead of refining

Iteration is Key

Prompt engineering is a conversation, not a one-shot:

  1. Start with your best prompt
  2. Evaluate the response
  3. Refine: "Make it shorter," "Add more examples," "Focus on X"
  4. Repeat until satisfied

Summary

  • • Prompt engineering is crafting inputs for better AI outputs
  • • Key techniques: be specific, provide context, specify format
  • • Advanced: chain of thought, role prompting, examples
  • • Always iterate and refine your prompts