Prompt Engineering Cheatsheet: 50+ Techniques with Examples

The complete reference for writing better AI prompts

Ad placeholder (leaderboard)

Prompt engineering is the practice of structuring an instruction so a language model reliably produces the output you want. Good prompting is less about magic phrases and more about clarity: telling the model exactly what to do, in what format, for whom, and showing it examples when words are not enough. This cheatsheet groups the most useful techniques into categories you can reach for in order.

Foundational techniques

These are the techniques you should reach for first, before anything fancy.

  • Be specific. State the task, the desired output format, the length, and the audience. “Summarise this in three bullet points for a non-technical manager” beats “summarise this.”
  • Assign a role. “You are an experienced copy editor” primes the model toward a relevant style and vocabulary.
  • Give the format up front. Ask for JSON, a table, or numbered steps explicitly. Models follow format instructions reliably when they appear before the content.
  • Use delimiters. Wrap input in triple backticks, quotes, or XML-style tags so the model can tell instructions from data. Claude in particular responds well to <document>...</document> tags.
  • State constraints positively. “Reply in under 100 words” works better than a vague “be brief.”

Reasoning techniques

When a task needs multi-step thinking, prompt the model to reason before it answers.

  • Zero-shot chain-of-thought. Append “Let’s think step by step” to coax the model into showing its working, which improves accuracy on maths and logic.
  • Few-shot prompting. Provide two to five worked examples in the exact input-output format you want, then give the real input.
  • Self-consistency. Ask the same reasoning question several times and take the majority answer to reduce one-off errors.
  • Tree-of-thought. Ask the model to brainstorm several approaches, evaluate each, then commit to the best one.
  • ReAct. Interleave reasoning and actions (“Thought / Action / Observation”) when the model can call tools or search.
  • Decomposition. Break a hard task into labelled sub-tasks and solve them in sequence.

Output-control techniques

These shape the final answer rather than the reasoning.

  • Output priming. End your prompt with the start of the answer (for example { for JSON) to nudge format compliance.
  • Negative instructions. Tell the model what to avoid: “Do not invent statistics; if unsure, say so.”
  • Schema enforcement. Provide a literal template with placeholders and ask the model to fill it in.
  • Temperature control. Lower the temperature toward 0 for factual or coded output; raise it for brainstorming and creative variety.
  • Refusal handling. Ask the model to flag uncertainty explicitly rather than guessing, which reduces confident-sounding errors.

Iteration and debugging

Prompting is rarely one-shot. Treat it like code.

  • Critique-and-revise. Have the model draft, then ask it to critique its own draft against your criteria and rewrite.
  • Reference text. Paste the source material and instruct “answer only using the text above” to ground the response and cut hallucination.
  • Step-back prompting. Ask the model to first state the general principle, then apply it to the specific case.
  • A/B your prompts. Change one variable at a time and compare outputs; keep a short log of what worked.

The fastest way to improve is to start specific, add examples when the format matters, add reasoning steps when accuracy matters, and iterate by changing one thing at a time. Most “bad AI output” traces back to a prompt that left too much to chance.

Ad placeholder (rectangle)