Feedback loopable first. Before you read much code and before any fix, make the failure repeatable as text you can read in a loop: a URL that shows the broken state, a fixture or a failing test, a small CLI or script that prints the value that's wrong. A fix without that loop passes until it doesn't, and nobody can tell.
Done: the failure reruns on demand, the chain from trigger to symptom is stated without a gap, every link with file:line or a command's output, and the fix is verified on the same harness or the diagnosis is handed over.
1. The harness
Find the smallest thing that shows the failure, and run it:
- A URL with the state in it: the page, the record, the query string. With a dev login when the page needs one.
- A fixture or a test that fails for the reason the user saw, not for a nearby one.
- A small CLI: a script, an artisan or npm command, a
curlagainst the endpoint, that prints the wrong value, not just an exit code.
It takes the reporter's own data and conditions where you can get them. When the error tracker holds an issue for it (Laravel Nightwatch, Sentry, the host's logs), read that first: its stack trace and first-seen time are evidence, and they tell you what the harness has to reproduce.
Reshape the harness as you learn: print the value one hop earlier, add the field that tells two hypotheses apart, shrink the input. Keep it to rerun after the fix. Can't reproduce it: say so, say what you tried and what you'd need, and lower every later claim to match.
When the project lacks what a harness needs (a start command, a seeded account, a dev login, readable logs), build that piece as reusable tooling and name it in the report; the setup skill holds the list.
2. Rule out the environment
Before reading code: a stale build or stale assets, a stale config or route cache, the wrong database or env, a queue worker still running old code, another session's uncommitted edit in the same tree.
3. Trace back from the symptom
Start where it shows and walk back to where it starts. One hypothesis at a time. Before you test one, name the observation that would refute it, then make that observation with the harness. Changing several things to see what helps hides which one mattered.
4. The gate
No fix until the chain is complete. 'Somehow X leads to Y' is a gap. Only the user decides to act on a best guess.
5. When it doesn't converge
Three hypotheses refuted, or two fixes that didn't hold: stop changing code. Write down what each attempt ruled out and look for the assumption they share. When every fix would be a workaround, the design is the problem: say that and stop.
6. Fix
- The failing test first, where tests already cover that behaviour. Say in one line what it catches and what it misses.
- One change. Then the harness from step 1 again, unchanged, and a nearby case that must not change. Then a look at the callers of what you changed.
- A test that fails because the fix reverses intended behaviour isn't a wrong test. That's the user's decision.
7. The signal that was missing
When the deciding fact took digging because no log, metric or error showed it, propose the one that would have: a log field, a metric, an assertion. A proposal only.
8. Report
- Problem: what failed, and for whom.
- Harness: the command, URL or test that shows it, and its output before and after.
- Cause: the chain, with
file:line. - Fix: what changed and how it was verified, or 'diagnosis only'.
- Prevention: the test added and the signal proposed.
- Confidence: high, medium or low, and what would raise it.
Then the finish skill, when the fix is more than a line.
Production
When the failure only shows in production, the same steps hold, with these on top:
- Read what production recorded before touching it: the error tracker, then the host's logs for the window around the error (Laravel Cloud's
cloudCLI, orstorage/logs/over SSH on Forge or a plain server), kept bounded withtail -n 200. Put the first occurrence next to the deploy history: an error that starts with a deploy usually came with it. - Read config, not env. After
php artisan optimizeorconfig:cache,env()outside config files returns null. Check the value the app sees withconfig('key'). Long-running workers keep the config they booted with. - Trace one request hop by hop: the edge, the web server's access log, the application log, the queue, each outside service. The fault sits after the last hop that saw it. Works on staging and not in production: list what differs and check each against the trace.
- The usual suspects: no worker or scheduler running for the environment,
failed_jobs, a job longer than the queue'sretry_after, a private storage URL where a public one belongs, alogmailer, a cache or a worker that survived the deploy. - Read-only by default. Never run a state-changing command in production (a migration, a queue restart or flush, a cache clear, an env edit, a write query, a deploy, a patch on the server) without the user's yes for that command, stated word for word with the environment it targets. Reads stay small: counts, a
limit, one record.
The fix goes through the repo with its harness: a patch on the server disappears with the next deploy.