agentleFS
educlopezeduclopez/mallard/skills/diagnose-bug/SKILL.md

diagnose-bug

Skill5 starsChanged 16 days agoMITView on GitHub

Diagnose a hard bug or regression with a repeatable feedback loop before touching the fix. Use when the user says "diagnostica", "depura esto", "por qué falla", "error 500", "no funciona", or when `/task` classifies a task as `bug`. Works on PrestaShop, Laravel and other PHP or JS projects.

9 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use to-spec.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GoogleSkill

    to-spec

    Turn the current conversation into a spec and publish it to the project issue tracker — no interview, just synthesis of what you've already discussed.

    Also in 3 projects that use this

The file

Files
SKILL.md

diagnose-bug

Adapted from Matt Pocock's diagnosing-bugs. It finds the cause and the fix. It does not commit, deploy or write to the tracker.

1. Pick the environment

Work locally: Lando for PrestaShop (lando-check, ps-console), Sail, Herd or php artisan serve for Laravel. PRE and PROD are read-only: look at logs and config, and ask before running anything there. Never add instrumentation to PRE or PROD without the user's OK. Replace secrets and customer data in anything you print with <REDACTED>.

2. Build the feedback loop

One command that is deterministic, fast and turns red for this bug. Pick the cheapest that works:

StackLoop
Laravelfailing Pest/PHPUnit test, php artisan tinker script, php artisan <command>, curl on the local route, php artisan pail for the log
PrestaShopscript run through ps-console, curl on the local URL, var/logs, PrestaShopLogger
Front endverify-ps-project or the browser tools

Done when the loop fails for the reported reason three times in a row. If you cannot build one, stop and tell the user what is missing: data, access, steps.

3. Reproduce and shrink

Cut the input until removing anything more makes the bug disappear. Done when you can state the minimal trigger in one sentence.

4. Write 3 to 5 hypotheses

Falsifiable, ranked by likelihood, each with the check that kills it. Show the list to the user before testing the first one.

5. Test one hypothesis at a time

One change, one loop run. Tag every debug line [DEBUG-<4 chars>] (error_log, Log::debug, dump). Done when exactly one hypothesis survives.

6. Fix with a regression test

If the project has a runner (Pest, PHPUnit) and a place to hook the test, write the test first and watch it fail, then fix. If not, say that as a finding and do not invent a test harness. Done when the loop is green and the neighbouring tests still pass.

7. Clean up

grep -rn "DEBUG-<tag>" . returns nothing and scratch files are gone. Give the root cause in one line for the MR body and save it to engram when it is non-obvious.

Next: blast-radius if the fix touches shared code, then task-review.

It does not commit, push or touch PRE and PROD without the user's OK.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.