---
title: "What is prompt engineering? Writing instructions for LLMs"
description: "Prompt engineering is writing and testing instructions so an LLM gives the output you need, every time. Core techniques, how to test them, and Arabic prompt tips."
url: https://broadrouter.com/glossary/prompt-engineering/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Prompt engineering

Updated 2026-11-15

Prompt engineering is the process of writing, structuring and testing the instructions given to a language model so that it consistently produces output that meets your requirements. It covers role messages, clear instructions, examples, formatting, and measuring results against test cases.

Also called: prompt design, prompting techniques

A prompt is a specification. Prompt engineering is writing it well and checking that the model follows it.

## How it works

OpenAI’s guide defines prompt engineering as “the process of writing effective instructions for a model” so it “consistently generates content that meets your requirements.” The core techniques overlap across vendors:

| Technique | What to do |
| --- | --- |
| Roles | Put rules in the [system prompt](https://broadrouter.com/glossary/system-prompt/) (or developer message) and the request in the user message |
| Structure | Order the system prompt as identity, instructions, examples, context; use Markdown headings and XML tags to mark sections |
| Examples | Add a few input and output pairs ([few-shot prompting](https://broadrouter.com/glossary/few-shot-prompting/)) that cover different cases |
| Reasoning | Ask for step-by-step thinking ([chain of thought](https://broadrouter.com/glossary/chain-of-thought/)), or use a reasoning model |
| Output format | Ask for a fixed format, or use [structured output](https://broadrouter.com/glossary/structured-output/) where the API supports it |
| Stability | Pin a model version so behavior does not shift under you |

Anthropic’s overview says to start with three things: clear success criteria, a way to test against them, and a first draft prompt. In practice that means an [eval](https://broadrouter.com/glossary/eval/) set.

A short example, before and after:

```text
Before: Summarize this ticket.

After:  You summarize support tickets for an engineering team.
        Write 3 bullet points: the problem, the customer impact, the next step.
        Use the customer's words for error messages. Do not guess at causes.
        <ticket>...</ticket>
```

For agents, the prompt is one part of a larger context. Anthropic’s context engineering post separates prompt engineering, “methods for writing and organizing LLM instructions,” from [context engineering](https://broadrouter.com/glossary/context-engineering/), which manages everything else the model sees.

## Why it matters

-   **Quality without training.** A better prompt is the cheapest fix to try, before [fine-tuning](https://broadrouter.com/glossary/fine-tuning/) or a bigger model.
-   **Cost.** The system prompt is resent on every request. Cut what does not change the output; see [reducing prompt tokens](https://broadrouter.com/blog/reduce-prompt-tokens/).
-   **Migration.** A prompt tuned for one model may behave differently on another. Rerun your eval set when you switch.

## On BroadNet Inference

BroadNet’s chat models take the standard Chat Completions `messages` list, so system, user and assistant roles and few-shot examples work as usual. You can try prompts in the [playground](https://broadrouter.com/guides/try-broadnet-inference-playground/) before writing code. For Arabic output, [Arabic prompt engineering](https://broadrouter.com/blog/arabic-prompt-engineering/) covers register, dialect, numerals and right-to-left formatting.

Structured output is documented for [GLM 5.3](https://broadrouter.com/models/glm-5.3/) and [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/). On DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B, reasoning counts toward `max_tokens`, so a “think step by step” prompt also needs room in the budget.

## Questions

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

Yes, though the tricks change. Newer models follow plain, specific instructions well, so most of the work is stating requirements clearly, giving examples and testing against real inputs.

### When should I fine-tune instead?

When a well-tested prompt with examples still fails on a large share of cases, or is too long to send on every request. Anthropic's docs also note that some goals, such as lower latency or cost, are easier to reach by choosing a different model.

### Should I write prompts for Arabic output in Arabic?

Either can work. Say which register or dialect you want, and how to handle numerals and mixed text. The Arabic prompt engineering post compares both approaches.

## See also

-   [System prompt](https://broadrouter.com/glossary/system-prompt/) (term)
-   [Few-shot prompting](https://broadrouter.com/glossary/few-shot-prompting/) (term)
-   [Chain-of-thought (CoT)](https://broadrouter.com/glossary/chain-of-thought/) (term)
-   [Context engineering](https://broadrouter.com/glossary/context-engineering/) (term)
-   [Eval (LLM evaluation)](https://broadrouter.com/glossary/eval/) (term)
-   [Structured output](https://broadrouter.com/glossary/structured-output/) (term)
-   [Try BroadNet Inference in your browser, no account](https://broadrouter.com/guides/try-broadnet-inference-playground/) (guide)
-   [Arabic prompt engineering: register, RTL, numerals and mixed text](https://broadrouter.com/blog/arabic-prompt-engineering/) (article)
-   [Reduce prompt tokens: measured cuts for system prompts, tools, data](https://broadrouter.com/blog/reduce-prompt-tokens/) (article)
-   [Before fine-tuning: define the problem to solve](https://broadrouter.com/blog/fine-tuning-readiness/) (article)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=glossary-prompt-engineering&utm_content=page-cta) ·

**Sources**

-   [OpenAI API docs, prompt engineering guide (checked 2026-11-15)](https://developers.openai.com/api/docs/guides/prompt-engineering)
-   [Anthropic docs, prompt engineering overview (checked 2026-11-15)](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/overview)
-   [Anthropic Engineering, Effective context engineering for AI agents (checked 2026-11-15)](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)
