Skip to content
PromptPilot AI

Library / Coding & Technology / Debugging

Fix a bug with root-cause analysis

Makes the agent find the cause before patching symptoms.

Cursor / coding agentsClaude CodeChatGPTClaude
Who it's for
Developers using AI coding tools
Use case
Debugging
Output
Agent task · Free
You'll need to fill in
describe what happens vs what should happenstepspaste error or stack trace
Prevents: Agent patches the symptom (adds a null check) without understanding why it happens.
Bug: [describe what happens vs what should happen]
Steps to reproduce: [steps]
Error / logs:
"""
[paste error or stack trace]
"""

Before changing any code:
1. List the 2–3 most likely root causes, with the evidence for each.
2. Tell me which files you need to read to confirm, then read them.
3. State the confirmed root cause in one sentence.

Then fix it with the smallest change that addresses the root cause, add a regression test that fails before the fix and passes after, and run the test suite. Do not refactor unrelated code.

Copies your prompt and opens the official site in a new tab. You may need to paste it yourself (Ctrl/⌘ + V). Nothing is sent to the AI by us.

Replace [bracketed] parts with your own details before sending. Want it tailored? Build a custom coding assistant prompt.

Before vs after

A typical one-line request compared with this prompt.

BeforeWhat people usually type

Prompt

my laravel login not working fix it

7 words · no role, context, format or constraints

Example output (written by us for illustration, not a live AI response)
Here are some common reasons Laravel login may not work:
1. Check your .env database settings
2. Clear cache with php artisan config:clear
3. Make sure passwords are hashed
4. Check your routes
5. Verify the session driver
Try these steps and it should work.
AfterThis library prompt

Prompt

Bug: [describe what happens vs what should happen]
Steps to reproduce: [steps]
Error / logs:
"""
[paste error or stack trace]
"""

Before changing any code:
1. List the 2–3 most likely root causes, with the evidence for each.
2. Tell me which files you need to read to confirm, then read them.
3. State the confirmed root cause in one sentence.

Then fix it with the smallest change that addresses the root cause, add a regression test that fails before the fix and passes after, and run the test suite. Do not refactor unrelated code.

96 words · generated instantly from templates, no AI called

Example output (written by us for illustration, not a live AI response)
Expected: valid credentials → /dashboard. Actual: redirect to /login, no error.

| Likely cause | Evidence | How to check |
| Session cookie not persisting after the server move | Started after migration | Check SESSION_DOMAIN and SESSION_SECURE_COOKIE vs https |
| Session driver can't write | New server permissions | ls -la storage/framework/sessions |
| Auth::attempt fails silently | No error shown | Log the attempt() result |

Fix (once confirmed): set SESSION_DOMAIN to the new domain, run php artisan config:clear.
Regression test: a feature test that posts valid credentials and asserts redirect('/dashboard') and assertAuthenticated().

What changed

  • Added stack versions, the exact symptom and what changed
  • Ranked causes with evidence and a check for each
  • Root-cause fix plus a regression test
  • No guessing at code it hasn't seen

What we added

  • Your details: [brackets] for the facts only you know
  • Step-by-step workflow: numbered steps

Related prompts