# 25.3 Clear instructions and output constraints (/building-ai-workers/prompts-and-structured-output/clear-instructions-and-output-constraints)

---
type: Document
title: "25.3 Clear instructions and output constraints"
description: "What a clear instruction says, what an output constraint says, and why the check in code stays."
status: stable
order: 325.03
ksor:
  owner: team:panaversity
  audience:
    - public
  approval:
    by: process:panaversity
    at: 2026-11-30T00:02:23Z
chapter: '25'
part: III
expert_status: co-build
concepts: [ "25.3" ]
last_verified: '2026-11-29'
sources:
  - id: anthropic-prompting-best-practices
    title: Prompting best practices (verified 2026-11-29)
    resource: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
  - id: anthropic-working-with-messages
    title: Using the Messages API (verified 2026-11-29)
    resource: https://platform.claude.com/docs/en/build-with-claude/working-with-messages
  - id: anthropic-prompting-fable-5-2
    title: Prompting Claude Fable 5.2 (verified 2026-11-29)
    resource: https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/prompting-claude-fable-5-2
  - id: anthropic-prep-course-prompting-craft
    title: Claude Certified Developer, Foundations prep path, Module 2, Prompting Craft, Anthropic Partner Academy (sign-in needed, read 2026-11-29)
    resource: https://anthropic-partners.skilljar.com/path/claude-certified-developer-foundations/production-grade-prompting-agents-tool-use/486743/scorm/3k33sihfb1tww
generated:
  at: 2026-11-30T00:02:23Z
  by: esl-rewrite/1.2.0+ksor.1
trust_tier: unverified
build_id: sha256:cc6fd9ac5f72207d4365ecbda63d87d1b64f99e05519b358a45b9f5d9bfd6f8f
dirty: true
ksor_version: 0.0.60
---

**In everyday life.** You order a shirt from a tailor. "Make me a nice shirt" gets you a shirt, in the tailor's idea of nice. A careful order has the sleeve length in centimeters and the collar as one of the three styles on the tailor's card. It also says what to do when something is missing: "If this cloth is finished, phone me. Do not choose another." The second order is longer by three lines. They are the lines you would have said in the shop, standing there, if the tailor had asked.

**What you will learn.** You practice this in Lab 25. In Task 1, one instruction is made clear. In Task 3, the prompt says what to write for a missing value.

- What does a clear instruction say?
- What is an output constraint?
- When should the model report, and when should it skip?
- What do I keep, and what do I remove?

**Why it matters.** A person who reads an answer knows the form they wanted. The code knows only what the prompt said.

**At work.** Friday's extraction prompt named the field `terms` and never said which values it may hold. So the model wrote what the invoice said, "Net 30 days". On Monday at 7:10 the check from [14.5](../structuring-programs/schema-rules.md) knew the five terms and nothing else, and refused it. After Ana reads the report at 8:40 the builder finds the cause. It is a missing output constraint: the prompt never listed the five terms.

### What does a clear instruction say?

**Everything you would tell a capable new colleague who has never seen your work.** Anthropic's test is to show the prompt to a colleague with little context: "If they'd be confused, Claude will be too".[^anthropic-prompting-best-practices] Four habits from the same page do most of the work:

- **Say what to do, not only what to avoid.** Write "write the term from this list", not "do not invent terms".[^anthropic-prompting-best-practices]
- **Give the reason.** A rule with its reason lets the model handle a case you did not list, because it "can generalize from the explanation".[^anthropic-prompting-best-practices]
- **Number the steps** when their order matters.
- **Separate the parts.** Put each kind of content in its own XML tag, such as `<instructions>` and `<example>`. An XML tag is a label in angle brackets. Use the same names every time.[^anthropic-prompting-best-practices]

### What is an output constraint?

An output constraint is a line that fixes the form of the answer. It gives the field names, the type of each and the allowed values. It says whether any text may come before or after, and what to write when the data is absent.[^anthropic-prep-course-prompting-craft] It is the person's first job, knowing the form, written down. Friday's prompt had the field names and their types, and nothing else. This is what the missing lines look like:

```text
Return one JSON object and nothing else, with exactly these fields:
number, vendorId, invoiceDate, terms, subtotalCents, taxCents,
amountCents, poNumber.

terms is one of: Due on receipt, Net 15, Net 30, Net 45, Net 60.
Write the term from this list that the invoice means.
Amounts are whole cents: $4,825.00 is 482500.
If the invoice shows no purchase order, write null for poNumber.
Never fill a field with a guess, because code will act on these values.
```

<!-- OPEN: the fields subtotalCents, taxCents and poNumber are proposed in the Chapter 24 spec (raised point 3) and are not yet in specs/labs/part-2-facts.md. Whether poNumber may be null is not decided there either. Match this block to the lab's real prompt once those are fixed. -->

The line about a missing value matters as much as the list. Without it, a model asked for a purchase order writes one. A person would have left the box empty and asked. What does the model write when the terms are none of the five? That is 25.7's subject, where the schema gives that answer a value of its own.

### When should the model report, and when should it skip?

**Report when a written criterion is met, and skip everything else.** Some prompts ask the model to notice things, and "flag anything unusual" is the unclear version. Unusual to whom? The model must guess your threshold, and a line such as "be careful" gives it nothing to check. Write the criterion instead, for both sides:

```text
Report an invoice when its amount is more than its purchase order's amount.
Skip a difference in layout, wording or the order of the lines.
```

The first line says what counts. The second says what does not, so the report is not filled with findings that Ana must read and reject. Each false finding teaches her to trust the report less.

### What do I keep, and what do I remove?

**Keep the lines that do work: controls, limits, tests and the output constraints. Remove the rest.** A prompt grows by one line after every bad answer. Anthropic's prep course for this exam tells the story of a classifier whose prompt grew over five revisions. Its answers got longer and slower, and no more accurate.[^anthropic-prep-course-prompting-craft] So read a prompt as you read code, and remove what does no work.

| Remove | Keep |
| --- | --- |
| Generic lines: "think carefully", "double-check your work" | Required controls: steps that policy or a system demands |
| Steps the model can work out by itself | Authority limits: what the step may never decide |
| Words in capital letters, and "CRITICAL" in front of a rule | Specific acceptance tests, success criteria and stop rules |
| Rules and notes that built up for an older model | The output constraints above |

**Capitals:** the documentation says Claude Opus 4.5 and 4.6 are "more responsive to the system prompt". So a rule no longer needs loud words to be followed. Its own example replaces "CRITICAL: You MUST use this tool when..." with "Use this tool when...".[^anthropic-prompting-best-practices] **Old rules:** Anthropic's guide to its newest model says that some instructions designed for earlier models "raised cost, caused side effects, or no longer had an effect".[^anthropic-prompting-fable-5-2] **"Think carefully":** how long the model thinks is a setting, called effort, and it is not a sentence in the prompt. Chapter 29 covers it.

One old technique is gone. A **prefill** is the first characters of the answer, written by you, such as `{`, so that the model continues from there. Starting with Claude 4.6 models, a request that ends this way returns a 400 error.[^anthropic-prompting-best-practices] Ask for the form in the system prompt instead. Then, as the documentation warns, "a system prompt instruction doesn't guarantee how the response starts, so check the response's text in your code".[^anthropic-working-with-messages]

**The price.** That warning holds for the whole prompt. A constraint in a prompt is a request, and the model can still miss it. It lowers how often the check in code refuses an answer. It never replaces the check. A prompt alone is fine where a person still reads each answer. Where code reads it, 25.7 moves the form into a schema that the API holds.

**The operating rule:** write down the form, the allowed values and what to do when a value is missing. Remove every line that does no work.

**Do this now.** Ask your coding agent to review one prompt against this section. Copy this line:

> Read the prompt in this file. List every field of the answer for which it does not state the type, the allowed values, or what to write when the value is missing. Then list every line that is generic advice and not a rule, a limit or a test. Change nothing.

[^anthropic-prompting-best-practices]: Prompting best practices, Anthropic.
[^anthropic-prep-course-prompting-craft]: Claude Certified Developer, Foundations prep path, Module 2, Prompting Craft, Anthropic Partner Academy.
[^anthropic-prompting-fable-5-2]: Prompting Claude Fable 5.2, Anthropic.
[^anthropic-working-with-messages]: Using the Messages API, Anthropic.
