Debug This Code

Prompt v2.0

Debug This Code

bug fixingcode reviewdebuggingdeveloper workflowpromptsoftware development
ChatGPTClaudeGemini⚠ Human review requiredπŸ“ Needs project context
Health 100/100 β–² 54 πŸ“‹ 216 copies

Trigger Phrase

Use prompt: Debug This Code

Prompt

178 words
ROLE:
You are a debugging partner helping the user diagnose, explain, and fix a bug.

GOAL:
Identify the root cause of the bug, explain why it is happening, fix it, and show how to prevent similar issues in future.

INPUT:
Language, framework, code, expected behaviour, actual behaviour, reproduction steps, and previous attempts: [PASTE DETAILS]

CONTEXT:
The user does not just want a patch. They want to understand the bug at the level of cause, failed assumptions, and prevention.

TASKS:
1. Read the code and reproduction context carefully.
2. Identify the root cause, not just the symptom.
3. Explain why the user's earlier fixes did not work.
4. Provide the corrected code with explanation.
5. Suggest ways to prevent similar bugs in future.

CONSTRAINTS:
- Do not invent missing code context.
- Be specific about where the problem occurs.
- Explain the fix clearly.
- Avoid hand-wavy debugging advice.

OUTPUT FORMAT:
- Root cause
- Why previous attempts failed
- Fix with explanation
- Prevention tips

IMPORTANT:
Wait for user data before starting. Write in British English. Prioritise diagnosis and teaching, not just patching.

Before & After

❌ Without this prompt

Unstructured request with unclear constraints and inconsistent output.

βœ… With this prompt

Reusable, testable prompt/skill with clear trigger, inputs, output format, guardrails, and pass criteria.

Install Instructions

Copy the prompt text. Paste into ChatGPT, Claude, Gemini, or any AI chat. Fill in bracketed placeholders with your details. Run and review output.

Test It

Test command:
Trigger with: 'Test the Debug This Code with this input: [provide a short real example]'. Confirm output is specific, structured, and useful.
Expected output:
Root cause: The stale closure inside the event handler captures the initial state value, so updates never reflect the latest count. Fix: Move the handler to use the functional state update form.
Pass criteria:
  • Output is specific to the input provided β€” not generic. Output follows the stated format and length. No invented statistics, facts, prices, or dates. Placeholders are not left unfilled.

⚠️ Guardrails

  • Do not invent statistics, prices, laws, medical claims, or financial advice. Do not leave placeholders unfilled in output. Flag when inputs are too vague to produce a quality result β€” ask for clarification.

πŸ“ Context File Tip

Project Context file

⚠️ Common Failure Modes

  • May become generic, over-confident, miss constraints, over-automate, or produce output that needs fact checking.

πŸ”§ Fix Prompt

Tighten the goal, add examples, add constraints, specify the output format, and ask the model to list assumptions before final output.

πŸŽ› Available Modes

Quick Detailed Critic Final

πŸ”Œ Compatibility & Requirements

βœ… Works offline
πŸ“ Needs project context
πŸ‘€ Needs human approval
Approval point: Before publishing, sending, spending money, changing systems, or making commitments.
Required tools: No external tools required

πŸ“‹ Upgrade Notes

Upgraded for Prompt Hub Pro v9.9.5 scoring, skill metadata, importer compatibility, and reusable agent/workflow presentation.

πŸ’‘ Suggest an improvement

Install Wizard

Choose your platform to get step-by-step install instructions: