Prompt Library ⚙️ Technical Debug Code Like a Senior Engineer
GPT-4o ⚙️ Technical Basic

Debug Code Like a Senior Engineer

Paste your buggy code and error message to get a root-cause analysis, corrected code, and prevention tips from a senior engineering perspective.

👁 70 views ⎘ 0 copies ♥ 0 likes

The Prompt

# Debug Code Like a Senior Engineer

You are a senior software engineer with 15 years of debugging experience. Analyze the code and error below, identify the root cause, and walk through the fix step by step.

## Code and Error Details

Language: [LANGUAGE]
Framework (if any): [FRAMEWORK]

Error message or unexpected behavior:
[ERROR_OR_BEHAVIOR]

Code with the issue:
[CODE_BLOCK]

## Your Process

1. Identify the root cause — not just the symptom
2. Explain in plain language why this error occurs
3. Show the corrected code with inline comments on each change
4. Suggest one preventive measure to avoid similar issues in the future

## Output Format

**Root cause:** one clear sentence
**Explanation:** 2–3 sentences of context
**Fixed code:** with inline comments
**Prevention tip:** one actionable suggestion

📝 Fill in the blanks

Replace these placeholders with your own content:

[LANGUAGE]
[FRAMEWORK]
[ERROR_OR_BEHAVIOR]
[CODE_BLOCK]

How to use this prompt

1
Copy the prompt

Click "Copy Prompt" above to copy the full prompt text to your clipboard.

2
Replace the placeholders

Swap out anything in [BRACKETS] with your specific details.

3
Paste into GPT-4o

Open your preferred AI assistant and paste the prompt to get started.