Prompt engineering for everyone: role, context, format and examples

Prompt engineering is the practice of phrasing instructions so that a model responds predictably and usefully. It does not require programming, and it is handy for writing, analysis, learning and, of course, code.
A simple template with five elements
- Role: who the model should be, for example "an experienced programming teacher".
- Task: what exactly should be produced.
- Context: for whom, what you already know, what the constraints are.
- Format: a list, a table, a short paragraph, code in a single file.
- Quality criteria: length, tone, what to avoid.
Show an example instead of describing
One or two samples of the desired answer often work better than a long description. If you want a specific format for notes, paste a short example of such a note and ask for the same structure for a new topic.
Separate instructions from material
When you paste text or code to be processed, separate it from the instructions, for example with a heading or triple quotation marks. That way the model will not confuse the material with the instruction.
Ask for a plan on complex tasks
Instead of "do it", write "first propose a plan in a few steps". Fixing a plan is cheaper than fixing a finished result.
Iterate specifically
The first result is a draft. Refine it precisely: "cut it in half", "make the tone less formal", "add handling for empty data". A generic "improve this" usually improves nothing.
System prompt: a standing instruction
In many tools you can set an instruction that applies throughout the conversation, often called a system prompt or project instructions. It is a good place for the role, style and rules, for example "answer in English, briefly, with examples". Keep it concise and concrete, because it affects every answer.
What to avoid
- Contradictory instructions and too many tasks at once.
- "Magic phrases" that supposedly always work.
- Assuming that the same instruction will give an identical result every time.
Rules focused on code can be found in the guide how to write prompts for code.


