Prompt Engineering Cheat Sheet

The prompt patterns that actually change LLM output — anatomy, few-shot, chain-of-thought, and structured formatting — with real examples, pitfalls, and a searchable quick reference.

runs locally on your browser. Your data never leaves your device.
13 sections
33 techniques
Model-agnostic
100% offline

Core Principles

Everything below is a variation on one idea: a model fills in whatever you leave ambiguous with its own best guess, not yours.

Be specific about the task, format, and constraints — not just the topic.
Essential

A vague prompt gets a vague, average answer. Every gap you leave gets filled with the model's guess about what you probably meant — and that guess is rarely the specific thing you had in mind.

State the goal before you state the constraints.
Handy

Put the actual task first, then list the rules for how to do it. The model locks onto what you're asking for before it has to start filtering how to phrase the answer.

Show, don't just describe.
Essential

One concrete example of the input/output shape you want teaches the model far more precisely than a paragraph describing that shape in the abstract.

Iterate — treat the first draft of a prompt as a hypothesis.
Handy

Your first attempt rarely nails a task completely. Read the output, find the specific way it went wrong, and edit the prompt to close that exact gap — don't rewrite from scratch every time.

A prompt is a spec, not a suggestion
The model isn't reading your mind — it's pattern-matching against your literal words. Anything you leave ambiguous gets resolved however similar-looking requests were most often resolved in its training data, which is almost never exactly what you had in mind.
Longer isn't the same as clearer
Padding a prompt with redundant caveats and repeated emphasis (really, this is very important, please make sure...) dilutes the signal instead of strengthening it. One precise sentence beats five vague ones.

Prompt Anatomy

The parts that go into a well-formed prompt regardless of what the task is — leave one out and the model has to guess it.

Role: You are a senior {role}, and your job is to {responsibility}.
Essential

Framing who the model is speaking as changes its vocabulary and what it treats as obvious versus worth explaining — a senior security engineer and a friendly tutor answer the same question very differently.

Task: Your task is to {single, specific action}.
Essential

The one sentence that states exactly what output you want produced — phrased as an instruction, not a question.

Context: Here is the relevant background — {context}.
Handy

Information the model needs but shouldn't have to guess at: prior conversation, source documents, real-world constraints that shape what a good answer even looks like.

Format: Respond using {format}, for example: {mini example}.
Essential

Specify the output shape explicitly. Don't assume the model will default to whatever shape you were picturing — it hasn't seen your picture, only your words.

Constraints: Do not {thing to avoid}. Keep the response under {limit}.
Handy

The boundary conditions: what's off-limits, how long, what tone. Boundaries left unstated get whatever the model's default happens to be, which varies task to task.

Put your most important instruction first and last
Models tend to weight the very start and very end of a prompt more heavily than content buried in the middle. State the highest-priority instruction early, then restate the single most critical one again right before the actual request — a simple "sandwich" structure that measurably improves adherence on longer prompts.

Zero, One & Few-Shot

How many examples to include, and why more isn't automatically better.

Zero-shot — just ask directly, no examples.
Essential

For tasks the model has clearly seen many times (summarizing, translating, basic classification), zero-shot is often enough. Every example you add costs context budget and can bias output toward that example's specific style.

One-shot — give exactly one example of the input/output shape.
Handy

Use when the format is unusual or ambiguous enough that a single example removes the guesswork, but the task itself is simple enough that a second example wouldn't teach anything new.

Few-shot — give 3-5 diverse examples covering the edge cases, not just the typical case.
Essential

The highest-leverage technique for consistent formatting and tone. The examples teach whatever pattern is common to all of them — including patterns you didn't intend, like always using the same sentence length.

Few-shot examples teach accidental patterns too
If every example in your set happens to be a positive review, the model may start assuming every input is positive. Include contrasting examples — positive, negative, edge case — to teach the actual rule you meant, not a shortcut version of it.
Order examples by difficulty, hardest problem last
Recency effects mean the example closest to the actual task has outsized influence on how the model approaches the new input. Put your best, most representative example last, right before the real request.

Chain-of-Thought & Reasoning

Asking a model to show its work isn't just for the reader's benefit — the reasoning becomes part of what the final answer is conditioned on.

Think step by step before giving your final answer.
Essential

Explicitly asking the model to reason through a problem before answering measurably improves accuracy on multi-step logic, math, and analysis tasks.

Explain your reasoning, then give your answer in a clearly separate final section.
Handy

Separating reasoning from the final answer — with a clear divider or tag — makes it easy to extract just the answer programmatically, without giving up the accuracy benefit of visible reasoning.

List the possible approaches before picking one.
Advanced

For genuinely ambiguous problems, asking the model to consider multiple approaches before committing surfaces options a single-shot answer would have skipped straight past.

Self-consistency: generate several independent attempts and take the majority answer.
Advanced

Run the same prompt more than once and compare. For problems with one correct answer, agreement across independent attempts is a strong signal of correctness — disagreement flags a genuinely hard case worth double-checking by hand.

Chain-of-thought isn't free
Visible reasoning consumes output tokens and time. It's worth it for genuinely multi-step problems — math, planning, debugging — and probably wasted on simple lookups or classification the model already gets right zero-shot.
Ask for reasoning you can throw away
Request the reasoning inside a section or tag you strip out programmatically before showing the answer to an end user — you get the accuracy benefit of chain-of-thought without shipping a wall of reasoning to someone who just wanted the answer.

Output Formatting & Structuring

'Respond in JSON' is an instruction. An explicit schema is a contract — only one of those two reliably survives contact with a real model.

Respond only in valid JSON matching this schema: {"summary": string, "tags": string[]}
Essential

The single most reliable way to get structured, parseable output — pair it with an explicit schema or example. 'Respond in JSON' alone still leaves the shape ambiguous.

Use these exact section headers: ## Summary ## Details ## Next Steps
Handy

Naming the literal headers you want gets far more consistent structure than describing the sections in prose.

Wrap the final answer in <answer></answer> tags.
Handy

XML-style delimiter tags make it trivial to parse out just the part you need from a longer response — and it's a pattern Claude in particular was extensively trained to follow precisely.

If a field doesn't apply, output null — never omit the key.
Advanced

For anything you'll parse programmatically, explicitly defining the behavior for missing or inapplicable data prevents a parser from choking on an unexpectedly absent field.

'Respond in JSON' doesn't guarantee valid JSON
The model can still wrap it in a markdown code fence, add a sentence before it, or produce almost-valid JSON with a trailing comma. Ask for JSON only, no other text — and validate/parse defensively regardless.
Tip
Reuse one consistent delimiter style throughout a prompt (### everywhere, or XML tags everywhere) rather than mixing conventions. A model that's seen ### mean "start of a new instruction" three times already treats the fourth ### more reliably than a prompt that switches between ###, ---, and ALL CAPS.

System Prompts & Roles

System, user, and (where supported) a pre-filled assistant turn each carry different weight — mixing up what belongs where is a common source of a prompt that 'mostly' works.

System: You are {role}. Always {behavior}. Never {behavior}.
Essential

System-level instructions set the persistent frame for the whole conversation and are generally treated as higher-priority than instructions embedded later in a user message. Put durable rules here, not one-off task details.

Keep the system prompt about behavior and identity, not one-off tasks.
Handy

Mixing 'you are a helpful assistant' with 'today, summarize this specific document' in the same system prompt makes it harder to reuse across different requests. Task-specific detail belongs in the user message.

State what the assistant should do when it doesn't know the answer.
Handy

Explicitly defining the fallback behavior — say you're not sure, versus give your best guess and flag the uncertainty — prevents confident-sounding hallucination on exactly the questions where a shrug would have been more honest.

system vs. user vs. assistant, in one line each
System sets the ground rules for the entire conversation. User is the human's actual request. And where a provider supports it, pre-filling the start of the assistant's own turn can steer the response directly into a specific format without asking for it in words at all.

Advanced Techniques

For once a single, well-written prompt has demonstrably stopped being enough.

Prompt chaining — break a complex task into a sequence of smaller prompts.
Advanced

Instead of one giant prompt trying to research, draft, and polish in a single pass, run three focused prompts in sequence. Each step is easier to verify, and easier to fix independently when something goes wrong.

Self-critique — ask the model to review and improve its own answer before finalizing.
Advanced

A second pass ('review the answer above for errors, then provide a corrected version') catches a meaningful fraction of mistakes the first pass made, because critiquing existing text is a different, often easier task than generating it from scratch.

Meta-prompting — ask the model to improve the prompt itself.
Advanced

When you're not sure why a prompt isn't working, asking 'how would you rewrite this prompt to get a more reliable answer?' often surfaces the exact ambiguity you missed.

Tree-of-thought — explore several reasoning branches, then evaluate which one to keep.
Advanced

For problems with no single obvious approach, having the model sketch 2-3 strategies and weigh their tradeoffs before picking one avoids committing early to the first idea it happened to think of.

Use one prompt to grade another prompt's output
A separate 'evaluator' prompt that scores a response against explicit criteria — accuracy, completeness, tone — is a cheap way to catch regressions when you change a prompt, without a human re-reading every output by hand.

Pitfalls & Anti-Patterns

The mistakes that quietly undo everything above.

Pair negative instructions with the positive version of what to do instead.
Essential

Telling a model what NOT to do (don't be verbose) requires it to first model the thing you don't want in order to avoid it. Stating the positive target directly (answer in 2-3 sentences) is more reliable.

Contradictory constraints don't average out — they resolve unpredictably.
Handy

Asking for a response that's both comprehensive and under 50 words forces the model to silently pick one requirement over the other, inconsistently. Resolve the tension yourself before the model has to.

Don't dump in every possibly-relevant document 'just in case.'
Advanced

More context isn't automatically better. Irrelevant material competes for the model's attention with the material you actually need it to use, and can measurably reduce accuracy on the parts that count.

Prompt injection is a real risk the moment untrusted text enters your prompt
If any part of your prompt includes text from a user, a webpage, or a document you didn't write yourself, that text can contain instructions that try to override your actual instructions. Wrap untrusted content in clear delimiters and explicitly tell the model to treat it as data, not instructions.
Vagueness gets filled with the model's best guess, not yours
'Write something professional' quietly hands over every decision — length, tone, structure — that you didn't make explicitly. If a detail matters to you, say so. It will never be inferred exactly the way you had in mind.

Model-Specific Notes

Everything above transfers across models. These few things don't — worth knowing which is which.

XML-style tags are especially reliable structure with Claude specifically.
Handy

Claude was extensively trained on XML-tagged structure, so wrapping distinct parts of a prompt in tags like <document>...</document> tends to produce more reliable adherence than the equivalent instruction written out in plain prose.

Markdown headers and numbered lists work reliably across most modern LLMs.
Essential

If a prompt needs to work across different models or providers, plain markdown structure (##, numbered steps) is the safest common denominator — model-specific conventions don't transfer universally.

Check for a dedicated reasoning/thinking mode before manually asking for chain-of-thought.
Advanced

Some models expose an extended-reasoning mode that's more reliable and doesn't cost you visible output tokens the way manually requesting 'think step by step' does. Check the model or provider's docs first.

Note
This page is intentionally model-agnostic — the techniques above transfer across GPT, Claude, Gemini, and open models. Where a specific model rewards a specific convention, it's called out explicitly rather than assumed universal.

Quick Reference

Already know the techniques — just blanked on a name? Search instead of scrolling.

Be specific

State the task, format, and constraints explicitly — not just the topic

Goal before constraints

Put what you want done before the rules for how to do it

Show, don't describe

A concrete example beats a paragraph explaining the shape you want

Iterate

Treat the first prompt as a draft — edit based on exactly what went wrong

Role / Persona

Frames who the model is speaking as and what it treats as obvious

Task

The one-sentence instruction stating the exact output wanted

Context

Background the model needs but shouldn't have to guess

Format

The explicit output shape, ideally with a mini example

Constraints

Boundaries: length, tone, what's off-limits

Zero-shot

Ask directly, no examples — fine for common, well-understood tasks

One-shot

One example, just to remove ambiguity about the output format

Few-shot

3-5 diverse examples for consistent formatting and tone

Chain-of-thought

Ask the model to reason step by step before answering

Separate reasoning from answer

Put the final answer in its own clearly marked section

Self-consistency

Compare multiple independent attempts, trust the majority answer

Explicit schema

Provide the exact output shape, not just 'respond in JSON'

Named section headers

Specify literal headers instead of describing sections in prose

XML delimiter tags

Wrap sections in tags for reliable, parseable structure

Define missing-data behavior

State what to output when a field doesn't apply

System prompt

Persistent rules and identity for the whole conversation

User message

The actual task-specific request

Fallback behavior

Define what to do when the model doesn't know the answer

Prompt chaining

Break a complex task into a sequence of smaller prompts

Self-critique

Ask the model to review and correct its own answer

Meta-prompting

Ask the model to improve the prompt itself

Tree-of-thought

Explore multiple reasoning branches before picking one

Negative instructions

Pair 'don't do X' with the positive version of what to do instead

Contradictory constraints

Conflicting requirements resolve unpredictably, not by averaging

Context overload

Irrelevant material competes for attention with what actually matters

Prompt injection

Untrusted text can contain instructions — label it as data, not commands

XML tags

Especially reliable structure for Claude specifically

Markdown structure

The safest common denominator across most LLMs

Native reasoning mode

Check for a dedicated thinking mode before manually asking for chain-of-thought

33 of 33 commands

Common Use Cases

Real situations, not just isolated techniques — the exact adjustment that fixes each one.

You need consistent JSON output every single time

Combine an explicit schema, one example, and a strict output-only instruction:

  1. Provide the exact schema, not just "respond in JSON"
  2. Add one worked example of the shape
  3. State: respond with JSON only, no other text

You want visible reasoning without shipping it to the end user

Ask for reasoning inside a section you strip out before displaying the answer:

  1. Request reasoning inside a clearly tagged section
  2. Parse the response and discard that section programmatically
  3. Show only the final answer to the user

Your results vary too much between runs on the same input

Narrow the range of acceptable answers instead of leaving it open-ended:

  1. Add 3-5 few-shot examples to anchor the format and tone
  2. Lower temperature if your API exposes it
  3. Make constraints explicit instead of implied

Summarizing a long document keeps missing the point

Split extraction from summarization instead of doing both in one pass:

  1. First prompt: extract the key points as a list
  2. Second prompt: summarize just those extracted points

You need the model to say 'I don't know' instead of guessing

Define the fallback explicitly — it won't happen on its own:

  1. State the fallback behavior in the system prompt
  2. Reward saying "not sure" over a confident guess

Your prompt has to work across GPT, Claude, and Gemini

Stick to the common denominator rather than one model's favorite convention:

  1. Use plain markdown structure (headers, numbered lists)
  2. Avoid model-specific conventions like XML tags

Debugging & Troubleshooting

The symptoms a badly-structured prompt actually produces, decoded.

The model ignores part of my instructions

Instructions buried in the middle of a long prompt get less weight than ones at the start or end. Move the most important rule to the very end of the prompt and restate it right before the actual request.

Output format keeps drifting from what I specified

A description of the format is weaker than a concrete example of it. Add one worked example of the exact output shape you want — few-shot beats prose for format compliance.

The model refuses a legitimate, benign request

A vague or oddly-phrased version of a normal request can accidentally pattern-match something the model is trained to be cautious about. Add explicit context establishing legitimate intent, and be precise about exactly what you're asking for.

The response is padded with caveats and filler instead of the answer

State explicitly that you want the direct answer only, with no preamble or disclaimers, and show one example of the terse style you're after.

The model confidently states something that's wrong

A model under pressure to always sound confident will sound confident even when it's guessing. Ask it to cite where each claim comes from, or explicitly permit uncertainty — say so if you're not sure.

Few-shot examples aren't changing the output at all

Check that the examples actually vary along the dimension you're trying to teach. Five examples that are all subtly the same don't give the model anything new to generalize from.

Things to Remember

If you forget everything else on this page, keep these.

  • A prompt is a spec — anything you leave ambiguous gets filled in with the model's best guess, not yours.
  • Show a concrete example of the output you want; it teaches format and tone faster than describing them.
  • Few-shot examples teach whatever pattern is common to all of them, including ones you didn't intend — vary them deliberately.
  • Chain-of-thought helps genuinely multi-step problems and costs tokens on everything else — use it selectively.
  • Positive instructions ('answer in 3 sentences') are more reliable than negative ones ('don't be verbose').
  • Contradictory constraints don't average out — resolve the tension yourself before the model has to.
  • Untrusted text inside a prompt can contain instructions of its own — label it as data, not commands.
  • The first draft of a prompt is a hypothesis. Read the output, find exactly what went wrong, and edit that.

Common Use Cases

Recall the exact phrasing that reliably gets consistent JSON output before wiring a prompt into production code
Figure out why a set of few-shot examples isn't changing the model's output the way you expected
Reference the difference between a system prompt and a user message before structuring a new AI feature
Search the quick-reference table for a technique's name instead of re-reading a research paper

About Prompt Engineering Cheat Sheet

Prompt engineering gets treated as either mystical incantation ("add 'take a deep breath' for better results") or dismissed as "just typing clearly" — and most guides split the same way: a vague list of platitudes with no way to act on them, or a vendor-specific trick list with no explanation of why any of it works. Underneath both is a small number of concrete, testable techniques.

This one starts from what every prompt is built out of regardless of task — the principles and the anatomy: role, task, context, format, constraints. From there it moves into the core techniques that change output quality directly: zero/one/few-shot examples, chain-of-thought reasoning, and explicit output formatting. Then into how roles and system prompts frame an entire conversation, and the advanced composition techniques — prompt chaining, self-critique, meta-prompting — that come up once a single prompt stops being enough.

Every section calls out the mistakes that actually produce bad output: negative-only instructions that describe what to avoid instead of what to do, contradictory constraints that resolve unpredictably instead of averaging out, context windows overloaded with "just in case" material that dilutes what actually matters, and prompt injection — the very real risk the moment any untrusted text (a document, a webpage, a user message) becomes part of your prompt. There's a searchable quick reference for the moment you already know the technique's name, and a troubleshooting section built around the actual symptoms a bad prompt produces.

This page is deliberately model-agnostic — the techniques here transfer across GPT, Claude, Gemini, and open models. Where one model rewards a specific convention (like Claude's strong adherence to XML-style tags), it's called out explicitly rather than assumed universal. And like every tool on AllCoreKit, this is a static reference page: there's no model running here, no API call, no account. The quick-reference search filters entirely in your browser, and nothing you read or search for is ever sent anywhere or logged.

Frequently Asked Questions