Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Prompt engineering is the practice of writing clear instructions that guide an AI model toward useful, accurate, and safe responses. This cheat sheet covers common prompt patterns students can use for coding help, research planning, debugging, writing, and problem solving. It is useful because small changes in wording, context, constraints, and examples can greatly change the quality of an AI response.

Students in grades 11-12 can use these patterns to communicate goals clearly and evaluate AI outputs responsibly.

The core idea is to define the role, task, context, constraints, and output format before asking for an answer. Strong prompts often include examples, success criteria, step-by-step planning requests, and verification instructions. Useful patterns include role prompting, few-shot prompting, decomposition, critique and revise, structured output, and test-driven prompting.

Good prompt engineering also requires checking facts, protecting privacy, and treating AI responses as drafts rather than guaranteed truth.

Key Facts

  • A strong prompt often follows the structure: role + task + context + constraints + output format.
  • Role prompting tells the model how to respond, such as: Act as a Python tutor for an 11th grade student.
  • Few-shot prompting provides examples of the desired input and output so the model can copy the pattern.
  • Decomposition prompts break a large task into smaller steps, such as: First list the subproblems, then solve each one.
  • Structured output prompts specify the response format, such as: Return a table with columns: concept, definition, example.
  • Constraint prompts set limits, such as: Use only beginner-level Python and keep the answer under 150 words.
  • Critique and revise prompting asks the model to review an answer against criteria, then improve it.
  • Verification prompts ask the model to check assumptions, identify uncertainty, or provide tests that could reveal errors.

Vocabulary

Prompt
A prompt is the instruction, question, or input given to an AI model to guide its response.
Context
Context is the background information the model needs to understand the task and produce a relevant answer.
Constraint
A constraint is a rule or limit that shapes the response, such as length, tone, tools, audience, or format.
Few-shot Prompting
Few-shot prompting is a pattern that gives the model a small number of examples before asking it to complete a similar task.
Structured Output
Structured output is a response format that organizes information in a specific layout, such as JSON, a table, or numbered steps.
Iteration
Iteration is the process of improving a prompt or response through repeated testing, feedback, and revision.

Common Mistakes to Avoid

  • Writing a vague task, such as 'help me with this,' is wrong because the model has too little information to know the goal, audience, or expected output.
  • Leaving out the output format is wrong because the model may respond in paragraphs when a table, checklist, code block, or JSON object would be more useful.
  • Asking for too many unrelated tasks at once is wrong because it can make the response scattered, incomplete, or difficult to verify.
  • Trusting the first answer without checking is wrong because AI models can produce confident but incorrect facts, code, or explanations.
  • Including private data in a prompt is wrong because prompts may be stored, reviewed, or processed outside the student's control depending on the system.

Practice Questions

  1. 1 Rewrite this weak prompt into a stronger one using role, task, context, constraints, and output format: 'Explain recursion.'
  2. 2 A student gives 3 input-output examples before asking an AI to classify 12 new text messages. What prompt pattern is being used, and why is it useful?
  3. 3 You need an AI to debug a 40-line Python function. Write a prompt that asks for likely causes, a corrected version, and 3 test cases.
  4. 4 Why is it better to ask an AI to explain its assumptions and provide verification steps instead of only asking for a final answer?