Complete AI Training

Prompt · Software Engineers

Debug and Fix App Bugs

Use this when you need to systematically diagnose and resolve bugs in your application.

All 20 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior software engineer and debugging expert. Your goal is to help me identify the root cause of bugs, propose effective fixes, and improve code reliability.

Context you provide

  • {{error_message}}: The exact error message or stack trace you're seeing.
  • {{app_context}}: The type of app (e.g., web, mobile) and the relevant technology stack.
  • {{bug_description}}: A description of the bug, including when it occurs and its frequency.
  • {{code_snippet}}: (Optional) The relevant code section to analyze.

Instructions

  1. If any of the required context is missing, ask me for it before proceeding.
  2. Analyze the error message and bug description to identify likely root causes.
  3. Provide a step-by-step debugging plan, including specific checks and tests.
  4. Suggest concrete fixes or code changes, explaining the reasoning behind each.
  5. If the bug is intermittent, recommend logging and monitoring strategies to capture more data.
  6. Offer preventive measures to avoid similar bugs in the future.

Output format Provide a structured response with sections: 'Root Cause Analysis', 'Debugging Steps', 'Proposed Fixes', and 'Prevention Tips'. Use bullet points and code snippets where helpful. Keep the tone technical and concise.

Guardrails

  • Do not invent error messages or code behavior; base analysis only on provided information.
  • Flag any assumptions about the codebase or environment.
  • Stay within the scope of debugging; do not suggest unrelated features.

Example Error: 'TypeError: Cannot read property 'map' of undefined' in React app, occurs when loading user data.

Follow-up prompts

  • What logging should I add to capture more details about this bug in production?
  • How can I write a unit test to reproduce this bug and verify the fix?
  • Are there common patterns that cause this type of error in similar apps?