Skip to content
Back to skills

Bug Fixer Hard Cases

ASecurity

Used by the Bug Fixer agent - playbooks for bugs the normal reproduce-trace-test path does not crack - production-only failures, data-dependent bugs, heisenbugs, performance regressions, memory leaks, dependency upgrade breakage, and failures that are not in the code at all. Use when debugging one of these and the standard method has stalled.

  • 12 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentsgoshelldebuggingdatabaseperformance

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add MhdAljuboori/ZumiBot --skill bug-fixer-hard-cases --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bug Fixer Hard Cases?

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

Security grade badge for Bug Fixer Hard Cases
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mhdaljuboori-bug-fixer-hard-cases/badge)](https://www.skillsdirectory.com/skills/mhdaljuboori-bug-fixer-hard-cases)

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: bug-fixer-hard-cases
description: Used by the Bug Fixer agent - playbooks for bugs the normal reproduce-trace-test path does not crack - production-only failures, data-dependent bugs, heisenbugs, performance regressions, memory leaks, dependency upgrade breakage, and failures that are not in the code at all. Use when debugging one of these and the standard method has stalled.
---

# Hard cases

Each section gives the first move, the tools, and what counts as proof. The core rules still hold: evidence before fixes, one hypothesis at a time, and say how sure you are (**proven / likely / unknown**).

## Production-only (cannot reproduce locally)
**First move.** Build a timeline. When did it start? Line it up against deploys, feature flag changes, config changes, data migrations, traffic spikes and dependency or infrastructure changes. The start time usually names the suspect.

**Tools.**
- Logs, traces and the error tracker: group by error, then by version, host, region, user type. Find the first occurrence, not the most frequent.
- Correlate by request or trace ID across services to see the whole path of one failing request.
- Compare a failing and a succeeding request field by field: input, headers, user, data, host, version.
- If the data is not there, write targeted instrumentation the user can ship: a log line with the exact values at the suspect boundary, a metric, a sampled trace. Small, safe, no secrets or personal data, easy to remove.

**Mitigate first when users are hurting.** Recommend the quickest safe stop: revert the deploy, turn the flag off, pin the dependency, scale up. Label it a mitigation, not a fix. You never deploy, revert or flip flags yourself; the user decides.

**Proof.** A local repro built from the production evidence is best. Otherwise: the cause explains every observation in the timeline and the data, and is stated as **likely**, not proven, with the instrumentation that would confirm it.

## Data-dependent (only some records fail)
**First move.** Find the exact failing record, row, file or input, and the closest one that works. Diff them field by field: nulls, encoding, unicode, length, dates, time zones, legacy formats, duplicates, orphans.

**Tools.** Read-only queries (never `UPDATE`/`DELETE`), a copy of the record into a local fixture with personal data masked, the code path that reads it.

**Fix.** Fix the code so it handles that shape (or rejects it clearly at the boundary). Report the bad data that already exists: how to find it (a read-only query) and what is wrong with it. Never repair, migrate or delete data yourself; the user decides.

**Proof.** A regression test using the masked record shape fails before and passes after.

## Heisenbug (vanishes when observed)
**First move.** Assume timing. Logging, debuggers and slower builds change thread interleaving, garbage collection and optimisation.

**Tools.**
- Cheaper observation: in-memory counters or a ring buffer dumped only on failure, instead of printing.
- Race detectors and sanitizers: `go test -race`, ThreadSanitizer, AddressSanitizer, UndefinedBehaviorSanitizer, Valgrind, the language's own equivalents.
- Record and replay debuggers where available, so one failing run can be studied as often as needed.
- For hangs: thread or goroutine dumps (`jstack`, `py-spy dump`, `kill -QUIT` for Go, `gdb` attach) taken several times, compared for the threads that do not move. Look for lock order and waits on something that never comes.
- Release vs debug builds, optimisation levels, different CPU counts.

**Proof.** The sanitizer or race detector report gone after the fix, plus a test that forces the bad interleaving (latches, controlled schedulers, fakes) and fails before, passes after.

## Performance regression
**First move.** Measure before you touch anything. A fixed workload, a warmed-up process, several runs, and the median plus spread. A difference smaller than the run-to-run noise is not a finding.

**Tools.**
- A profiler for the stack (CPU sampling profiler, flame graph, database `EXPLAIN`/query plans, browser performance panel). Profile; do not guess the hot spot.
- Common causes: N+1 queries, a missing index, an accidental O(n²) loop, a lost cache, extra serialisation, synchronous I/O in a hot path, a chatty network call.
- Bisect with a threshold: the check script calls a commit bad when the benchmark exceeds a limit set between the good and bad numbers.

**Proof.** The same benchmark, before and after, several runs each, with the numbers and spread. "Feels faster" is not proof.

## Memory leak
**First move.** Show the growth. Run the suspect operation N times and record memory (or handles, connections, listeners) after each batch. Steady growth that does not come back after garbage collection is a leak; a plateau is a cache.

**Tools.** Two heap snapshots, one after warm-up and one after many more iterations, diffed by object count and size. Follow the retainer path of the growing objects to the root that holds them: a global map, a cache with no limit, an event listener never removed, a closure capturing something large, a timer never cleared.

**Proof.** The growth curve over N iterations is flat after the fix, shown with the numbers. A test that counts listeners or objects after N iterations is a good regression guard.

## Dependency or upgrade breakage
**First move.** Diff the lock file between the last working state and now. Find every package that changed, including transitive ones.

**Tools.**
- The changelog and release notes of each changed package, and its issue tracker for the error text.
- Bisect the version range: install versions between good and bad (with the user's OK) to find the exact release.
- Check for duplicate copies of one package at different versions, peer dependency mismatches, and a fresh install vs a cached one.

**Fix.** Pinning the old version is a mitigation. Adapting the code to the new behaviour is the fix. Say which one you did. Never install or upgrade without the user's OK.

**Proof.** A test that exercises the changed behaviour, passing on the new version.

## Not the code
When the code looks right and still fails, check the ground under it:
- **Stale build or cache:** rebuild clean; clear build output, compiler and test caches, the bundler cache, the browser cache, a stale service worker. Is the code you read the code that runs?
- **Wrong environment:** wrong branch, wrong runtime version, wrong config file, an env var set in one shell and not another, a different database.
- **The test itself is wrong:** it asserts the wrong expectation, depends on order or the clock, or tests a mock. Confirm what the correct behaviour is before you "fix" the code to match a wrong test.
- **Tooling:** a linter or formatter rewriting files, a pre-commit hook, a file watcher racing the build.

**Proof.** The one environmental change that makes the failure appear and disappear on demand.

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 ai-agents →

Comments

Loading comments…

Newsletter

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