Giving Context and Constraints
The AI does not share your brain. It does not know that your quiz app is for third-graders, that your portfolio site must match an existing color scheme, or that your script cannot use any libraries because the server does not have them installed. Unless you say so, the AI will make reasonable assumptions — and reasonable assumptions are often wrong for your specific situation. Context and constraints are the two tools that close that gap. Together they transform a generic prompt into a precise request that the AI can actually fulfill.
Context: Background That Changes the Result
Context is information about the situation your artifact will live in. It answers questions like: Who is the audience? What platform will this run on? What already exists that this must fit with? What is the purpose of this feature? Consider this prompt: 'Write a quiz about world capitals.' Now add context: 'Write a quiz about world capitals for a sixth-grade geography class. Students have already studied Europe and South America. The quiz should feel encouraging — after each wrong answer, explain why the correct answer is right in one friendly sentence.' The artifact is the same — a capitals quiz — but the context completely changes what good looks like. Difficulty, tone, coverage, and feedback behavior all shift. The AI now has what it needs to produce something genuinely useful for that sixth-grade class, not just a generic quiz.
Every AI has defaults — the choices it makes when you say nothing. Context overrides defaults. Audience tells it what reading level and tone to use. Platform tells it what technologies or formats are available. Purpose tells it what trade-offs to make. Give context whenever your situation differs from the obvious default.
Here are three types of context worth naming explicitly: Audience context: Who will use or read this? Age, skill level, and background matter enormously. A password-strength checker for security professionals looks very different from one for ten-year-olds. Environment context: Where does this run? A web page in a browser, a script on a server, a file for Google Sheets, a component inside a React app — each implies different rules. Project context: What already exists? If your prompt fits inside a larger project, tell the AI what style, naming, or conventions the rest of the project uses. Otherwise it will invent its own.
Constraints: Limits That Define the Boundary
Constraints are limits you impose. They are not descriptions of what you want — they are rules the result must follow regardless of how it is built. Common constraint types: Technology constraints: 'Use only HTML, CSS, and vanilla JavaScript — no libraries.' 'This must work in Python 3.10.' 'Do not use any external API calls.' Size or scope constraints: 'The whole thing should fit in one file.' 'Keep the explanation under 100 words.' 'Build only the search bar, not the rest of the page.' Style constraints: 'Use the color #2D6A4F for all primary buttons.' 'Match the existing font, which is Inter at 16px.' 'Write in a casual, friendly tone, not formal.' Constraints prevent the AI from over-engineering or going in directions that would create rework. They are not signs of distrust — they are signs of good planning.
A constraint is something the result MUST do or must NOT do — it is non-negotiable. A request is something you would prefer but could live without. Be honest with yourself about which is which. Overconstrained prompts can back the AI into a corner; under-constrained prompts invite unwanted surprises.
Flashcards — click each card to reveal the answer
Why does audience context change the AI's output?
Which of the following is a constraint rather than a context?
Context-Constraint Audit
- Step 1: Choose any simple build you can imagine: a calculator, a weather widget, a login form, a vocabulary flashcard set.
- Step 2: Write a bare-bones prompt for it — just name the artifact.
- Step 3: List the context you would add: Who is it for? Where will it run? What project does it fit into?
- Step 4: List the constraints you would add: What technologies must or must not be used? Any size or style limits?
- Step 5: Write the full upgraded prompt combining the artifact, context, and constraints. Count how many more decisions the AI can now make correctly without guessing.