Skip to main content
← Back to techniques

Constraint prompting

Structure & output

Level 1 · Foundations

State the hard rules the output must satisfy explicitly, as an itemized list.

Constraint prompting lists the non-negotiable rules the output must satisfy as explicit, itemized constraints — length limits, forbidden words or topics, required elements, style rules — rather than folding them into a general instruction. Explicit, itemized constraints are easier for the model to check against than the same rules buried in a paragraph. Large language models generally follow positive instructions ('write in short sentences') more reliably than negative ones ('don't write long sentences'). Where possible, phrase a constraint as what the output should do, not just what it should avoid.

When to use it

Use it whenever there are specific hard requirements the output absolutely must meet — legal/compliance wording, brand guidelines, strict length limits, accessibility requirements.

When to avoid it

Avoid it when you genuinely want the model's own judgment on structure and content — too many constraints at once can crowd out quality, or produce output that satisfies every rule while missing the actual point.

Advantages

  • Constraints are easy for the model to check one by one, improving compliance
  • Makes review easier — you can verify each constraint independently
  • Reduces the need for a back-and-forth correction cycle

Disadvantages

  • Too many constraints at once can hurt overall quality or coherence
  • Conflicting constraints can produce a confused, contradictory result
  • Doesn't guarantee 100% compliance, especially on longer outputs

Examples

Write a product description for a running shoe.

Input: lightweight trail running shoe, waterproof, 280g.

The output must satisfy all of these constraints:
- Maximum 80 words
- Use only positive, active phrasing (e.g. "stays dry in the rain", not "won't let you down")
- Must mention the weight
- End with a single call-to-action sentence

If possible, also aim for:
- A confident, energetic tone
Advanced — confirm understanding first: before answering, briefly restate the constraints above in your own words to confirm you've understood them correctly. Then produce the answer.
Framing success criteria as soft preferences (not a separate technique from this one): "A good answer to this would: {{SOFT_PREFERENCES}}" is the same instruction as this technique's own soft-preferences section above, just phrased as an evaluation question instead of a wish list — use whichever phrasing reads more naturally for your task.

Try it

Fill in the placeholders below and see the compiled prompt update live.

What you want to achieve.

The material to work from.

Rules, limits or things to avoid.

Stylistic preferences — nice to have, not mandatory. Optional.

18
Words
143
Characters
0/4
Placeholders filled
1 min
Reading time
Quality score11
  • Completeness0
  • Clarity0
  • Context0
  • Specificity0
  • Constraints0
  • Format0
  • Output0
  • Constraints note100
  • Success criteria0
  • Scope focus100
  • Verification step0
  • Negative example0
  • Confidence0
  • Placeholder syntax100
  • Markdown structure0
Suggestions
  • Fill in the remaining placeholders.
  • Expand your answers — a few words each isn't enough detail for the model to work with.
  • Add background context so the model understands the situation.
{{OBJECTIVE}} Input: {{INPUT}} The output must satisfy all of these constraints: {{CONSTRAINTS}} If possible, also aim for: {{SOFT_PREFERENCES}}
AI Assistant

Jump to a page…

Navigation