Prompt Engineering Basics
How to write clear, specific instructions that get better results from AI coding tools
Constraints
beginnerBoundaries 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
intermediateThe 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
intermediateBreaking 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
beginnerShowing 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
beginnerRefining 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
beginnerTelling 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.
Specificity
beginnerBeing precise about exactly what you want. Instead of vague requests like 'fix the code,' a specific prompt names the file, function, and expected behavior. The more details you give, the less the AI has to guess.
Task Framing
beginnerStructuring 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.