Skip to content
Lesson 8 of 8Writing Better Prompts

Shaping the response · Lesson 8 of 8

Using constraints effectively

Use limits on length, scope, style and content to focus the AI — while avoiding conflicting, excessive or purely negative rules.

10 min readIntermediate
Sign in to bookmark

You're learning as a guest — everything is open. Sign in to save progress, earn XP and pick up where you left off.

Why constraints help

A constraint is a rule the output must follow: a word limit, a reading level, a required ingredient, a topic to avoid, a budget. Constraints narrow down the huge space of possible answers to the ones that are actually useful to you. "Write a dinner recipe" has millions of valid answers. "Write a vegetarian dinner recipe for two, under 30 minutes, using only one pan" has far fewer — and they're much more likely to be what you need.

Constraints also help with quality. Many people find that tight limits ("explain it in three sentences," "no jargon") produce clearer writing than open-ended requests.

Types of constraints

TypeExamples
Length"Under 100 words," "exactly 5 items," "one paragraph"
Scope"Only cover the setup steps," "focus on costs, not features"
Audience & level"For someone with no coding experience," "reading level of a 12-year-old"
Style & tone"Formal," "no exclamation marks," "first person"
Content"Must mention the refund policy," "use only the data below"
Practical"Budget under $50," "ingredients from a regular supermarket"
Before

Suggest a workout plan.

After

Suggest a 3-day-per-week workout plan for a beginner who works from home. Constraints: - No equipment except a yoga mat - Each session 20–25 minutes - Low impact (I have a sensitive knee — no jumping) - Present it as a table: Day | Exercise | Sets × reps

Write constraints the AI can follow

Make them measurable. "Keep it short" is a wish; "under 80 words" is a constraint. "Simple language" is vague; "avoid technical terms, or define any you use in a few words" is checkable.

Prefer positive phrasing. Telling the AI what to do is usually more reliable than listing what not to do. "Write in plain, conversational English" works better than "Don't be too formal, don't use jargon, don't use long sentences." Negative rules are still useful for hard boundaries ("don't include prices"), but pair them with what you want instead.

Before

Don't make it boring. Don't use clichés. Don't make it too long.

After

Write an energetic opening line under 15 words that starts with a surprising fact about sleep.

Explain the reason when it isn't obvious. "Keep it under 160 characters — it's going in an SMS" helps the AI prioritise. A constraint with a reason is easier to apply sensibly in edge cases.

Grounding constraints: "use only what I gave you"

One of the most useful constraints is limiting the AI to the material you provide. This reduces — though it doesn't eliminate — the chance of invented details.

Prompt
Answer the question using only the policy text below. If the answer isn't in the text, say "The policy doesn't say" — don't guess.

Policy:
"""
[paste HR policy]
"""

Question: How many days of parental leave do part-time employees get?
Illustrative example response — written by Promptly, not generated live
The policy doesn't say. It describes parental leave for full-time employees (16 weeks) but doesn't mention part-time staff. You may want to check with HR.

That illustrative response shows what you want: a clear "not stated" instead of a plausible-sounding invention. Giving the AI an explicit way out makes it more likely to take it.

Avoid conflicting constraints

Constraints can clash: "Explain quantum computing thoroughly, covering all major concepts, in under 50 words." The AI can't satisfy both, so it will quietly sacrifice one — and you won't control which. Before sending, read your constraints together and ask whether a single answer could meet all of them. If two might conflict, say which wins: "If you can't fit everything in 100 words, prioritise the safety steps."

Don't over-constrain

Every constraint removes options. Pile on too many and the output gets stiff, awkward or worse at the core task — for example a story forced to use ten specific words, rhyme, stay under 50 words and teach a lesson. Start with the constraints that matter most, check the output, and add more only if needed.

Tip: Separate must-haves from nice-to-haves: "Must: under 200 words, mentions the deadline. Nice to have: a light, friendly closing line." This tells the AI where it has flexibility.

Watch out: Constraints guide the model; they don't guarantee compliance. Word counts may drift, and a forbidden phrase can occasionally slip through. Check outputs against your hard requirements, especially before publishing or sending.

Putting it together

A strong constrained prompt usually has: the task, the key context, a short "Constraints" list (measurable, mostly positive, no conflicts), and a priority order if anything might clash.

Common mistakes

  • Mistake: Using vague constraints like "keep it short" or "make it simple."

    Fix: Turn them into measurable rules: "under 80 words," "no technical terms without a definition."

  • Mistake: Writing only negative rules ("don't do X, don't do Y").

    Fix: State what you want instead, and keep negatives for hard boundaries.

  • Mistake: Combining constraints that can't all be met.

    Fix: Read them together before sending and say which takes priority if they clash.

  • Mistake: Stacking so many rules that the output becomes stiff or awkward.

    Fix: Start with the essentials and add constraints only when the output needs them.

Practice exercise

Constrain a product description

You sell handmade ceramic mugs on an online marketplace. Rewrite the starter prompt with a clear, well-chosen set of constraints. Include at least one length constraint, one audience or tone constraint and one content constraint, and mark which are must-haves versus nice-to-haves. Make sure none of them conflict.

Your draft stays in this browser tab — it isn't sent anywhere.Try your draft in the Playground

Hints

Self-check

Tick each item your prompt covers.

0 of 5 checked

You can do the whole exercise as a guest.Sign in to save progress

Knowledge check

Test your understanding

Question 1 of 4

Which constraint is most measurable?

Finished reading?

Guests can read every lesson.Sign in to save progress