# Prompt Engineering

> The Prompt Engineering is the practice of designing prompts to get accurate and useful results from AI models.

## What is prompt engineering and how do I write better prompts?

The practice of writing and iterating on prompts to get reliable results. Includes giving clear instructions and context, providing examples, specifying the output format and splitting complex tasks into steps.

- Topic: Prompting
- Type: practice

## Example

Wrong:

```text
Make this code better.
{{code}}
```

Right:

```text
Review the function below for bugs and readability.
Return a list of issues, each with the line number and a fix.
If there are no issues, return 'No issues'.
<code>
{{code}}
</code>
```

The better prompt names the task, the output format and the empty case, so results are consistent and easy to test.

## Common mistakes

- Changing a prompt to fix one case and silently breaking others.

## Key points

- The prompt says the task, the context, the constraints and the exact output format.
- Instructions and input data are separated with clear delimiters such as tags or headings.
- The prompt says what to do when information is missing instead of guessing.
- Prompt changes are checked against a fixed set of test inputs.

## Interview questions

### Is prompt engineering still needed with smarter models?

Yes. Stronger models need fewer tricks, but they still need a clear task, context and output format to give the answer you want.

### How do I test a prompt?

Run it on a fixed set of real inputs with known good outputs and compare results after each change. This set is often called an eval.

### Prompt engineering vs fine-tuning?

Prompting changes the input and is fast to iterate. Fine-tuning changes the model weights and suits stable tasks with many examples.

## Related cards

- [Context Engineering](https://wonderium.dev/ai/context-engineering.md)
- [Few-Shot Prompting](https://wonderium.dev/ai/few-shot-prompting.md)
- [System Prompt](https://wonderium.dev/ai/system-prompt.md)
- [Evals](https://wonderium.dev/ai/evals.md)
- [Prompt Template](https://wonderium.dev/ai/prompt-template.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/prompt-engineering
- Last updated: 2026-11-25
