ChatGPT Prompt Cheatsheet - Templates & Techniques
The value of writing prompts as reusable templates is not that any single answer improves, but that output stops changing shape on every request and becomes structurally stable. This sheet organises templates into role setting, structured output, coding, text processing, few-shot and chain of thought, which map one-to-one onto six different failure causes: an undefined persona makes the tone drift, an undeclared format forces you to regex the answer out, an un-decomposed task makes the model skip steps, too few examples leave the style inconsistent, and unexpanded reasoning produces arithmetic errors. Reach for it when you are about to write a fourth prompt that is similar in function but differently worded - the right move there is to abstract a template, not to keep tuning phrasing - or when the model keeps prefixing JSON with pleasantries, which is a missing instruction rather than disobedience. Two tests mark a template as sound: a stranger can follow it without your context, and two different inputs produce structurally identical output. The second one exposes assumptions the first hides.
Role Setting (System Role) 5
You are a senior {domain} expert with 10+ years of experience. Answer the following in a professional yet accessible way: {question}As a {role}, complete the following task strictly following {standard/spec}: {task}Your identity is {role}, your goal is {goal}, your constraints are {constraints}. Begin: {input}Analyze {issue} from the perspective of {role}, give 3 viewpoints from different angles with supporting reasons.Assume you are a {position} in {scenario}; give the complete steps and caveats to handle {issue}.Structured Output (JSON/Table/Markdown) 5
Output the following as JSON with fields: name, description, tags. Output JSON only, no explanation. Content: {text}Compare {A} and {B} in a Markdown table across: performance, usability, ecosystem, learning cost.Output in this structure: ## Title / ### Subtitle / - Points. Topic: {topic}Output strictly per this JSON Schema, with no explanation: {schema}. Input: {input}Break the following requirement into a checklist table with columns: task, priority, estimated hours. Requirement: {req}Code (Generate/Review/Explain/Refactor) 5
Implement the following in {language}: {requirement}. Include error handling, comments, and a unit test example.As a senior {language} developer, review the following code for bugs, performance, and readability, then provide an improved version:
```
{code}
```Explain the following code line by line: its purpose, mechanism, and potential issues: {code}Refactor the following code to reduce complexity and improve readability while preserving behavior. Explain each change: {code}Write unit tests for the following function covering happy path, edge cases, and exceptions: {function}Text Processing (Summarize/Translate/Rewrite/Extract) 5
Summarize the following in under 200 words and extract 3-5 keywords: {long text}Translate the following into {target language}, keeping technical terms accurate and tone {formal/casual}: {text}Rewrite the following in {style: explainer/academic/marketing} style for {audience}: {text}Extract all {entity type: person/place/date/amount} from the following as a list: {text}Compare the differences between the two texts across viewpoint, evidence, and conclusion: {text A} vs {text B}Few-shot Prompting 4
Examples:
Input: good → Output: great
Input: bad → Output: terrible
Now process: {input}Task: classify customer reviews as positive/negative/neutral.
Examples: "Works great" → positive
"Slow shipping" → negative
Classify: {review}Generate SQL in this format:
Q: list all users
A: SELECT * FROM users;
Q: {natural language query}
A:Style imitation: here are samples of my writing style
{sample 1}
{sample 2}
Continue in the same style: {opening}Chain of Thought 4
Reason through the following step by step: list known conditions, then analyze approach, then give the answer: {question}Solve the following step by step like a math teacher, citing the formula or theorem for each step: {question}Before answering, think: 1) key constraints 2) feasible options 3) pros/cons of each 4) recommended option. Question: {question}Perform a pros/cons analysis on this decision: list all factors first, then weigh them, then recommend: {decision}Tips
- Providing role + constraints + output format together beats "help me write X" by an order of magnitude.
- When requesting JSON, always add "output JSON only, no explanation" or the model prepends prose and breaks parsing.
- For complex reasoning, trigger Chain of Thought with "step by step"; accuracy on math/logic improves markedly. On GPT-4+ you can literally write "Let's think step by step".
- 2-3 Few-shot examples are enough; more risks overfitting and wastes tokens. Keep example I/O format identical to the real task.
FAQ
Why does the model keep adding commentary when I ask for pure JSON?
A soft instruction like "no explanation" is not strong enough. Combine an explicit prohibition — output only JSON, no explanatory text — with a structural constraint such as a JSON Schema. The natural-language version sets the tone while the schema sets the shape, and the schema is what actually holds. When it matters, pair it with a hard validator such as --output-schema.
Which tasks benefit most from chain-of-thought prompting?
Multi-step reasoning: arithmetic, logic, and technical trade-offs with several constraints. Ask it to list the known conditions, then reason, then answer — for instance "reason step by step: first list the known conditions, then analyze, then give the answer". It adds little for pure retrieval, where the answer does not depend on a reasoning chain, and merely bloats the output there.
Should I use few-shot or zero-shot prompting?
Use few-shot when the input-to-output mapping is clear and the format must be stable: giving two or three examples lets the model generalize the pattern, and classification accuracy is usually meaningfully higher than zero-shot. Zero-shot is fine for simple tasks or when examples are hard to source. The key is covering the input distribution you actually see — examples drawn only from ideal cases fail on edge inputs.
How do I stop the model from adding filler?
Give checkable constraints rather than descriptions: "do not use bullet lists", "no pleasantries, answer directly", "do not summarize unless asked". Filler appears when nothing rules it out — models default to prefixes like "Certainly!" and suffixes like "Hope this helps". Naming them explicitly produces noticeably cleaner output.
How should I ask for a useful code review?
Ask along explicit dimensions instead of a vague request — classify findings into bugs, performance problems and readability issues, and ask for a revised version: "review this code, point out bugs, performance problems and readability issues, then provide an improved version". The result is structured and complete, and each point is easy to accept or reject individually.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 31, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us