---
title: "Prompt Engineering"
description: "How to ask an AI for what you need — the five parts of a clear request, and how to fix a mediocre answer instead of settling for it."
source: "https://www.weblux.co/ai-101/prompt-engineering"
---

# Prompt Engineering

How to ask an AI for what you need — the five parts of a clear request, and how to fix a mediocre answer instead of settling for it.

*About 35 minutes. Updated 2026-08-19.*

## Why Prompts Matter

The quality of your prompt directly determines the quality of the AI’s response. A vague prompt gets a generic answer. A well-crafted prompt gets a precise, useful, and targeted response. Prompt engineering is the skill of communicating your intent clearly to an AI system.

> **Note — The Prompt Gap**
>
> Studies show that the same AI model can perform at a “beginner” or “expert” level depending entirely on how it’s prompted. The difference isn’t the model — it’s the prompt.

Think of prompting like giving instructions to a brilliant but literal-minded assistant. They’ll do exactly what you ask — so the more specific and clear you are, the better the result.

## Anatomy of a Great Prompt

Every effective prompt contains some combination of these five elements. You don’t always need all of them, but the more complex your task, the more elements you should include.

1. **Role**: Who should the AI act as? (e.g., “You are an experienced data scientist…”)
2. **Task**: What specific thing should the AI do? (e.g., “Analyze this dataset and identify trends…”)
3. **Context**: What background information is relevant? (e.g., “This data comes from a 2024 customer survey…”)
4. **Format**: How should the response be structured? (e.g., “Present findings as a bulleted list with…”)
5. **Constraints**: What limitations or boundaries apply? (e.g., “Keep the response under 500 words. Focus only on…”)

```markdown
# Weak prompt:
"Write a follow-up email"

# Strong prompt:
"You write client emails for a plumbing company. Draft a
follow-up to a client who received our quote ten days ago
and has gone quiet.
- Mention the quote date and the job (bathroom refit)
- Friendly, no pressure, one question at the end
- Under 120 words, no exclamation marks"
```

A weak prompt vs. a strong prompt

**Check yourself:** Which element of a prompt helps prevent overly long or off-topic responses?

- Role
- Task
- Context
- Constraints

**Answer:** Constraints. Constraints set boundaries on the response — length limits, topic focus, what to include/exclude. Without constraints, the AI may produce responses that are technically correct but not useful for your specific needs.

## Iterative Refinement and Evaluation

Great prompts rarely emerge fully formed. The best prompt engineers iterate: write a prompt, test it, analyze the output, and refine. This cycle of improvement is where the real skill lies.

1. **Start simple**: Begin with a basic prompt that captures your core intent
2. **Test it**: Run the prompt and carefully read the output
3. **Identify gaps**: What’s missing? What’s wrong? What’s unnecessary?
4. **Add specificity**: Address each gap with more precise instructions
5. **Test variations**: Try different phrasings, structures, and frameworks
6. **Evaluate consistently**: Use the same test cases to compare prompt versions

> **Tip — The 80/20 Rule of Prompting**
>
> You’ll often get 80% of the way with a basic prompt. The last 20% — getting the output exactly right — is where frameworks, XML tags, examples, and constraints become essential.

**Check yourself:** What’s the most effective way to improve a prompt that’s giving mediocre results?

- Use a larger, more expensive model
- Add more text to make the prompt longer
- Identify specific gaps in the output and add targeted instructions
- Start completely over with a different approach

**Answer:** Identify specific gaps in the output and add targeted instructions. The best approach is targeted refinement. Identify exactly what’s wrong with the output (too vague? wrong format? missing information?) and add specific instructions to address those gaps. More text doesn’t help — more precision does.
