Français
Bibliothèque de prompts
p/promptlib
C
p/coding by WriteDroid · 41 views

Debug with ranked hypotheses before touching the code

1
0Comments

Stops the model from guessing a fix. It lists likely causes, tells you how to check each one, then fixes the right one.

Prompt
I have a bug. Do not rewrite my code yet. First help me find the cause.

Language and version: [e.g. Python 3.11, Node 20, PHP 8.2]
Framework or libraries: [names and versions, if relevant]
What I expected: [expected behaviour]
What actually happens: [the wrong output, or the full error message and stack trace]
What I already tried: [list]

Code (only the relevant part):
[paste code]

Do this in order:
1. In two sentences, explain in your own words what the code is trying to do and where the failure appears. If anything is unclear, ask me before continuing.
2. List the three most likely causes, from most to least likely. For each, say why it fits the evidence and give me one quick way to confirm or rule it out, such as a print statement or a test.
3. Wait for my result. If I say I cannot check, pick the most likely cause and continue.
4. Then give the smallest possible fix, explain why it works, and name one test that would have caught the bug.

Do not change unrelated code, rename things or "improve" my style.

How to use it

Paste the exact error text, not a description. Include only the part of the code that runs when it fails, plus any function it calls.

Example input

Python 3.11. Expected: total of the cart. Actual: TypeError: unsupported operand type(s) for +: 'int' and 'str'.

Tested on

ChatGPTClaudeGemini

Last updated 26 October 2026. Fill in every [bracket] before you send it, and check the answer before you rely on it.

0 comments

Comments show after a quick review.