ChatGPT Cheatsheet

Prompting techniques, tips & shortcuts for AI assistants

AI
Contents
🤖

Basics

Be specific and clear
❌ "Tell me about Python"
✅ "Explain Python list comprehensions with
   3 examples, beginner-friendly"

Provide context
"I'm building a REST API in Node.js using
Express. How do I add JWT authentication?"

Specify format
"Give me a markdown table comparing..."
"Respond as a numbered list"
"Keep it under 100 words"

Iterate
"Make it shorter"
"Add error handling"
"Explain like I'm 5"
📝

Prompt Patterns

Few-shot prompting
"Translate the following:
 Happy → Feliz
 Sad → Triste
 Angry → "

Template pattern
"I want you to act as a [ROLE].
 Your task is [TASK].
 Here is the context: [CONTEXT].
 Output format: [FORMAT]."

Constraint prompting
"Answer in exactly 3 bullet points"
"Use only words a 10-year-old would know"
"Respond in valid JSON only"

Iterative refinement
"Take your last answer and improve the
 error handling. Also add type hints."
🎭

Role Prompting

System message examples
"You are a senior Python developer.
 Write clean, PEP 8 compliant code."

"You are a database expert. Optimize
 this SQL query for PostgreSQL 16."

"You are a technical writer. Explain
 this concept clearly for beginners."

"You are a code reviewer. Review this
 code for bugs, security issues, and
 suggest improvements."

"You are a Unix sysadmin. Help me
 debug this server configuration."
🔗

Chain of Thought

Step-by-step reasoning
"Think step by step before answering."

"Let's solve this step by step:
 1. First, identify the problem
 2. Then, list possible solutions
 3. Finally, recommend the best one"

Explain your reasoning
"Solve this and show your work:
 What's the time complexity of
 merge sort? Explain why."

Self-consistency
"Generate 3 different solutions to
 this problem, then pick the best one
 and explain why."
📋

Output Control

Format requests
"Return as JSON"
"Format as a markdown table"
"Give me a bulleted list"
"Write as a Python function"
"Output as CSV"

Length control
"In one sentence"
"In 3 bullet points"
"Write a 500-word article"
"Be concise — max 50 words"

Tone control
"Professional tone"
"Casual and friendly"
"Technical for an expert audience"
"ELI5 (Explain Like I'm 5)"
💻

Coding Prompts

Code generation
"Write a Python function that takes a list
 of integers and returns the top 3 most
 frequent elements. Include type hints,
 docstring, and handle edge cases."

Code review
"Review this code for:
 - Bugs and edge cases
 - Performance issues
 - Security vulnerabilities
 - Code style improvements"

Debugging
"This code gives [ERROR]. Here's the code:
 [CODE]. What's wrong and how do I fix it?"

Refactoring
"Refactor this to use [PATTERN/PRINCIPLE].
 Explain each change you made."

Power Tips

• Use delimiters for clarity
  """code here""" or ```code```

• Ask for alternatives
  "Give me 3 different ways to do this"

• Negative prompting
  "Do NOT use any external libraries"
  "Don't explain — just give the code"

• Splitting complex tasks
  Break into sub-tasks, solve each

• Temperature analogy
  "Be creative" = more varied answers
  "Be precise" = more deterministic

• Ask to verify
  "Check your answer for correctness"
  "Are there any edge cases you missed?"