Sub topic 3
Writing clear, specific instructions
This chapter assumes you know how a prompt is split into instruction, context, input data, and output specification. It also assumes you can read short Python snippets. The goal is to turn a vague request into one the model can follow the same way every time.
Why vague prompts fail
A model only sees the text you send. If the prompt leaves out the audience, the length, or what to do when information is missing, the model fills those gaps with guesses. Different runs fill them differently, so your results vary.
Compare these two prompts:
- Vague: "Summarize this ticket."
- Specific: "Summarize the support ticket below for an engineering manager, in at most 3 bullet points, starting with the customer impact."
The second one names a task, an audience, a length limit, and an order. Each of those removes a guess.
The four things to state
A clear instruction usually covers four points.
| Element | Question it answers | Example |
|---|---|---|
| Task | What should the model do? | Summarize the support ticket |
| Audience | Who will read the result? | An engineering manager |
| Constraints | What limits apply? | At most 3 bullets, impact first |
| Fallback | What if the input is missing something? | Write "Cause unknown" |
The fallback is the one people forget most often. Without it, the model tends to invent a plausible answer instead of admitting a gap.
A worked example
This prompt applies all four elements. It also uses triple quotes to mark where the ticket text begins and ends.
Summarize the support ticket below for an engineering manager.
Constraints:
- Use at most 3 bullet points.
- State the customer impact first.
- If the ticket does not say what the cause is, write "Cause unknown" instead of guessing.
Ticket:
"""
{ticket_text}
"""Here is how each line helps:
- The first line gives the task and the audience.
- The constraints are a list, so each rule is easy to find and check.
- The ordering rule ("impact first") fixes the structure of the reply.
- The fallback rule tells the model what to do instead of guessing.
- The delimiters separate your instructions from the ticket, which may contain text that looks like instructions.
Techniques that make instructions clearer
Say what to do, not only what to avoid
"Do not be verbose" leaves the model to decide what counts as verbose. "Use at most 3 bullet points" can be checked. Prefer a measurable limit when you have one.
Use concrete verbs and numbers
Words like "short", "good", and "detailed" mean different things to different readers. Replace them with counts, formats, or named reference points: "under 80 words", "one sentence per bullet", "in plain language a new hire could follow".
Put each rule on its own line
A paragraph that mixes five rules makes it easy for the model to drop one. A list keeps the rules separate. It also helps you later, when you need to see which rule a bad output broke.
Give the reason when it changes behavior
A short reason can help the model apply a rule sensibly. "Keep it under 50 words because it will appear in a push notification" tells the model more than the limit alone.
Resolve conflicts yourself
Two rules can pull in opposite directions, such as "be brief" and "explain every step". The model must pick one, and it may pick differently each time. Decide which rule wins and say so.
Common errors
- Hidden assumptions. You know the ticket is from an enterprise customer. The model does not. State facts that affect the answer.
- Missing audience. Without one, the model writes for a generic reader, which is often too long or too basic.
- No fallback. Missing data produces invented data. Always say what to output when the input is incomplete.
- Overloading one prompt. Ten unrelated requirements in a single prompt compete with each other. If a prompt keeps failing, consider splitting it. A later chapter covers chaining prompts.
- Changing several things at once. When you revise, you cannot tell which edit helped. Change one thing, then test.
A before and after
Vague:
Write something about our new feature for customers.Rewritten:
Write a product announcement for existing customers of our invoicing app.
Feature: automatic payment reminders, sent 3 days before an invoice is due.
Constraints:
- 80 to 100 words.
- Friendly, plain tone with no jargon.
- End with one sentence telling the reader where to turn the feature on: Settings > Reminders.
- Do not mention pricing. If you would need pricing details, leave them out.The rewrite names the reader, supplies the facts, sets a length, and states a rule for the one thing the model cannot know.
Exercise
Rewrite this prompt so it states a task, an audience, at least two measurable constraints, and a fallback: "Explain our refund policy."
Show answer
A strong answer looks like: "Explain the refund policy below to a customer who has just asked about returning an item. Use at most 4 sentences and plain language. State the number of days allowed for returns first. If the policy text does not say whether shipping costs are refunded, write 'Shipping refund not specified' instead of guessing. Policy: \"\"\"{policy_text}\"\"\"". It names the reader, limits length, fixes the order, and gives a fallback for missing information.
Exercise
A prompt says "Be brief but cover every detail of the incident." Outputs vary a lot between runs. Why, and how do you fix it?
Show answer
The two rules conflict, so the model chooses a different balance each time. Decide which wins and say so, for example: "Use at most 5 bullet points. If a detail does not fit, leave it out and prioritize customer impact."