Guide
How to Write AI Constraints That Are Clear and Testable
Write positive and negative AI prompt constraints with measurable wording, priority rules, conflict handling, and practical before-and-after examples.
Constraints define the boundaries of an AI task: what must be included, what must be avoided, how long the output may be, which sources are allowed, and what should happen when requirements conflict. Good constraints are specific enough to check and limited enough to follow.
Constraint types#
Scope constraints#
Define what the task covers and excludes.
Compare onboarding email sequences only. Do not evaluate pricing, product design, or paid advertising.Content constraints#
Require or prohibit particular information.
Include the verified shipping window. Do not add discounts, testimonials, or environmental claims.Format constraints#
Set sections, length, count, or order.
Return one headline, three bullets, and one CTA. Keep the complete output under 120 words.Source constraints#
Control what evidence may be used.
Use only the supplied research notes. Mark unsupported questions as [NOT IN SOURCE].Process constraints#
Specify how the work should be approached or reviewed.
List assumptions before the recommendation. Separate confirmed findings from hypotheses.Safety and compliance constraints#
Identify claims or decisions that require qualified review.
Do not provide a legal conclusion. Identify unclear clauses and questions for licensed counsel.Positive versus negative rules#
Positive constraints tell the model what to do. Negative constraints tell it what to avoid. Prefer positive wording when it can express the same requirement.
Mostly negative
Do not be vague. Do not be too long. Do not sound robotic.More actionable
Use concrete verbs and specific evidence. Keep the body between 130 and 170 words. Write in plain, direct sentences suitable for a customer support email.Negative rules remain useful for prohibited claims, sensitive topics, incompatible changes, or explicit boundaries.
Make constraints measurable#
Replace subjective words with observable conditions.
| Vague | Testable |
|---|---|
| concise | 120–160 words |
| detailed | include cause, impact, owner, and next action |
| professional | direct, respectful, no slang, no blame |
| SEO friendly | primary topic in H1 and opening; no forced repetition |
| accurate | use only supplied facts; label unsupported items |
Not every quality can be reduced to a number. When judgment is necessary, define the audience and examples of acceptable behavior.
Set priority order#
Constraints often conflict. Tell the model which requirement wins.
Priority order:
1. Preserve supported facts and required safety language.
2. Include the requested sections.
3. Meet the target length where possible.
4. Improve style without changing meaning.This is more useful than issuing several absolute commands that cannot all be satisfied.
Find conflicts before running the prompt#
Look for combinations such as:
- “Use every detail” and “maximum 50 words”
- “Do not change meaning” and “make the claim stronger”
- “Return JSON only” and “explain your reasoning first”
- “Ask questions before answering” and “do not ask follow-up questions”
- “Use only the source” and “include current market statistics” when no statistics are supplied
Resolve the conflict in the prompt instead of expecting the model to guess.
Before and after: advertising copy#
Weak prompt
Write a short, exciting ad that does not make bad claims.Constraint-defined prompt
Write three paid-search ad variants for the supplied bookkeeping service. Each variant must contain a headline under 30 characters and a description under 90 characters. Use only the approved facts below. Do not claim guaranteed savings, tax outcomes, certifications, or customer counts. Keep the tone direct rather than urgent. If an approved fact does not fit, omit it instead of rewriting it as a stronger claim.The revised constraints are measurable and tied to claim risk.
Before and after: product description#
Weak prompt
Write a compelling product description. Avoid fluff.Constraint-defined prompt
Write a 140–180 word product description for first-time buyers. Include material, dimensions, compatible uses, care instructions, and one limitation. Use only the product facts supplied. Do not use “best,” “perfect,” “eco-friendly,” or medical claims. Return one paragraph followed by five factual bullets.Failure modes#
Too many equal-priority rules#
A long list makes the core task hard to see. Group constraints and rank them.
Rules without required inputs#
A constraint such as “cite every statistic” cannot work when no reliable sources are supplied.
Impossible absolutes#
“Never hallucinate” cannot be guaranteed. Use source boundaries and verification instead.
Hidden policy decisions#
Do not ask the model to decide what is legally compliant or professionally safe without qualified review.
Cosmetic constraints that override accuracy#
A fixed word count should not force removal of a required warning or source qualification.
How the Prompt Checker uses constraints#
The checker detects phrases associated with limits and exclusions. It cannot determine whether a constraint is sensible, compatible, enforceable, or complete.
Reusable checklist#
- Each constraint has a clear reason.
- Subjective requirements are defined or exemplified.
- Conflicts have a stated priority.
- Required data and sources are available.
- Prohibited claims are specific.
- Accuracy and safety outrank style and length.
- A person can check whether the constraint was followed.
FAQ#
How many constraints should a prompt have?
As few as necessary to protect the task. Group related rules and remove duplicates.
Should I tell the model what not to do?
Yes when the boundary is important, but pair negative rules with a positive alternative where possible.
Can constraints guarantee compliance?
No. They improve clarity, but outputs still require review and, for machine workflows, validation.