Skip to content
Back to skills

Debug

ASecurity

Fixes a reported bug end to end - diagnose-bug reproduces it on the product and writes a one-part fix Change (its issue and plan part), a gate (policy.gates.design) approves the fix and syncs the issue, the fix gets its own branch, /bdk:execute builds it test-first (the reproduction test red, the fix, green, conform), and /bdk:auto-review reviews the fix Change; writes debug/result.md under .bdk/runs and resumes from the files. Use when the user reports a bug, an error message, a traceback, s...

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 26, 2026
developmentgobashgit

Works with

  • cli

Security analysis

A100/100

Scanned December 5, 2026

npx -y skills add broneq/bdk --skill debug --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Debug?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Debug
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/broneq-debug/badge)](https://www.skillsdirectory.com/skills/broneq-debug)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: debug
description: 'Fixes a reported bug end to end - diagnose-bug reproduces it on the product and writes a one-part fix Change (its issue and plan part), a gate (policy.gates.design) approves the fix and syncs the issue, the fix gets its own branch, /bdk:execute builds it test-first (the reproduction test red, the fix, green, conform), and /bdk:auto-review reviews the fix Change; writes debug/result.md under .bdk/runs and resumes from the files. Use when the user reports a bug, an error message, a traceback, steps to reproduce or unexpected behaviour and wants it fixed, or asks to debug something - also when the fix may turn out to be one line: a reported symptom is diagnosed and fixed with a test, not edited directly.'
argument-hint: "[<bug report> | <issue> | <change>]"
allowed-tools: Bash(${CLAUDE_PLUGIN_ROOT}/bin/bdk *) Bash(git status *) Bash(git symbolic-ref *) Bash(git rev-parse *) Bash(git branch *) Bash(git switch *) Bash(git log *) Read Write Edit Glob Grep Skill Agent SendMessage ToolSearch AskUserQuestion
---

Current BDK configuration of this project:

!`"${CLAUDE_PLUGIN_ROOT}/bin/bdk" config show`

Arguments: $ARGUMENTS

# Debug

Fix a reported bug the way any Change is built: reproduced and diagnosed first, then built test-first, then reviewed. You compose blocks and stages and apply the gate; you never do their work. Do not reproduce, read code for a cause, write or edit a test, code or the Change, write a commit message, or review anything yourself. The only files you write are `.bdk/runs/<change>/debug/gate.md`, `debug/gate-comment.md` and `debug/result.md`, and `issue.md` only to merge a body changed on the tracker (step 4). Run each command on its own, without `;`, `&&` or pipes.

The blocks and stages, each invoked with the Skill tool and followed to its end:

- **diagnose-bug** `<report> [--name <change>]`: reproduces the bug, finds the root cause, writes the fix Change (`issue.md` and `plan/parts/01.md` under `.bdk/runs/<change>/`, the issue created on the tracker when the report was not one) and `debug/diagnosis.md`.
- **execute** `<change>`: a `bdk:lead` builds the part (the reproduction test seen red, the fix, the test green, conform) and commits it; writes `execute/result.md`.
- **auto-review** `<change>`: review rounds of the fix Change, triage, fixes; writes `review/result.md`.

**A block's end is not the run's end.** `diagnose-bug` ends with its own reply, written for a user who ran it alone. Inside `/bdk:debug` that reply ends the block only: give it in a line or two at most, and go on with the next step in the same turn. Stop only where this skill says to stop.

`execute` and `auto-review` may start their lead in the background and end the turn; their result arrives as a notification. When it has arrived and the stage has replied, come back here and go on with the next step: the files say where you are.

Before each step, tell the user in one line what runs and what it writes, e.g. `Diagnosing: diagnose-bug writes .bdk/runs/fix-total-crash/debug/diagnosis.md`.

## 1. Check the configuration, the tree and the input

When the block above says `BDK not configured: run /bdk:setup` or that the configuration is invalid, stop: run nothing and reply with that line. Otherwise note `policy.gates.design` (`manual` when absent).

- **Input**: the argument, or the bug the user describes. When it names a directory `.bdk/runs/<name>/debug/` that exists, or a Change `fix-...` whose `debug/diagnosis.md` exists, this is a resumed run of that Change: go to step 2. Otherwise it is a bug report (text or an issue reference); a name the user gives the fix Change goes to `diagnose-bug` as `--name`. Without any report, ask what goes wrong and stop.
- **Tree**: for a new report, `git status --porcelain` must print nothing; the fix runs through `execute`, which needs a clean tree. Otherwise stop before anything runs: name the changed paths and ask the user to commit or stash them, then run `/bdk:debug` again.
- **Base**: `git symbolic-ref --short refs/remotes/origin/HEAD` without its `origin/` prefix; else `main`.

Done when you hold the report or the Change, the gate setting and the base.

## 2. Find where to start

`R` is `.bdk/runs/<change>/`. Take the first row that matches:

| # | Files | Start at |
|---|---|---|
| 1 | no `R/debug/diagnosis.md` | step 3 |
| 2 | `diagnosis.md` not `Status: ready` | step 3's outcome for that status |
| 3 | no `R/debug/gate.md` | step 4 |
| 4 | `git branch --show-current` prints the base or nothing | step 5 |
| 5 | no `R/execute/result.md`, or it is not `Status: done` | step 6 |
| 6 | no `R/review/result.md` | step 7 |
| 7 | otherwise | step 8 |

A step whose file exists never runs again. Done when you know the step.

## 3. Diagnose

Run **diagnose-bug** with the report (and `--name <change>` when given). It may ask the user for a missing symptom; then stop as well, and `/bdk:debug` continues once answered. When it has replied, read the first lines of `R/debug/diagnosis.md` (the Change is its `Change:` line, or the name `diagnose-bug` reported) in the same turn:

- `Status: ready`: step 4, without ending your turn.
- `Status: not-reproduced`: stop. Reply that the bug did not reproduce, what was run (`debug/reproduction.md`), and what would help; nothing was changed.
- `Status: too-large`: stop. Reply with the root cause and that the fix Change holds the issue's proposal, the reproduction scenario and the key decisions but needs the pipeline: `/bdk:design <change>`, then `/bdk:plan`, `/bdk:execute`, `/bdk:auto-review`.
- `Status: blocked` or no file: stop with its reason and `/bdk:debug <change>` to retry once the cause is known.

Done when the diagnosis is ready, or you stopped.

## 4. Gate

Read `R/debug/diagnosis.md` and the part `R/plan/parts/01.md` (its goal and tasks).

- `policy.gates.design: auto`: approve without asking.
- `manual`: ask with one `AskUserQuestion` call (load it with `ToolSearch` query `select:AskUserQuestion` when it is listed only by name), header `Fix gate`: fix `<change>` as diagnosed? Name the root cause, the reproduction scenario, the part's tasks, and each `Related:` line of the diagnosis as not fixed by this Change. Options: `Fix` (recommended) and `Stop` (the user says what to change in a note or in "Other").
  - Fix: approved.
  - Stop, or a change requested: write nothing, sync nothing; reply that the fix Change is left for review (`R/issue.md`, `R/plan/parts/01.md`) and that `/bdk:debug <change>` continues after the user's edits or approval. End your turn.
  - When `AskUserQuestion` is not available: ask in your reply, naming the same, and end your turn without the gate file. When the user approves in the conversation, write it then.

On approval write `R/debug/gate.md`:

```markdown
---
gate: approved
by: user
diagnosis: debug/diagnosis.md
---
```

The file is this frontmatter and nothing else; `bdk run status` reads it and stops on any other key. `by` is `user`, or `policy.gates.design auto`. Then write `R/debug/gate-comment.md` (`Fix approved by <by>.`, the root cause and the reproduction scenario's name) and put the approved spec on the issue:

`"${CLAUDE_PLUGIN_ROOT}/bin/bdk" tracker sync --run <change> --comment-file .bdk/runs/<change>/debug/gate-comment.md`

- `env/body-changed`: merge `R/issue.remote.md` into `R/issue.md` with Edit (keep the run's edits, take the tracker's other edits), and run the same command again.
- `env/tracker-not-github`: put the body and the comment on the issue as `tracker.instructions` of the configuration say.
- Any other error: quote it, and say that `/bdk:close` syncs the body later; go on.

Done when the gate file exists and the issue is synced, or you asked and ended your turn.

## 5. Put the Change on its branch

1. `git branch --show-current`. When it prints the base or nothing, run `git switch -c <change>`: the fix's commits never land on the base. When that branch exists already, stop and name it: `/bdk:debug` runs on the fix's own branch then. On any other branch, stay: the fix belongs to that branch.
2. `git status --porcelain` must print nothing; otherwise stop and name what is left, since `execute` needs a clean tree. The fix Change itself is under the ignored `.bdk/runs/`.

Done when you are on the fix's branch and the tree is clean.

## 6. Build the fix

Run **execute** with `<change>`. Then read the first line of `R/execute/result.md`:

- `Status: done`: step 7.
- `Status: blocked` or no file: go to step 8 with `Status: blocked` and the blockers as `execute` reported them, with `/bdk:execute <change>` (or `/bdk:debug <change>`) to continue. A plan defect in the part means the diagnosis was wrong: name `diagnose-bug` and the part.

Done when the part is built, or you have the blocker.

## 7. Review the fix

Run **auto-review** with `<change>`. When it stops for triage (manual review gate) without a `R/review/result.md`, stop as well: `/bdk:debug <change>` continues once the findings are decided. Otherwise go to step 8.

Done when `R/review/result.md` exists, or you stopped for triage.

## 8. Write the result

Write `R/debug/result.md`, replacing an earlier one, from the files (Read and Grep, not from memory):

```markdown
Status: done

## Bug
- Report: tally total crashes after tally add 5
- Reproduction: debug/reproduction.md (tools.e2e cli)
- Root cause: bin/tally.js:15 `add` stores the text, so `total` sums strings

## Fix
- Test: Scenario: Total after an add -> test/tally.test.js; red seen; green seen
- Changed files: bin/tally.js, test/tally.test.js
- Commits: 3f2c1a0 fix(tally): store parsed amounts

## Review
- Status: done
- Rounds: 1 (0 findings)

## Blockers
- None.

## Decisions taken without the user
- Gate: policy.gates.design auto.
```

- `Status: done` only when `execute/result.md` and `review/result.md` both read `Status: done`; else `Status: blocked`.
- `## Bug`: after `Root cause:`, one `- Related (not fixed): <text>` line per `Related:` line of `debug/diagnosis.md`, none when it has none.
- `## Fix`: the `## Acceptance tests` lines and `## Changed files` of `R/execute/part-01.md`; the commits from `git log --oneline <base>..HEAD`.
- `## Review`: the first line of `review/result.md` and its `## Rounds` lines.
- `## Blockers`: each with the command that continues it.
- `## Decisions taken without the user`: the auto gate, and the lines under that heading in the part report, the execute result and the review result.
- An empty section holds `- None.`

Done when the result exists and its first line is the status.

## 9. Reply

Reply with the status line, the result path, the root cause in one line, each related defect as not fixed, the reproduction test and whether it was seen red then green, and the review outcome. On `Status: done` name the next step `/bdk:close <change>`, which checks the product against the issue, opens the pull request and closes the issue; on `Status: blocked` each blocker with its command. Never say the bug is fixed while the part or the review is blocked.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.