Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

debugging-workflow

БесплатноБез исполняемых скриптовНе проверен

Find the cause of a defect by hypothesis and bisection rather than by guessing, then fix it behind a regression test. Use when the user reports a bug, a…

personamanagmentlayerот personamanagmentlayer★ 46 звёзд на GitHub

Об этом скилле

Debugging Workflow

Debugging is a search over hypotheses, not an inspection of code. The fastest route to a cause is a sequence of experiments that each halve the space of possible explanations.

When to Use This Skill

  • A defect has been reported and the cause is unknown
  • A test fails intermittently
  • Behaviour differs between environments
  • A performance or memory regression appeared
  • Something worked before and does not now
  • The user asks "why does this happen?" about running code

If the cause is already known, skip this and fix it. This procedure is for the case where you do not yet know.

Core Concepts

Reproduce Before Reading

Until you can make the failure happen on demand, you cannot tell a fix from a coincidence. A reliable reproduction is the single highest-value artefact in debugging, and it is worth spending real time on. Everything after it is faster.

Hypothesis, Prediction, Experiment

Each step states a hypothesis, predicts an observable consequence, and runs the cheapest experiment that would refute it. Refutation is the goal: a test that can only confirm teaches nothing.

Hypothesis: the cache returns a stale tenant after a failover. Prediction: the returned object's tenant_id differs from the request's. Experiment: log both at the cache boundary for one request.

Bisection

Halve the search space rather than walking it. Bisect over commits (git bisect), over input (shrink the failing payload), over the stack (which layer still sees correct data), or over configuration (which flag flips it).

Cause, Not Symptom

The first explanation that makes the symptom disappear is usually not the cause. Keep asking what produced the state you found, until the answer is a decision someone made rather than a value that was wrong.

The Workflow

1. Capture the report precisely

What was expected, what happened, and the exact context: version, environment, input, timestamp, user. Vague reports cost more than they save. Get the trace or correlation id if there is one.

2. Reproduce

Start from the reported conditions and simplify until it is deterministic and fast.

# Pin the version the report came from
git checkout v4.11.2

# Reproduce, capturing everything
LOG_LEVEL=debug pytest -q tests/test_invoices.py::test_eu_vat -x --tb=long 2>&1 | tee /tmp/repro.log

If it will not reproduce, the difference between your environment and the reported one is the bug's habitat: data, timezone, locale, concurrency, clock, cache state, feature flag. Enumerate those differences and vary them one at a time.

3. Turn the reproduction into a failing test

Before diagnosing, encode the failure as a test. It becomes the regression test later, and it removes any ambiguity about whether the fix worked.

def test_eu_vat_applied_to_reverse_charge_invoice():
    invoice = build_invoice(country="DE", vat_id="DE811907980", net=Decimal("100"))
    assert invoice.vat == Decimal("0")     # currently 19.00

4. Read the evidence you already have

Before adding instrumentation, use what exists. Read the stack trace properly: the top frame is where it surfaced, not necessarily where it originated. Scan outward for the first frame in your own code.

grep -n "correlation_id=7f3a" /var/log/app/*.log | head -50
git log --oneline -20 -- src/billing/vat.py
git log -S "reverse_charge" --oneline          # when did this string appear?

5. Bisect

Over history, when it used to work:

git bisect start
git bisect bad HEAD
git bisect good v4.9.0
git bisect run pytest -q tests/test_invoices.py::test_eu_vat
git bisect reset

git bisect run with a scripted check is worth the setup: it is exact and it does not get bored.

Over input, when a large payload fails: delete half, re-run, keep the half that still fails. Repeat until removing anything makes it pass. The residue is the trigger.

Over the stack, when the data is wrong: assert the invariant at the boundary between layers. The first boundary where it does not hold contains the defect.

6. Instrument at the boundary you suspect

Add temporary, high-signal output — not a scatter of prints.

logger.debug(
    "vat.decision country=%s vat_id=%r reverse_charge=%s rate=%s",
    country, vat_id, is_reverse_charge, rate,
)

Log the inputs to the decision and the decision, not the internals in between. Remove this instrumentation before committing, or promote it to a permanent structured log if it earned its place.

7. Confirm the cause by control

You have the cause when you can turn the failure on and off at will. Change the suspected input, see the symptom appear and disappear. Without this step you have a correlation.

8. Fix, then verify the test flips

Run the test from step 3: it must fail before the fix and pass after. If it passed before the fix, it was not testing the defect.

9. Widen once

Ask where else this cause applies. A rounding err

Полный SKILL.md на GitHub

Установить debugging-workflow в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Bash(npm:*, npx:*, pnpm:*, yarn:*, pytest:*, python:*, python3:*, go:*, cargo:*, git:*, docker:*)
Grep
Glob

Вложенные файлы

references/PRODUCTION.mdreferences/TOOLKIT.md

FAQ

Что делает скилл debugging-workflow?

Find the cause of a defect by hypothesis and bisection rather than by guessing, then fix it behind a regression test. Use when the user reports a bug, a crash, a test that fails intermittently, a performance regression or a production incident, asks why code behaves unexpectedly, or when the task involves reproducing a failure, isolating a root cause, git bisect, flaky tests, or reading a stack trace.

Как установить скилл debugging-workflow?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл debugging-workflow запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить debugging-workflow с