Debugging
Rust debugging toolbox — reproducing, localizing, and explaining a bug (minimal repro, git bisect / cargo bisect-rustc, dbg!/tracing/RUST_BACKTRACE, Miri/loom for heisenbugs, rust-gdb/rr). Use for any Rust bug, panic, test failure, crash, or flaky behavior. Triggers: bisect, cargo bisect-rustc, heisenbug, RUST_BACKTRACE, loom, rr, why is this failing.From its SKILL.md
npx -y skills add gurinderu/craft --skill debuggingAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.2 KB, as published. Nobody here has run it
Debugging (Rust)
The Rust-specific toolbox for reproducing, localizing, and explaining a Rust bug. Full detail in techniques.md.
Read the error first
The single highest-yield habit: read the whole error message and stack trace before doing
anything. Rust's errors (and RUST_BACKTRACE=1 / =full) are unusually precise — they usually
name the file, line, and often the cause. Don't pattern-match the first word and jump.
The 3-strike rule: stop fixing, question the design
If the same error survives three honest attempts, the bug is one level up from where you're patching. Count the strikes — it's what stops you thrashing at attempt seven.
| Strike | What it suggests | Move |
|---|---|---|
| 1 | maybe a slip | apply the obvious local fix |
| 2 | maybe the wrong method | try a different approach, same layer |
| 3 | the approach itself is wrong | escalate — question the design, not the line |
Escalating means handing the problem to the skill that owns that design decision:
E0382/E0597still failing after clone/borrow churn → the ownership model is wrong →rust-ownership- a
Result/unwrapyou keep re-shaping → the error strategy is wrong →rust-errors - "cannot be sent between threads" you keep bound-chasing → the concurrency design →
rust-concurrency - a panic that should have been unreachable → the type should forbid the state →
rust-traits
Rust toolbox (→ techniques.md)
- Shrink the repro — delta-debug the input; a failing
proptest/quickcheckhands you a minimal counterexample (→rust-testing). - Bisect —
git bisect run <cmd>for the offending commit;cargo bisect-rustcfor a toolchain regression. - Instrument — escalate
dbg!→eprintln!→tracing::debug!(?x)→assert!;RUST_BACKTRACE=1for the panic path. Removedbg!/eprintln!before committing; keeptracing(→rust-cloud-native). - Heisenbugs — non-determinism is shared state / ordering / timing: run under Miri (data
races — the
rust-miriagent) orloom;cargo nextest's process isolation surfaces test-order leaks; inject the clock withtokio::time::pause(→rust-concurrency). - Heavy tools —
rust-gdb/rust-lldb, andrrfor deterministic record/replay of rare failures.
Boundaries
- Full technique detail → techniques.md.
- Confirming the fix — the Rust "what proves what" commands →
rust-review. - A panic-where-a-
Result-belonged / error-design issue →rust-errors. - Intermittent / ordering / data-race bugs →
rust-concurrency(and Miri via therust-miriagent). - "Slow", not "wrong" →
rust-performance(profile, don't guess). - Symptom-patching (e.g.
unwrap_or_default()to hide aNone) is a finding in →rust-review.