/claude-toolkit:debuggingfrom claude-toolkit
Systematic five-step triage for debugging Laravel/PHP projects: reproduce, localise, reduce, fix, guard. Covers stack trace reading, git bisect, isolating root cause from symptom, and adding regression tests. Handles Laravel-specific traps like N+1, queue failures, stale caches, and Livewire state desync.
Ships in claude-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A bug report names a symptom. Your job is the cause. The gap between them is where most wasted debugging time lives — patching the path the ticket names, while every sibling caller stays broken.
| Command | Description |
|---|---|
/debug triage | Run the five-step triage on a reported failure |
/debug reproduce | Build the smallest reliable reproducer |
/debug bisect | Find the commit that introduced a regression |
/debug flaky | Diagnose a test that passes and fails without code changes |
/debug guard | Write the regression test that locks the fix in |
Do not use this skill to add features, refactor, or "clean up while I'm in here". A debug session ends when the bug is fixed and guarded, not when the file looks nicer.
Never skip a step. Steps 1 and 2 are where the answer actually is; steps 3–5 are mechanical.
You have not started debugging until the failure happens on demand.
tinker,
tinker beats clicking through the UIphp artisan about, the .env
keys that differ, the queue/cache drivers, the PHP version, the data volumephp artisan tinker --execute="dd(App\Models\Order::find(1234)->total());"
If you cannot reproduce it, say so plainly and stop. A fix for a bug you never saw fail is a guess wearing a diff.
Read the stack trace from the bottom up — the deepest frame in your code is the suspect, not the framework frame that finally threw.
# What actually changed?
git log --oneline -20 -- app/Services/BillingService.php
git blame -L 40,60 app/Services/BillingService.php
Every caller, not just the reported one:
grep -rn "calculateTotal" app/ tests/
If four callers route through one function, the bug is probably in the function. One guard there is a smaller diff than four guards in the callers — and it fixes the three nobody reported yet.
Bisect when the trace is not enough:
git bisect start
git bisect bad HEAD
git bisect good <last-known-good-tag>
git bisect run ./vendor/bin/pest --filter=OrderTotalTest
git bisect reset
Cut the reproducer down until every remaining line is load-bearing.
When you can no longer delete a line without the failure disappearing, the remaining lines are the bug.
| Symptom fix | Root fix |
|---|---|
if ($x === null) return; in the controller | Why is $x null? Fix the source or make the type honest |
try { … } catch (\Throwable) {} | Handle the specific exception, or let it throw |
->where('deleted_at', null) added at the call site | Model is missing SoftDeletes |
| Retry the job three more times | The job is not idempotent |
sleep(1) before the assertion | The test is racing a queued job — use Queue::fake() |
State what the root cause is in one sentence before you edit. If you cannot, you are still in step 2.
A fix without a failing-then-passing test is not finished.
it('does not double-charge when the webhook is replayed', function () {
$order = Order::factory()->paid()->create();
handleWebhook($order, $payload);
handleWebhook($order, $payload); // replay
expect($order->fresh()->charges)->toHaveCount(1);
});
Use the kickoff-pest-testing skill for the test's shape, factories and assertions.
graphify builds a persistent, queryable knowledge graph of a codebase — tree-sitter AST
parsing for code plus semantic extraction for docs. It answers structural questions far faster
than grepping, and it is installed by default with this toolkit.
Use it before a manual sweep whenever the question is structural.
graphify extract . # build (or refresh) the graph — once per repo
graphify query "how does authentication work"
graphify path UserController InvoiceRepository # call chain between two nodes
graphify explain app/Services/BillingService.php
If graphify-out/ already exists in the target repo, treat the question as a graph query
first and fall back to file reading only for what the graph cannot answer. If graphify is
not installed, carry on with the normal file-reading approach — it is an accelerator, never a
prerequisite.
These account for most of the "the code looks correct" hours in a Laravel codebase.
| Symptom | Actual cause |
|---|---|
| Endpoint times out under real data, fine with seeded data | N+1 — missing eager load. DB::listen() and count the queries |
| Config change has no effect | config:cache is stale. php artisan config:clear |
| Job dispatched, never runs, no error | Dispatched on a connection Horizon is not watching. Check ->onConnection() vs config/horizon.php |
| Job runs old code after deploy | queue:restart was not run — workers hold the old class in memory |
| Scheduled command never fires | Cron is not running, or is running on more than one host |
| Test passes alone, fails in the suite | Shared state — a static, a cached config, a seeded row, or a real queue instead of Queue::fake() |
| Livewire property reverts after an action | Not in $rules/not #[Reactive], or being reset by a re-render |
| Model event does not fire | Model::withoutEvents(), mass update() on the query builder, or insert() bypassing Eloquent |
| Policy allows something it should not | Gate::before superadmin short-circuit running before your policy |
| Works as admin, fails as user | Missing permission, not a code bug — check spatie/laravel-permission roles first |
| Wrong tenant's data appears | A query missed the global scope, or the scope was removed by withoutGlobalScopes() |
A flaky test is a real bug about 70% of the time — usually an ordering or shared-state bug
that production will eventually hit too. Do not ->skip() it.
./vendor/bin/pest --filter=OrderTest # alone
./vendor/bin/pest # in the suite
./vendor/bin/pest --order-by=random --repeat=10
| Flake cause | Fix |
|---|---|
| Test order dependence | RefreshDatabase, and stop leaking static/singleton state |
| Time | Carbon::setTestNow() — never assert on now() |
| Randomness | Seed the faker, or assert on shape rather than value |
| Real queue / real HTTP | Queue::fake(), Http::fake(), Mail::fake() |
| Auto-increment ID assumptions | Assert on the model, not on id === 1 |
| Rationalization | Reality |
|---|---|
| "I'll just add a null check" | A null check where the null is unexpected hides the bug and moves the crash later, into a place with less context. |
| "It's probably a caching issue" | "Probably" means you skipped step 1. Clear the cache, reproduce again, and find out. |
| "I can't reproduce it, but I know what's wrong" | Then you can reproduce it. If your theory is right, you can write the failing test that proves it. |
| "The test is just flaky" | A flaky test is a race, a shared-state leak, or a time assumption — all three are production bugs waiting for traffic. |
| "It works now, I don't know what fixed it" | Something you changed fixed it, or nothing did and it will return. Revert your changes one at a time until it breaks again. |
| "Wrapping it in try/catch stops the error" | It stops the message. The broken state carries on silently and surfaces somewhere less debuggable. |
| "Only one user reported it" | One report of a data-corruption bug is the same severity as a thousand. Count the blast radius, not the reporters. |
| "I'll add the regression test later" | The moment you have a reliable reproducer is the cheapest the test will ever be. Later, you would have to rebuild it from scratch. |
| "Let me refactor this while I'm here" | Now the diff contains a fix and a refactor, and if it breaks nobody knows which half did it. |
catch (\Throwable $e) {} — an empty catch, or one that only logs and continuessleep() or --retry added to make a test pass->skip() or ->markTestIncomplete() added during a bug fixdd(), dump(), ray(), var_dump() or Log::debug('here') left in the diffBefore calling a bug fixed:
dd, dump, ray, Log::debug) remains in the diff| File | Read When |
|---|---|
references/triage-playbook.md | Working a live failure step by step — the questions to ask at each stage |
references/laravel-debug-tools.md | Choosing an instrument — DB::listen, Telescope, Pulse, Xdebug, bisect, tinker |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nasrulhazim/claude --plugin claude-toolkit43 skills in this plugin
/business-cardSVG business card designer that takes contact details and brand preferences, then produces 12 front design concepts with optional back designs, interactive HTML preview galleries, individual card showcases with front/back flip animation, and print-ready SVG exports with bleed area and crop marks. Supports horizontal and vertical orientations, six layout styles (minimal, corporate, creative, elegant, bold, tech), multiple color schemes, QR code placeholders, social media icons, and logo integration. Use this skill whenever the user asks to design a business card, create a name card, make visiting cards, or says "design business card", "buat kad bisnes", "create name card", "reka kad perniagaan", "design kad nama", "I need a business card for X".
/ci-cd-pipelineCI/CD pipeline builder for Laravel projects — extends Kickoff's existing GitHub Actions CI with continuous deployment pipelines (staging/production), Docker containerisation, secret management, and failure notifications. Generates Dockerfiles, docker-compose.yml, deployment configs for VPS via SSH, container registry push workflows, and leverages Kickoff's /bin scripts (deploy.sh, backup.sh, setup.sh) in automated workflows. Use this skill whenever the user asks to set up deployment pipelines, containerise a Laravel app, configure CD for staging or production, push Docker images to a registry, manage deployment secrets, add failure notifications to CI, or integrate /bin scripts with GitHub Actions. Triggers for requests like "set up CD pipeline", "deploy to staging automatically", "dockerise my Laravel app", "add Docker to my project", "push image to registry", "manage secrets in CI", "notify on failure", "extend CI with deployment", "setup deploy pipeline", "nak deploy guna GitHub Actions", "tambah Docker dalam project", "setup CD untuk staging", "nak auto deploy ke production", "dockerise Laravel app aku", "tambah notification kalau CI fail", "macam mana nak manage secrets dalam GitHub Actions", or "integrate bin scripts dengan CI". Assumes Laravel Kickoff as the baseline — GitHub Actions CI (Pint, PHPStan, Rector, Pest) and /bin scripts (deploy.sh, backup.sh) are already configured. This skill extends that baseline with CD, Docker, and deployment automation.
Other plugins' skills for the same job