Prompt library

Fix a bug from the logs

IntermediateFix a bug

Asks for a hypothesis, a failing test, and the smallest diff. The log goes in the prompt, not a vague summary.

When to use it

Use when you have the error in hand: a stack trace, a request log, or the steps. Without a log, the model guesses. Paste what the console showed into LOGS, even if it is ugly.

Variables

[SYMPTOM][LOGS][EXPECTED][REPRO_STEPS][CONSTRAINTS]

Copy prompt

Fix a bug. Do not rewrite the project.

Symptom: [SYMPTOM]
Expected behavior: [EXPECTED]
How to reproduce: [REPRO_STEPS]
Constraints (what not to change): [CONSTRAINTS]

Log (you may redact email, token, cookie, and keys; do not invent a line that is not here):
[LOGS]

Method
1. In at most 8 lines, say what the log proves and what is still a hypothesis.
2. Point at the most likely file and function. If there are two hypotheses, test the cheaper one first.
3. Write or adjust an automated test that fails on the bug and passes with the fix. If the repo has no runner, give the shortest command to reproduce and what to watch.
4. Make the smallest diff that makes the test pass. Do not reformat untouched files. Do not change a dependency. Do not "clean up while you are here".
5. Run the test and paste the relevant output. If you cannot run it, say so and do not pretend it passed.

Do not
- Do not tell me to turn the error off.
- Do not raise a timeout to hide a race.
- Do not swallow an exception with an empty catch.

At the end: the cause in one sentence, the files changed, the risk that remains.

How to run this prompt

  1. Paste the symptom and the log. The full log of the failing part, plus what you expected.
  2. Ask for the test first. The diff lands only after a test that reproduces the bug.
  3. Read what did not need to change. If the model reformats unrelated files, reject that part.

Where this breaks

Do not paste a secret. The prompt says to redact tokens and emails, but stripping passwords and keys is your job, before you paste.

Result

Slot for a screenshot or demo. No result is published yet.