Write Clear Instructions
The single biggest lever on output quality is being specific.
Prompt engineering is the craft of writing instructions that get the output you want. The model cannot read your mind — vague prompts get vague results.
Make instructions specific
- State the task, the audience, and the format.
- Give the length you want.
- Say what to avoid.
Compare a weak prompt ("Tell me about dogs") with a strong one ("Write 3 bullet points explaining why golden retrievers suit families with young children"). The second gives the model everything it needs to succeed.
Example
{
"weak": "Summarize this.",
"strong": "Summarize the text below in 2 sentences for a non-technical reader. Avoid jargon.\n\nTEXT:\n<article here>"
}When to use it
- A legal team writes prompts specifying 'Respond in bullet points under 100 words each' to avoid long-winded AI responses in client reports.
- A developer adds 'Return only the Python function, no explanations' to a code-generation prompt so the output is paste-ready.
- A product manager describes the audience, format, and tone explicitly in a brief-writing prompt, cutting revision rounds from four to one.
More examples
Vague vs specific instruction comparison
Runs a vague and a specific version of the same request to show how specificity shapes output quality.
from openai import OpenAI
client = OpenAI()
vague = 'Tell me about sorting.'
specific = ('Explain the merge sort algorithm to a junior developer. '
'Use bullet points. Maximum 5 bullets. No code.')
for prompt in [vague, specific]:
r = client.chat.completions.create(
model='gpt-4o-mini',
messages=[{'role': 'user', 'content': prompt}]
)
print('--- Prompt:', prompt[:40], '---')
print(r.choices[0].message.content[:300])
print()Specify output format explicitly
Instructs the model on both content and exact format, eliminating ambiguous free-form output.
from openai import OpenAI
client = OpenAI()
r = client.chat.completions.create(
model='gpt-4o-mini',
messages=[{
'role': 'user',
'content': (
'List the three largest planets in the solar system. '
'Format: numbered list, one planet per line, include diameter in km.'
)
}]
)
print(r.choices[0].message.content)Constrain length and audience
Sets audience and length in the system prompt so the constraint applies to every user turn.
from openai import OpenAI
client = OpenAI()
r = client.chat.completions.create(
model='gpt-4o-mini',
messages=[
{'role': 'system', 'content': 'You explain concepts to 10-year-olds in under 50 words.'},
{'role': 'user', 'content': 'What is gravity?'}
]
)
print(r.choices[0].message.content)
Discussion