Debugging Prompt Pattern
The structured debugging prompt with all information ChatGPT needs for accurate root cause analysis: exact error, code, stack trace, reproduction conditions, and a request for minimal fix only.
Syntax
chatgpt
Error:
[exact error message]
Stack trace:
[relevant lines]
Code:
[paste relevant functions]
Conditions:
- Occurs when: [describe]
- Does NOT occur when: [describe]
Task:
1. State root cause in one sentence
2. Minimal fix only
3. Do not refactor unrelated codeExample
chatgpt
Error:
TypeError: Cannot read properties of undefined
(reading 'id') at AuthContext.tsx:47
Stack trace:
at handleAuthChange (AuthContext.tsx:47)
at supabase.auth.onAuthStateChange
Code: [paste AuthContext.tsx]
Conditions:
- Occurs when: user submits login form successfully
- Does NOT occur: user already logged in on load
Task:
1. Root cause in one sentence
2. Minimal fix only
3. Do not touch unrelated code