Quick Reference

Reference intermediate

Prompt Engineering Quick Reference Card

The Prompt Formula

CONTEXT + TASK + CONSTRAINTS + FORMAT
Part Question It Answers Example
Context What is the situation? "In a TypeScript Express API..."
Task What do I want? "...create middleware that validates JWT tokens..."
Constraints What are the limits? "...using jose library, no external auth services..."
Format What should output look like? "...as a named export with full types."

Five Prompt Levels

Level When Template
1-Line Trivial task "Rename X to Y in this function"
Sentence Simple task "Create a function that [does X] given [inputs]"
Paragraph Clear task + context Context + task + key constraint
Structured Complex task Numbered requirements + examples
Multi-turn Large feature Progressive prompts building on each other

Power Words

Word Effect Example
"Only" Scopes output "Only modify the error handling"
"Must" Hard requirement "Must support SSR"
"Exactly" Precision "Return exactly this shape: {...}"
"Without" Exclusion "Without external dependencies"
"Like" Pattern match "Like the existing UserService"
"Minimal" Reduces bloat "Minimal implementation"
"Step by step" Forces reasoning "Walk through step by step"

Context Priority (What to Include First)

  1. Types/Interfaces the code must satisfy
  2. Adjacent code it integrates with
  3. Example input/output pairs
  4. Framework/version constraints
  5. Style preferences

The Refinement Toolkit

Problem Refinement
Too complex "Simplify. Max [N] lines."
Missing case "Also handle [edge case]."
Wrong style "Rewrite as [pattern]. Example: [code]"
Incomplete "Finish the implementation for [X]."
Over-engineered "Remove [abstraction]. Inline it."
Unclear naming "Rename to match: [convention]"

Anti-Patterns to Avoid

Anti-Pattern Problem Fix
"Make it good" Means nothing Specify quality criteria
1000-word prompt AI loses track Break into steps
No examples Ambiguous output Add input/output example
"Fix it" (no context) AI guesses wrong Include error + code
Repeating failed prompt Same result Rephrase completely
Including entire codebase Noise buries signal Include only relevant code

Prompt Debugging Checklist

When output is wrong, check:

  • [ ] Did I specify the task clearly? (One sentence summary test)
  • [ ] Did I include necessary context? (Types, imports, adjacent code)
  • [ ] Did I constrain the scope? (What NOT to change)
  • [ ] Did I provide an example? (Expected input/output)
  • [ ] Is my prompt under 500 words? (Conciseness check)
  • [ ] Did I specify the format? (How to return the result)

Quick Patterns

Generate:

Create [WHAT] that accepts [INPUTS], returns [OUTPUTS], handles [EDGES].

Fix:

Fix [FILE:LINE]. Error: [MESSAGE]. Expected: [CORRECT BEHAVIOR].

Refactor:

Refactor [CODE] to [GOAL]. Keep [INVARIANT]. Change [SPECIFIC THING].

Test:

Test [FUNCTION] covering: happy path, [EDGE 1], [EDGE 2], error case.

Explain:

Explain [CODE]: what it does (1 line), how it works, why this approach.

Model Strengths (Choose Accordingly)

Task Type Best Model Tier Why
Boilerplate Any (fast) Low reasoning needed
Business logic Mid-tier Balance of speed + quality
Architecture Top-tier Deep reasoning needed
Bug diagnosis Top-tier Complex analysis
Formatting/style Any (fast) Mechanical transformation

The 10-Second Rule

If you cannot state your prompt's goal in 10 seconds, decompose it further before sending.

Goal in 10 seconds: "I need a function that paginates an array."
Full prompt: "Create a paginate function: (items: T[], page: number, 
perPage: number) => { data: T[], total: number, pages: number }. 
Handle: empty array, page beyond range, perPage of 0."