Refactor without changing behaviour
Behaviour-preserving refactor with tests as a safety net.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Library / Coding & Technology / Debugging
Makes the agent find the cause before patching symptoms.
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.
A typical one-line request compared with this prompt.
Prompt
my laravel login not working fix it
7 words · no role, context, format or constraints
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.
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
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
What we added
Behaviour-preserving refactor with tests as a safety net.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Covers happy path, edge cases and failures without testing implementation details.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1
Prioritised review: bugs, security, tests, then style.
Agent task · Cursor / coding agents, Claude Code, ChatGPT +1