debugging
БесплатноБез исполняемых скриптовНе проверенSystematic debugging and error recovery for Laravel and PHP projects — a five-step triage that goes reproduce, localise, reduce, fix, guard. Covers reading a…
от nasrulhazim★ 26 звёзд на GitHubОб этом скилле
Debugging and Error Recovery
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 Reference
| 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 |
When to Use
- Something throws, returns the wrong value, or silently does nothing
- A test is flaky — passes alone, fails in the suite, or fails one run in ten
- Behaviour differs between local, staging and production
- A regression appeared and nobody knows which change caused it
- An exception's message and its actual cause do not match
- A queued job, scheduled command or event listener never runs
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.
The Five-Step Triage
Never skip a step. Steps 1 and 2 are where the answer actually is; steps 3–5 are mechanical.
Step 1: Reproduce
You have not started debugging until the failure happens on demand.
- Get the exact input: the request payload, the user, the tenant, the record ID, the time
- Reproduce it in the cheapest environment that still fails — a Pest test beats
tinker,tinkerbeats clicking through the UI - If it only fails in production, capture the difference:
php artisan about, the.envkeys that differ, the queue/cache drivers, the PHP version, the data volume
php 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.
Step 2: Localise
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
Step 3: Reduce
Cut the reproducer down until every remaining line is load-bearing.
- Strip middleware, then auth, then the HTTP layer entirely — does the service still fail?
- Replace the database record with a hand-built model instance
- Replace the real dependency with a stub returning the exact value
When you can no longer delete a line without the failure disappearing, the remaining lines are the bug.
Step 4: Fix — at the root
| 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.
Step 5: Guard
A fix without a failing-then-passing test is not finished.
- Write the test first, watch it fail with the original bug present
- Apply the fix, watch it pass
- Revert the fix once, confirm the test fails again — this proves the test guards the bug and not something incidental
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.
Companion: graphify
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
Установить debugging в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл debugging?
Systematic debugging and error recovery for Laravel and PHP projects — a five-step triage that goes reproduce, localise, reduce, fix, guard. Covers reading a stack trace properly, bisecting with git, isolating a failure to the smallest reproducer, telling a symptom apart from a root cause, and closing every fix with a regression test. Includes Laravel-specific traps: N+1 masked as a timeout, queue jobs failing silently on the wrong connection, cache and config caches serving stale values, Livewire state desync, and eloquent/model events firing in unexpected order. Use this skill whenever the user reports something broken, failing, flaky, slow-then-erroring, or behaving differently in production than locally — including "this test is flaky", "why is this failing", "debug this error", "it works locally but not on staging", "find the root cause", "this exception makes no sense", "the queue job never runs", "bisect this regression", "kenapa error ni", "tolong debug", "test ni kejap pass kejap fail", "cari punca sebenar", "jalan kat local tapi tak jalan kat production", or "job queue tak jalan". Pairs with kickoff-pest-testing for the regression test and log-monitor for production-log-driven investigations.
Как установить скилл debugging?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл debugging запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic