Skip to content
52 / Answers

Prompt engineering is specification writing.

Prompt engineering is designing what you send a language model, instructions, context, examples, format, constraints, so it produces the output you need and keeps producing it on inputs you have not seen. It is the first and cheapest lever in any AI system. It is not magic words; it is clear specification, tested on real cases and versioned like code.

Core moves
Role, task, context, examples, format, constraints
System prompt
The standing instructions above the conversation
Test it
On thirty real inputs, not three
Then
Retrieval and fine-tuning for what prompts cannot fix
  • 5production AI apps
  • 14engineers led
  • 200+students mentored
01

Questions students ask

The prompt engineering questions searched most, answered from writing prompts that run in production.

What is prompt engineering?

Prompt engineering is the practice of crafting the input to a generative model so the output is correct, consistent and in the form you need. A prompt is more than a question: it can set a role, explain the task, supply the facts to use, show examples of good output, specify the format, and state what to avoid. Because models respond to all of that, small changes in wording and structure change results, and the discipline is in finding what works and keeping it stable. In products, prompts are templates filled with retrieved context and user input, maintained and tested like any other code.

What is prompt engineering in simple words?

Telling the AI exactly what you want, the way you would brief a capable new colleague. 'Write about marketing' gets a vague essay. 'You are writing for first-year students. In 150 words, explain what marketing is, give one example from a college fest, and end with one question for them to think about' gets something useful. The colleague analogy holds for everything else: give background, show an example of what good looks like, say what format you need, and say what to do if the request cannot be met.

Why is prompt engineering important?

Because the same model produces a wrong, vague answer or a precise, usable one depending on the prompt, and the prompt is the part you control instantly and for free. In an application the prompt is where behaviour lives: tone, refusal rules, output structure, how retrieved documents are used, how tools are described. A good prompt removes the need for expensive fixes; a weak one makes every downstream stage harder. It is also the first diagnostic: when a system misbehaves, the first question is whether the prompt actually specified the behaviour. Often it did not.

How prompt engineering works

A language model predicts a continuation of the text it is given, so everything in the prompt shifts the probabilities of what follows. A role sets the register; instructions constrain the task; context supplies facts the model would otherwise invent; examples establish the pattern of a good answer more strongly than descriptions do; a format specification shapes the output so code can parse it; constraints rule out common failures. Chat models are trained to give the system prompt priority and to follow instruction-shaped text, which is why clear structure works. None of this is guaranteed, so prompts are tested on many inputs and adjusted where they fail.

What are prompt engineering techniques?

  • Role and audience: who the model is and who it is writing for.
  • Clear task with success criteria: what done looks like.
  • Context injection: the documents, data or rules to use, with an instruction to use only them.
  • Few-shot examples: two or three input-output pairs showing the exact pattern.
  • Output format: JSON with a schema, a Markdown structure, a fixed template.
  • Step-by-step reasoning: ask for the reasoning before the answer on hard tasks, or use a model with built-in reasoning.
  • Constraints and refusals: what to avoid, when to say 'not enough information'.
  • Decomposition: split a big task into prompts for each part and chain them.
  • Self-check: ask the model to verify its answer against the criteria before finalising.

What is system prompt?

The system prompt is the standing instruction set that sits above the conversation: the model's role, rules, tone, output format, tool descriptions and safety boundaries. Users do not see it; every message is interpreted in its light. In a product it is the single most important prompt, because it defines behaviour across all requests. Write it as a specification: short declarative rules, the exact format expected, what to do when the input is out of scope, and examples if format matters. Version it, test it on a fixed set of inputs, and treat any text that tries to override it (in user messages or retrieved documents) as untrusted.

How to do prompt engineering

Start from ten real inputs and the outputs you want for them. Write the simplest prompt that could work: role, task, format. Run the ten; read every output; note the failures. Fix each failure with the smallest change: add a rule, add an example, tighten the format. Re-run all ten, not just the one that failed, because fixes break other cases. When it passes, grow the set to thirty and repeat. Keep the prompt in version control with the test set beside it. If a failure cannot be fixed by prompting, it is a knowledge problem (add retrieval) or a behaviour problem too deep for prompts (consider fine-tuning), and you have learned that cheaply.

What does prompt engineering often require?

Patience and a test set more than cleverness. It requires understanding the task well enough to specify it, which often exposes that the task was never clearly defined. It requires reading many outputs carefully, since failures are specific and quiet. It requires familiarity with the model's tendencies: verbosity, over-hedging, format drift, confident guessing. In products it requires engineering habits: templates with variables, escaping user input, versioning, evaluation, and monitoring prompts in production for drift as models update. And it requires knowing when to stop prompting and change the architecture instead.

What is prompt engineering salary?

Prompt engineering is rarely a standalone job anymore; the early roles with that title have folded into AI engineer, applied scientist and product roles where prompting is one skill among retrieval, evaluation, tool design and deployment. Compensation therefore follows those roles and varies widely by country, company and seniority, so look up current figures for AI engineer positions in your market rather than for the title itself. The practical advice: do not optimise for the title. Build the full skill set, prompt design included, and show it in a portfolio of shipped projects, which is what employers actually pay for.

How to learn prompt engineering

  • Use a chat model daily for real tasks and keep a file of prompts that worked and why.
  • Read one provider's prompting guide end to end; the principles transfer between models.
  • Rewrite a weak prompt five ways and compare outputs on the same inputs.
  • Build a small app with a system prompt, a template and a test set; make the outputs parse as JSON.
  • Study prompts that run real systems; I publish several of mine, from the prompt library architecture to the agent and RAG prompts, on the answers site.
  • Move on to retrieval and tools; prompting is the entry, not the whole craft.
02

A prompt that holds up

The template I start every system prompt from.

  1. 01

    Role and audience

    One sentence each. Who the model is; who it serves.

  2. 02

    Task and rules

    What to do, what never to do, what to do when the input is out of scope.

  3. 03

    Context and format

    Where the facts come from; the exact output shape, with one example.

  4. 04

    Test set

    Thirty real inputs with expected outputs, run on every change.

03

In the room

Where these systems get explained to students.

Prompts that work on every input, not just the demo?

I write and test production prompts, and I know when a prompt is the wrong fix.