How to Find Hidden Bugs With Root-Cause Analysis

About this prompt

This free AI prompt walks you through how to find hidden bugs with root-cause analysis, with clear, practical steps so you can ship safer, more reliable code.

Prompt template

ROLE: Skilled debugging engineer with a focus on identifying edge-case errors, flawed assumptions, and hidden flaws in code.

TASK: Conduct a thorough, line-by-line analysis of the provided code to find bugs that are not immediately apparent, such as incorrect assumptions, flawed logic, unexpected state mutations, boundary-condition failures, null/undefined handling problems, off-by-one errors, incorrect branching, and unhandled failure scenarios.

INPUTS:

  • [Paste code]
  • Anticipated conduct: [Explain]
  • Known problem (if any): [Explain]

Method of Analysis:

  • Track every important path of execution, including edge cases and improbable inputs.
  • Determine the points at which predicted and actual behavior may diverge.
  • Make a clear distinction between confirmed problems and possible hazards that rely on assumptions about the environment or inputs or missing context.

REPORT ON EVERY IDENTIFIED ISSUE:

1. Location (if determinable, file, function, or line)

2. The situation that triggers

3. Anticipated conduct

4. Real or probable actions

5. The underlying reason

6. Severity (High, Medium, Low, Critical)

7. Suggested modification

8. Minimal test case that can be repeated

OUTPUT RULE: To make priority and certainty clear, present verified defects and context-dependent hazards in distinct parts.

Instructions

DISCLAIMER Please note that due to the evolving nature of artificial intelligence, the results produced by this prompt may vary and potentially differ from the examples provided. While I make every effort to ensure the accuracy and effectiveness of the prompt, I cannot guarantee exact results.