Task Framing
beginnerDefinition
Structuring your request so the goal, context, and constraints are all clear up front. Good framing tells the AI what you want, why, and what rules to follow: before it starts writing code.
In the wild
Instead of 'add validation,' try: 'Add email validation to the signup form in register.js. It should check for an @ symbol and a domain, and show an inline error message if the email is invalid.' That single sentence frames the task completely.
More from Prompt Engineering Basics
Constraints
Boundaries you set on what the AI should or shouldn't do. Constraints prevent unwanted changes: like modifying files you didn't ask about, adding dependencies, or changing existing behavior.
Context Window
The amount of text an AI model can 'see' at once: your prompt, the conversation history, and any files it's reading. Think of it as the AI's working memory. If important information falls outside the window, the AI can't use it.
Decomposition
Breaking a complex request into smaller, manageable pieces. Instead of asking for an entire feature at once, you split it into steps that each build on the last. This produces more reliable results because each step is easier to verify.
Example-Driven Prompting
Showing the AI a concrete example of the input and output you expect, rather than only describing it in words. Examples remove ambiguity because the AI can pattern-match on what you showed, not just what you said.
Iteration
Refining your results through follow-up prompts. Your first prompt rarely produces a perfect result. Iteration means reviewing what you got, identifying what's off, and asking for targeted adjustments rather than starting over.
Output Format
Telling the AI exactly how you want the result structured. Without format guidance, the AI picks its own layout. Specifying the format, a function, a JSON object, a bullet list, a code block, means less cleanup afterward.