/sharper-skills:debugging-by-constraintsfrom sharper-skills
Evidence-first debugging for production bugs and PR review findings. Use when a bug or performance regression shows up in production telemetry, a user bug report, or a reviewer's or review bot's PR comment, starts after a deploy or version change, has no fast local repro, or sits in code the agent did not write. Use it before you offer fix options.
Ships in sharper-skills. 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.
Code is an unreliable narrator: it says what can happen, not what did happen. Start from what did happen.
The work sits on two tiers:
C3: incidents.ts:480 groups rows with groupByIdKeepAll). Code says only what can happen, so a code fact can explain a mechanism but never serves as the strongest signal.Each fact is a constraint. The job is to find the one hypothesis (a single cause, or a combination where every cause is needed) that fits every fact. Keep the facts fat and the hypotheses thin.
<REDACTED> in place of every secret in commands, outputs and artifacts you show. Quote only the lines that carry the signal.Read the bug report in full. Turn everything in it into numbered facts: first bad and last good version, config, flags, symptoms, attached profiles and logs.
If the report has repro steps, run them now and record the signal they produce.
List every change in the window between last good and first bad, across every repo, folder and team that touches the path: commits, deploys, config, flag flips, dependency bumps. A change by another team is still a fact.
Run every query and command yourself. LAYERS.md names the MCP server or CLI that reaches each layer 1 source. The store file, which /debug-retro writes, lists the sources, signals and decisions that past sessions in this project found; when it exists, read it first with the block below, run as written. When no tool reaches a fact, write a throwaway script to gather or count it, and name the script as the fact's source. A screenshot, a pasted number or a dashboard reading is a lead, not a fact: re-gather it from its source with the exact query and time window, and record that as the fact. The user is a source of last resort: before you ask them to run, open or check anything, try it yourself once and show the attempt; then ask only for data no tool reaches, and name the exact command, file, host and time window you need.
key=$(git remote get-url origin 2>/dev/null | sed -E 's#^[a-z+]+://##; s#^[^@/]*@##; s#:[0-9]+/#/#; s#:#/#; s#\.git$##; s#/$##; s#\.\.#_#g' | tr 'A-Z' 'a-z')
[ -n "$key" ] || key=$(git rev-parse --path-format=absolute --git-common-dir 2>/dev/null | sed 's#/\.git$##')
[ -n "$key" ] || key=$(pwd -P)
store="$HOME/.sharper-skills/${key#/}"
cat "$store/debug-layers.md" 2>/dev/null || echo "No store file yet."
Read code to explain the bug only after this, and only to explain facts you hold. Read it at the version that ran when the bug occurred, the first bad version from the report, and name that commit in each code fact; HEAD is a different program. Reading code to start the app or build a repro (schema, seed data, config) is setup, and you can do it at any step.
Done when a numbered fact list exists and every fact names its source: the tool and query, the file, or the report line.
The variable is the broken case. The control is a case equal to it except for the suspected difference: flag off, last good version, a healthy host, an unaffected user. When no good version exists because the bug is older than the report, pick the control inside the same version: a record, user or request that does not show the bug.
Done when every fact is tagged signal or noise, the one difference between control and variable is written down, and a fresh subagent given REVIEWER.md items 1 to 3, the fact list and the control has found no signal that also sits in the control, no way the control is broken the same way, and no fact without its host, time window and tool.
List the plausible hypotheses. Then draw the hypotheses-by-fact matrix: one row per hypothesis, one column per fact (signals and noise), and in each cell ✓ fits, ✗ contradicts, or ? unknown.
F1 p99 up F2 DNS answers 5 → 400 F3 handshake same in both
H1 cert reload per RPC ✓ ✗ ✓
H2 client skips sharding ✓ ✓ ✓
H3 server CPU throttled ✓ ✗ ✓
Done when exactly one row is ✓ in every cell, with no ?, a strong signal points at it, and a fresh subagent given REVIEWER.md items 4 and 5 and the matrix has agreed on which signals are weak and found no tactic you skipped before a new hypothesis or a layer descent.
Done when:
## Decisions in the store file covers the call, quote it next to your recommendation and wait for the user.Done when the strongest signal, gathered again after the fix ships, is gone. When nothing can make it show on demand, give the user the exact query and time window that will show it, and say the check is still open.
Give the fact list, the matrix, the winning row and its strongest signal. End with: "Run /debug-retro to turn each time you stepped in into a rule."
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub rajnandan1/sharper-skills --plugin sharper-skills8 skills in this plugin
/debug-retroRuns only when the user asks for /debug-retro by name. After a debug session, count each time you had to step in and turn each one into a lasting rule. /debug-retro/deeperRuns only when the user asks for /deeper by name. Rewrite a task to ask for the deeper version, not the bigger one. /deeper <task>, or /deeper alone to deepen your last request./defendRuns only when the user asks for /defend by name. Turn a session's decisions, or a code change, into an HTML report with questions at the bottom. You answer in your own words, and the agent grades. /defend, or /defend <PR, branch, commit range or topic>./higherRuns only when the user asks for /higher by name. Rewrite a task to ask for the goal beyond the goal. /higher <task>, or /higher alone for your last request./leonardoRuns only when the user asks for /leonardo by name. Do open-ended work, such as a name, a concept, copy or a design, by making many candidates apart, picking them blind against the plain answer, and redrafting the best. /leonardo <task>, or /leonardo alone for your last request./signal-first-planSignal-first planning before you build a feature. Lists every exit the feature's data leaves through, puts a countable signal on each, and checks the signals against main. Use when the user asks to build, add or change behaviour that ships to users or other systems. Skip it for questions, explanations, bug hunts, refactors with no behaviour change, and copy or style edits.