ChatGPT Prompts Cheatsheet - Effective Prompt Writing Techniques
Essential ChatGPT prompt templates organized by Role Setting, Structured Output, Code, Text Processing, Few-shot, and Chain of Thought. Copy a template, fill the variables, and ship.
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}Anchor expertise with domain + years, avoids generic answers, good for consulting
As a {role}, complete the following task strictly following {standard/spec}: {task}Force compliance with a spec (PEP8, RFC, company template), reduces rework
Your identity is {role}, your goal is {goal}, your constraints are {constraints}. Begin: {input}Identity + goal + constraints triple, clear behavior boundaries for complex tasks
Analyze {issue} from the perspective of {role}, give 3 viewpoints from different angles with supporting reasons.Force multi-angle thinking, avoids single-viewpoint bias, good for decisions
Assume you are a {position} in {scenario}; give the complete steps and caveats to handle {issue}.Scenario-based role-play, output closer to real workflows, good for process design
Structured Output (JSON/Table/Markdown) 5
Output the following as JSON with fields: name, description, tags. Output JSON only, no explanation. Content: {text}Named fields + no explanation, get directly parseable JSON for programmatic use
Compare {A} and {B} in a Markdown table across: performance, usability, ecosystem, learning cost.Predefined dimensions, doc-ready table output, good for tech selection
Output in this structure: ## Title / ### Subtitle / - Points. Topic: {topic}Specify heading levels, paste-ready Markdown, good for quick doc skeletons
Output strictly per this JSON Schema, with no explanation: {schema}. Input: {input}Schema constrains field types, good for generating validated API data
Break the following requirement into a checklist table with columns: task, priority, estimated hours. Requirement: {req}Requirement to actionable list, good for planning and task assignment
Code (Generate/Review/Explain/Refactor) 5
Implement the following in {language}: {requirement}. Include error handling, comments, and a unit test example.Require error handling + comments + tests at once, avoids "toy code"
As a senior {language} developer, review the following code for bugs, performance, and readability, then provide an improved version:
```
{code}
```Categorized review (bug/perf/readability) + improved version beats generic "check this"
Explain the following code line by line: its purpose, mechanism, and potential issues: {code}Line + mechanism + risk, good for onboarding to unfamiliar codebases
Refactor the following code to reduce complexity and improve readability while preserving behavior. Explain each change: {code}Stress "preserve behavior" to avoid logic changes; require explanations for review
Write unit tests for the following function covering happy path, edge cases, and exceptions: {function}Explicit three test categories, avoids happy-path-only tests
Text Processing (Summarize/Translate/Rewrite/Extract) 5
Summarize the following in under 200 words and extract 3-5 keywords: {long text}Word limit + keyword extraction, good for skimming long articles
Translate the following into {target language}, keeping technical terms accurate and tone {formal/casual}: {text}Specify term accuracy and tone, avoids machine-translation feel
Rewrite the following in {style: explainer/academic/marketing} style for {audience}: {text}Style + audience dual constraint, output hits the scenario precisely
Extract all {entity type: person/place/date/amount} from the following as a list: {text}Specify entity type, good for NER labeling or info gathering
Compare the differences between the two texts across viewpoint, evidence, and conclusion: {text A} vs {text B}Structured comparison dimensions, good for version diffs and argument analysis
Few-shot Prompting 4
Examples:
Input: good → Output: great
Input: bad → Output: terrible
Now process: {input}2-3 examples demonstrate the mapping; model generalizes automatically, good for sentiment shifts
Task: classify customer reviews as positive/negative/neutral.
Examples: "Works great" → positive
"Slow shipping" → negative
Classify: {review}Examples + label set, higher accuracy than zero-shot classification
Generate SQL in this format:
Q: list all users
A: SELECT * FROM users;
Q: {natural language query}
A:Q&A pairs demonstrate format, common for Text-to-SQL and structured generation
Style imitation: here are samples of my writing style
{sample 1}
{sample 2}
Continue in the same style: {opening}Provide style samples so the model imitates personal writing style
Chain of Thought 4
Reason through the following step by step: list known conditions, then analyze approach, then give the answer: {question}Force stepwise reasoning, significantly improves math/logic accuracy
Solve the following step by step like a math teacher, citing the formula or theorem for each step: {question}Require citing basis, makes it easy to verify the reasoning
Before answering, think: 1) key constraints 2) feasible options 3) pros/cons of each 4) recommended option. Question: {question}Four-step decision framework, good for open-ended decisions
Perform a pros/cons analysis on this decision: list all factors first, then weigh them, then recommend: {decision}List factors before weighing, avoids bias, good for major decisions
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.
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