Hunts deep bugs in an existing repo and fixes them with proof - maps stateful things, finds implicit state machines, raw writes, lost races and broken handoffs, reproduces each suspect, runs property tests, model checks and mutation testing, records every bug in a tracker, then fixes each one cause-first under a locked score. Use when the user wants to find bugs, audit a codebase, hunt state or race bugs, harden a repo, or types /ubench-bug-hunter.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ubench Bug Hunter?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/uditgoenka-ubench-bug-hunter)
---
name: ubench-bug-hunter
description: Hunts deep bugs in an existing repo and fixes them with proof - maps stateful things, finds implicit state machines, raw writes, lost races and broken handoffs, reproduces each suspect, runs property tests, model checks and mutation testing, records every bug in a tracker, then fixes each one cause-first under a locked score. Use when the user wants to find bugs, audit a codebase, hunt state or race bugs, harden a repo, or types /ubench-bug-hunter.
---
# ubench-bug-hunter
Find real bugs, prove each one, fix each one with proof. Each run has its own folder: `ubench-bug-hunter/NN-slug/`. `$S` below is this skill's `scripts` folder.
## Rules for the whole run
- **A suspect is not a bug.** A bug has a reproduction someone else can run. Until then its status is `suspected`.
- **Read-only on real data.** Queries only. Never change, repair or delete live data in a hunt.
- **The tracker is the record.** Every suspect is a row in `bugs.csv`, written by `$S/tracker.py`. No bug lives only in chat.
- **Cause before fix.** No edit until the six cause answers in [fix.md](references/fix.md) are concrete.
- **Inline first.** No step needs a sub-agent. Use one only for wide, separate areas, when the host has one.
- **Lean.** Open a reference when its step starts. Narrow queries, small result limits, failures only.
## Phase 1: Scope and map
First run `python3 $S/star.py check`. If it prints something, show it to the user once. Run `python3 $S/star.py yes` only after their yes; after a no, or after showing the link, run `python3 $S/star.py asked`.
1. `python3 $S/climb.py list` first: an open hunt is resumed. Else `python3 $S/tracker.py new hunt SLUG` makes the folder, `Tasks.md` and `bugs.csv`. Add one row per phase.
2. **Depth pass.** Answer the four questions in [deep-thinking.md](references/deep-thinking.md): what a top bug hunter would do here, and the rawest sources (stored data, logs, the write paths, version history), not summaries.
3. **Map.** List every stateful thing, every writer of each state field, every job, queue, timer and outside call. Note the style and the borders ([architecture.md](references/architecture.md)).
4. **Scope.** Rank areas by harm: money, sends, data loss, access. Write the order in `Tasks.md`.
## Phase 2: Hunt
Work the ranked areas with [hunt-methods.md](references/hunt-methods.md) and the traps in [field-lessons.md](references/field-lessons.md). Record each suspect at once: `python3 $S/tracker.py bug bugs.csv area=.. origin=.. issue=..`.
1. **Implicit state machines.** Follow [state-hunt.md](references/state-hunt.md): rebuild each machine from the code as a table per [state-machines.md](references/state-machines.md), run `python3 $S/machine.py check`, and treat every hole, raw write and state with no exit as a suspect.
2. **Races and retries.** Two actors, a second click, a retried job, a crash in the middle. Look for the lost race nobody handles.
3. **Handoffs.** Every place where two stores or two systems must agree: database and queue, cache and source, us and a provider.
4. **Real data.** Read-only counts of combinations the rules say cannot exist.
5. **Tests that lie.** Zero-case runs, loose matchers, checks that pass in shadow but were never run in enforce.
6. **Known holes.** `python3 $S/scan.py security .`, then judge each finding per [safety.md](references/safety.md). Screens: `python3 $S/ui.py react .` and `python3 $S/ui.py slop .` per [ui-audit.md](references/ui-audit.md).
## Phase 3: Reproduce
For each suspect, smallest first: write a failing test or a script that shows it, at the level a user would meet it. Then `python3 $S/tracker.py bugset bugs.csv ID status=reproduced how_reproduced="CMD"`. `CMD` exits 0 only when the bug is gone. A suspect you could not reproduce after an honest try becomes `rejected`, with what you tried in `how_reproduced`.
Every reproduction joins one locked score ([score-keeper.md](references/score-keeper.md)). Commit the first, then (`RUN` is the run folder path from the repo root) `python3 $S/climb.py init hunt --goal "..." --check "python3 $S/tracker.py repro RUN/bugs.csv" --score "failing: (\d+)" --ran "ran: (\d+)" --lock TEST`. Each later one: `python3 $S/climb.py relock hunt --why "found ID" --lock TEST`.
## Phase 4: Deep checks
Per [formal-checks.md](references/formal-checks.md), on the ranked areas:
1. A property test per machine and per rule with a shape: random event sequences against the table.
2. A model check with `npx everystate` for each flow with two actors, a retry or a crash. Start from `python3 $S/machine.py tla`. The model of the code as built must fail when a guard is removed.
3. Mutation on the owner functions and the riskiest files. Each survivor is a missing test.
Each counterexample and survivor goes to Phase 3 as a suspect, and its test joins the score through `climb.py relock`. Install a missing tool without a question ([formal-checks.md](references/formal-checks.md), Missing tools).
## Phase 5: Fix
Ask once which reproduced bugs to fix now. For each, follow [fix.md](references/fix.md):
1. Answer the six cause questions. Pick the route: quick, standard or deep.
2. Fix the cause where every caller passes through.
3. `python3 $S/climb.py try hunt "ID: idea"` keeps the fix only when the count of failing reproductions drops.
4. Run the side-effect sweep. State fixes go through the owner function, and tests run in enforce.
5. `tracker.py bugset bugs.csv ID status=fixed fix_commit=.. fix_verified=".." prevention=".." climb=hunt`. It refuses while the reproduction still fails.
A fix that needs new design goes to ubench-build with the bug row as its brief.
## Phase 6: Record and loop
1. Repeat Phases 2 to 4 on the next area. Stop after a full round with no new reproducible bug, or when the scope is done.
2. `python3 $S/tracker.py bugs bugs.csv`, `python3 $S/tracker.py status Tasks.md` and `python3 $S/climb.py status hunt`. `PROVEN` means every reproduced bug is fixed. `NOT PROVEN` is the count of known bugs still open: report it, never call the repo clean.
3. Write `handoff.md` in the run folder: bugs by status, each with its reproduction and proof, areas not covered, checks not run, and the prevention rule each fix added.
4. Report only what a command printed in this run.