Velamuvi AIAcademy

Lesson 1 of 15 · Foundations

What Is Prompt Engineering?

Prompt engineering explained: why the same AI model gives weak or excellent answers depending on how you ask, the draft-test-improve loop and a prompt checker.

  • 8 min read
  • Beginner
  • Reviewed
In this lesson you will learn
  • What prompt engineering is and why it matters
  • Why the same model can give a poor or an excellent answer
  • The draft, test and improve loop at the heart of prompting
  • What prompt engineering is not: magic words and tricks

Same model, very different results

Two people use the same AI model on the same task. One gets a generic, slightly off answer and decides AI "isn't that good". The other gets exactly what they needed. The difference is usually not the model. It is how they asked.

The word "engineering" can sound intimidating. In practice it means two things: clear communication and testing. You write a clear request, look at what comes back, work out why it differs from what you wanted, and improve the request.

See the difference

Click through the three versions of the same request. The responses are examples of the kind of answer each prompt tends to get.

Prompt

Write a product description for our water bottle.

Example response

Stay hydrated in style with our premium water bottle! Crafted from high-quality materials, it keeps your drinks cold for hours. Perfect for the gym, the office or outdoor adventures. Order yours today!

Generic. The model had to guess the audience, the selling points and the length, so it wrote the most average description possible.

Each version removes guesses. The model did not get smarter; the request got clearer.

The loop: draft, test, improve

Good prompts are rarely written in one go. They come from a loop:

  1. Decide what good looks like. What exactly should the output contain? Who reads it? How long is it?
  2. Draft a prompt that says all of that.
  3. Test it and read the output critically. For a prompt you will reuse, test it on several different inputs.
  4. Diagnose. Is something missing, wrong, too long, in the wrong tone? Which part of the prompt caused it?
  5. Improve the prompt and test again.

A tiny prompt checker

Software can't judge a prompt the way a person can, but simple checks catch the most common gaps. The program below looks for clues that a prompt names its audience, length, format and purpose.

Try it yourselfPython
def check_prompt(prompt):
    text = prompt.lower()
    checks = {
        "names the audience": ["audience", "reader", "parents", "beginners", "customers", "students"],
        "gives a length": ["words", "sentences", "bullet", "paragraph"],
        "gives a format": ["list", "table", "bullet", "email", "json", "paragraph"],
        "gives a reason or context": ["because", "so that", "context", "we are", "i am", "i'm"],
    }
    missing = []
    for name, clues in checks.items():
        found = False
        for clue in clues:
            if clue in text:
                found = True
        if not found:
            missing.append(name)
    return missing

prompts = [
    "Write a product description for our new water bottle.",
    "Write a product description for our new water bottle, for busy parents. "
    "We are a small eco brand, so stress that it is plastic-free. "
    "Use 3 bullet points and under 60 words.",
]

for prompt in prompts:
    missing = check_prompt(prompt)
    print(prompt[:45] + "...")
    if missing:
        print("  missing:", ", ".join(missing))
    else:
        print("  looks complete")

The checks are crude: they look for words, not meaning. But they capture the right questions, and the second prompt passes because it answers them. You will build better checks in the lesson on testing prompts.

What prompt engineering is not

  • Not magic words. There is no secret phrase that unlocks a hidden better model. Tricks that once helped older models (threats, bribes, all capital letters) do little or harm with modern ones.
  • Not one perfect prompt. A prompt that works well for one model or one kind of input may need adjusting for another. That is why testing matters.
  • Not only for programmers. Most of the skill is clear writing. The later lessons on templates and testing add some code for people building apps.

Common mistakes

Practice exercise

Rewrite the weak prompt until the checker finds an audience, a length, a format and a reason. Any wording that passes is fine.

Your solutionPython
def check_prompt(prompt):
    text = prompt.lower()
    checks = {
        "names the audience": ["audience", "reader", "parents", "beginners", "customers", "students"],
        "gives a length": ["words", "sentences", "bullet", "paragraph"],
        "gives a format": ["list", "table", "bullet", "email", "json", "paragraph"],
        "gives a reason or context": ["because", "so that", "context", "we are", "i am", "i'm"],
    }
    missing = []
    for name, clues in checks.items():
        found = False
        for clue in clues:
            if clue in text:
                found = True
        if not found:
            missing.append(name)
    return missing

# Rewrite this prompt so the checker prints: looks complete
prompt = "Explain what a budget is."

missing = check_prompt(prompt)
if missing:
    print("missing:", ", ".join(missing))
else:
    print("looks complete")
Knowledge check

A prompt gets a generic answer that misses what you needed. What is usually the most useful next step?

Summary

  • Prompt engineering is clear communication plus testing.
  • The same model gives very different results depending on how you ask.
  • Work in a loop: decide what good looks like, draft, test, diagnose, improve.
  • There are no magic words; there are clear requests and tested prompts.

Next: the parts that make up a good prompt.

Finished reading? Tick it off to track your progress.