Cheat Sheet

Cheat Sheet

Quick reference for common patterns and prompts.

Prompt Starters

GoalPrompt Start
New feature"Create a [feature] that..."
Bug fix"This code has a bug where [behavior]. The error is [error]. Fix it."
Refactor"Refactor this code to [goal]. Keep the same behavior."
Explain"Explain what this code does, line by line."
Review"Review this code for [bugs/security/performance]."
Test"Write tests for this function covering [cases]."
Document"Add JSDoc comments to these functions."

Context Phrases

To AddSay
Constraints"Without using...", "Only using...", "In under X lines..."
Style"Following the pattern in [file]...", "Matching the style of..."
Scope"Just the [specific part]...", "Don't change [other thing]..."
Output"Return [format]...", "Export as [type]..."

Recovery Phrases

ProblemSay
Wrong approach"Let's try a different approach. What if we..."
Too complex"Simplify this. Give me the minimal version."
Missing context"Here's more context: [paste relevant code]"
Going in circles"Let's step back. What's the core problem we're solving?"

The Context Sandwich

[What exists] + [What you want] + [Constraints]

Example:

"We have a Next.js app with Prisma [exists]. 
Add email/password auth using NextAuth.js [want]. 
Use the existing User model. No OAuth for now [constraints]."

Quick Commands

# Cursor shortcuts
Cmd+K          # Inline edit
Cmd+Shift+I    # Open Composer
@filename      # Reference file
Tab            # Accept suggestion
Esc            # Reject/stop

AI Strengths vs Your Job

AI handles: Boilerplate, types, tests, refactoring, docs, errors, regex, SQL, CSS, integrations

You handle: Architecture, security, business logic, performance, UX, code review, deployment

Red Flags to Watch

If AI does this...You should...
Adds unnecessary dependenciesAsk: "Can this be done without a library?"
Creates god-functionsAsk: "Split into smaller functions"
Uses raw SQLCheck for injection vulnerabilities
Ignores error handlingAsk: "Add error handling for..."
Puts files at rootSpecify exact path in prompt

The Golden Rules

  1. Read every line of AI-generated code
  2. Test before committing — Build must pass
  3. Never commit secrets — Check git diff --staged
  4. Start fresh when context gets polluted
  5. You decide architecture and security

"The best code is the code you don't have to write."