Self-Review Prompt

Asking ChatGPT to review its own generated code with a specific checklist. Catches edge cases, type violations, and runtime errors that the initial generation step missed.

Syntax

chatgpt
Review the code you just wrote.

Check for:
1. [Language] type issues
2. Unhandled edge cases:
   - Null/undefined inputs
   - Empty arrays or objects
   - Invalid type inputs
3. Potential runtime errors
4. [Security concern if applicable]

If issues found: list and fix them.
If no issues: "No issues found."

Example

chatgpt
# After generating a TypeScript function:
Review the code you just wrote.

Check for:
1. TypeScript strict mode violations (no any,
   proper nullability, no non-null assertions)
2. Unhandled edge cases:
   - Empty string input
   - Input with only whitespace
   - Unicode/special characters
   - Input exceeding expected length
3. Runtime errors (array access, property
   access on possibly-undefined values)

List issues and fix, or "No issues found."