amey-thakur/ai-skills/heisenbugs
Claude Code and agent skill by amey-thakur/ai-skills
- community
Checking that the SKILL.md file is still in the repository.
Catch timing-dependent bugs that vanish under observation by amplifying the race and moving logging off the critical path. Use when a fault appears intermittently and disappears the moment you add a print or attach a debugger.
Install
npx vskill@latest install amey-thakur/ai-skills/heisenbugsSKILL.md
The same SKILL.md was published earlier as amey-thakur/ai-skills/heisenbugs.
Heisenbugs
A heisenbug changes behavior the instant you try to watch it: the print that would reveal it also delays the thread just enough to hide the race. These faults are timing-dependent, and the naive tools perturb the very timing that causes them. The move is to stop fighting the clock and start bending it: make the race wider and your observation lighter.
Method
- Confirm it is timing, not input. Run the identical input a hundred times
in a loop. Failing some fraction of runs with the same input points to a race or ordering bug, not a data bug. Record the failure rate as your baseline.
- Amplify the race instead of shrinking it. Inject small
sleepor yield
calls inside the suspect window, or run under heavy thread count and CPU contention. Widening the gap turns a one-in-a-thousand fault into one you can trigger on demand.
- Displace logging off the hot path. Do not print inside the critical
section: append timestamped records to an in-memory ring buffer and dump it after the failure. Observation that hits disk or console rewrites the timing you are trying to measure.
- Timestamp with a monotonic clock and thread id. Log
perf_counter_ns
and the thread or task id per event, then sort after the run. The interleaving you reconstruct, not the source order, shows who raced whom.
- Force the losing schedule deterministically. Once you suspect an
ordering, pin it with a latch, a barrier, or an injected pause that makes the bad interleaving happen every time. A race you can schedule is a race you can fix and regression-test.
- Reach for a race detector. Run ThreadSanitizer (
-fsanitize=thread),
Go's -race, or Helgrind. They flag unsynchronized shared access directly, without relying on the timing lottery to expose it.
- Prove the fix under amplification. Keep the sleeps and contention from
step two, then run thousands of iterations. A single green run means nothing here: only sustained passing under stress counts as fixed.
Signals
- Does the same input fail intermittently, ruling out a data cause?
- Did added contention raise the failure rate, confirming a timing window?
- Does the fix survive thousands of amplified runs, not one clean pass?
Boundaries
Amplification and scheduling stress live threads: bugs rooted in memory corruption or flaky hardware need different tools. Once you can trigger the race on demand, hand reduction to reproduction-first and isolation to binary-search-debugging.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/debugging/heisenbugs/SKILL.md
Popularity
- Repository stars
- 10
- Repository forks
- 2
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/amey-thakur/ai-skills/heisenbugs)