All Infographics
Prompt Engineering Basics infographic - Dos and Don'ts for Getting Better AI Outputs

Click image to open full size

Computer Science

Prompt Engineering Basics

Dos and Don'ts for Getting Better AI Outputs

Prompt engineering is the skill of writing clear instructions so an AI system produces useful, accurate, and well formatted output. It matters because the same model can give very different answers depending on the wording, context, and constraints in the prompt. Good prompts save time, reduce confusion, and improve the quality of results for coding, writing, research, and study tasks. Learning a few basic dos and don'ts helps students use AI more effectively and responsibly.

A strong prompt usually includes a goal, relevant context, output format, and any limits or success criteria. For example, asking for a 150 word summary for a ninth grade audience gives the model more guidance than simply saying summarize this. Prompt engineering is not magic and it does not guarantee correctness, so users still need to check facts and reasoning. The best workflow is iterative: write a prompt, inspect the output, then refine the prompt to improve precision and usefulness.

Key Facts

  • Better specificity usually increases output quality: useful prompt = task + context + constraints + format
  • A role can guide style and perspective: role + task + audience + format
  • Examples improve consistency: prompt + 1 or 2 examples -> more predictable output
  • Token use affects cost and length: total tokens = input tokens + output tokens
  • Iteration is part of the process: prompt_2 = prompt_1 + clarification + feedback
  • Verification is essential: final answer quality = model output + human review

Vocabulary

Prompt
A prompt is the text or instruction a user gives to an AI system to request a response.
Context
Context is the background information that helps the AI understand the situation and task.
Constraint
A constraint is a limit or rule in the prompt such as length, format, tone, or allowed sources.
Iteration
Iteration is the process of revising a prompt step by step to improve the output.
Hallucination
A hallucination is an AI generated statement that sounds confident but is false or unsupported.

Common Mistakes to Avoid

  • Using vague prompts, which is wrong because the model has too little guidance and may guess the goal, audience, or format.
  • Asking for too many unrelated tasks at once, which is wrong because mixed instructions often produce incomplete or disorganized answers. Break the job into smaller prompts.
  • Trusting the first output without checking it, which is wrong because AI can make factual, logical, or citation errors even when the writing sounds polished.
  • Leaving out constraints, which is wrong because the model may give an answer that is too long, too technical, or in the wrong structure for the assignment.

Practice Questions

  1. 1 A student writes the prompt: Explain photosynthesis. Rewrite it to include 3 added elements: a target audience of seventh graders, a length limit of 80 words, and a bullet list format.
  2. 2 You can include at most 220 tokens in a request and response together. If your prompt uses 95 tokens, what is the maximum number of tokens available for the model's answer?
  3. 3 Two prompts are given for the same task. Prompt A says, Write about climate change. Prompt B says, In 120 words, explain two causes of climate change for a high school audience and end with one practical action people can take. Explain which prompt is better and why.