A practical prompt-writing framework
A good prompt reduces ambiguity by explaining what you need, what information matters and how the result should be checked.
Start with the task
Say whether you need an explanation, comparison, debugging help, practice questions, review or transformation.
Add context
Include the code, audience, dataset description, job description or other material needed for the task.
State constraints
Examples include a software version, database engine, maximum length, required sections, allowed libraries or a requirement to use only supplied facts.
Specify the output
Ask for a checklist, table, step-by-step explanation, corrected code, quiz or short summary when that format helps.
Ask for verification
Ask the assistant to state assumptions, flag missing information and distinguish facts from suggestions.
Example: “I use PostgreSQL. This query should return one row per customer for 2026, but it returns duplicates. Here is the query and the table relationship. Explain why, show the smallest correction and give me two checks to verify the result.”