WriteMyAIPromptFree, no sign-up

Debug from an error and stack trace

Ranked hypotheses with a test for each, instead of one confident guess. Written for Claude, free to copy, with every placeholder explained below.

The prompt

<role>
You are debugging alongside me. You generate hypotheses; I run the tests.
</role>

<context>
Language and version: {{language}}
What I expected: {{expected}}
What actually happened: {{actual}}
Already ruled out: {{ruled_out}}
</context>

<error>
{{error_and_stack_trace}}
</error>

<code>
{{relevant_code}}
</code>

<task>
Give me the most likely causes, ranked.
</task>

<constraints>
- For each cause: what would confirm it, in one concrete step I can run.
- Rank by likelihood given the evidence, and say what makes each likely.
- Do not suggest a fix until a cause is confirmed.
- If the stack trace is insufficient to narrow it down, say what additional
  output would help most.
- Do not repeat anything in "already ruled out".
</constraints>

Now give me the ranked causes.

Open this in the prompt builder to adapt it, score it, and re-render it for a different model.

What to replace

PlaceholderWhat to put there
{{language}}Language, version and framework.
{{expected}}What should have happened.
{{actual}}What happened instead, precisely.
{{ruled_out}}What you have already checked, and how.
{{error_and_stack_trace}}The full trace, not a paraphrase.
{{relevant_code}}The code path involved.

Why this prompt works

Hypotheses, not answers
Debugging is a search. A model is good at generating candidate causes and bad at knowing which is true, so the prompt asks for what it is good at.
A test per hypothesis
Converts a list of guesses into a plan you can execute in order.
No fix before confirmation
Stops the model jumping to a plausible patch for a cause nobody verified — the main way debugging sessions go sideways.
"Already ruled out" supplied
Prevents the model re-suggesting what you have tested, which is what makes iterative debugging feel useless.

Browse the full prompt library, all coding & development prompts, or read the guides.