← ClaudeAtlas

flaky-test-detectivelisted

Find and fix flaky (non-deterministic) tests — the ones that pass and fail on the same code — by tracing the root cause and rewriting the test to be deterministic. Covers test-order dependence and shared mutable state, time / timezone / clock assumptions, unseeded randomness, async race conditions and sleep-based waits, real network / filesystem / database calls, assertions on unordered collections, global state leaked between tests, and too-tight timeouts. Explains exactly why the test is non-deterministic, then hands back a stable version. Use whenever a test fails intermittently, "passes on rerun", is order-dependent, is green locally but red in CI, or you're writing or reviewing tests in pytest, Jest/Vitest, RSpec/Minitest, Go, JUnit, PHPUnit, or any other framework.
windchillscalanthes-ship-it/flaky-test-detective · ★ 0 · Testing & QA · score 73
Install: claude install-skill windchillscalanthes-ship-it/flaky-test-detective
# Flaky Test Detective Catch the test that passes and fails on the *same code* — and rewrite it so it's deterministic, before it trains your team to ignore red builds. A flaky test is worse than no test. It fails once, someone reruns CI, it passes, and everyone learns that red doesn't mean broken. Soon a *real* regression sails through behind a "just rerun it." The cause is almost never the code under test — it's a hidden dependency on something the test doesn't control: the clock, the random seed, the order tests run in, a shared row in the database, a real network call, the iteration order of a map. This skill finds that hidden input, explains why it makes the test non-deterministic, and rewrites the test to control it. ## When to use this - A test **fails intermittently** — red on one run, green on the next, no code change. - A test is **green locally but red in CI** (or vice versa), or only fails under parallelism or a particular order. - Someone says *"just rerun it,"* *"it's flaky,"* or *"passes on retry."* - You are **writing or reviewing** a test and want to catch non-determinism before it's committed. - You want to **harden a suite** — find the latent flakiness before it fires. If a test fails **every** time, it's not flaky — it's a real failure or a genuine bug; fix the code, don't stabilize the test. And never "fix" flakiness by adding a retry or a `sleep` that hides it — that buries the signal. The goal is a test that's **deterministic**, not one that's *