Stack trace debugger prompt: find root cause fast
Paste a stack trace and the related code to get a root-cause diagnosis and a concrete fix instead of guesswork.
متى تستخدم هذا البرومبت
- When an exception crashes production and the trace alone isn't enough.
- When a bug only reproduces intermittently.
- When reviewing a teammate's crash report.
نص البرومبت
Analyze this {{language}} stack trace and surrounding code, identify the likely root cause, and suggest a fix. Framework: {{framework}}.
{{CLIPBOARD}}{{language}}{{framework}}{{CLIPBOARD}}الكتلة {{CLIPBOARD}} تُستبدل تلقائياً بما نسخته قبل الضغط على «نسخ».
كيف تستخدمه
- انسخ البرومبت بالزر أو املأ المتغيرات أولاً.
- الصقه في ChatGPT أو Claude أو Gemini.
- عدّل النتيجة أو أعد الطلب بتغيير المتغيرات.
مثال على النتيجة
Root cause: user.profile is undefined when a new signup hasn't completed onboarding, causing the TypeError at line 42. Fix: const bio = user.profile?.bio ?? ''; Also check: any other call site reading user.profile without the same guard.
نصائح للاستخدام
- Paste the full trace, not just the top line, plus the function(s) it points to.
- Include the input or state that triggered the crash if you have it.
- Ask it to check other callers of the same function, not just the one line that crashed.
النماذج الموصى بها
Claude
أسئلة شائعة
- Do I need the full application code for this?
- No, the stack trace plus the specific function(s) it references is usually enough; add more context only if the fix seems ambiguous.
- Can it fix flaky, hard-to-reproduce bugs?
- It can suggest likely causes from the trace and code shape, but intermittent bugs may need added logging to confirm before fixing.