flaky-test-detector
Skill0 starsChanged 3 months agoMITView on GitHub
Diagnose tests that pass and fail non-deterministically, instead of blaming the code under test or "fixing" the test. Use when a test fails sometimes but not others, when the user says a test is "flaky", "unstable", "passes locally but fails in CI", or when the same test gives different results on repeated runs.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Evan-Daruwalla/claude-skill-suitetheir own version, first seen Oct 20, 2026
- dotnet/fsharptheir own version, first seen Oct 8, 2026
- kimhons/Ralph-Loop-Ultratheir own version, first seen Jan 30, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- dotnet/fsharp★ 4.3ksame name
- kimhons/Ralph-Loop-Ultra★ 1same name
- Evan-Daruwalla/claude-skill-suite★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- agent-verificationSkill
- claim-evidenceSkill
- crypto-news-digestSkill
- defi-risk-assessmentSkill
- evidence-firstSkill
- on-chain-analystSkill
- prompt-injection-hardeningSkill
- refactor-verifierSkill
- skill-security-auditSkill
- smart-contract-reviewSkill
- test-integrity-guardSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Run the failing test in isolation, several times, and record the outcomes.
- Distinctive: line 67
Do not change the assertion to something looser just to make it green.
- Very specific: line 68
Do not skip the test (it.skip, .only on another, pytest.mark.skip).
- Distinctive: line 69
Do not delete the test. A flaky test still guards something.
- Distinctive: line 81
If you genuinely cannot reproduce the flake after several isolated runs, say so and report what you ran — do not invent a cause.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flaky Test Detector
A test that fails intermittently is worse than a test that always fails: it erodes trust in the whole suite, and the natural instinct — "tweak it until it passes" — usually hides a real race, a shared-state bug, or a broken assumption. This skill diagnoses why a test is flaky before anything is changed.
First: prove it is flaky before touching anything
Run the failing test in isolation, several times, and record the outcomes. A single failure is not flakiness — it may be a genuine bug that only manifests on a particular input.
for i in 1 2 3 4 5; do <run-just-this-test>; echo "exit=$?"; done- Fails every time → not flaky; treat it as a real bug (use the test-integrity-guard skill instead of loosening it).
- Passes/fails inconsistently → flaky; continue below.
The three causes, in order of likelihood
1. Shared state between tests
The most common cause. Tests that mutate a shared store, cache, database, or in-process singleton leak into each other. Evidence to look for:
- The test passes in isolation but fails when the whole file/suite runs.
- Two tests write to the same fixture, temp file, or module-level variable.
- An eviction/cache keyed by insertion order (LRU) that a "touched" entry doesn't refresh — the test count looks wrong because entries weren't evicted in the order assumed.
Fix the isolation, not the assertion: give each test its own fixture/DB/
temp dir, or reset shared state in a beforeEach/afterEach.
2. Timing or ordering assumptions
- The test waits a fixed
sleepinstead of an event/condition. - It assumes async work finishes by the time the next line runs.
- Two tests race on the same resource and the winner varies.
Fix by waiting on a condition or sequencing explicitly — not by lengthening the sleep (that only lowers the failure rate, it doesn't remove it).
3. Environment nondeterminism
- Iteration order of a hash map / object keys that isn't guaranteed.
- Reliance on locale, timezone, clock, or filesystem
readdirorder. - A value derived from a real network/clock that changes between runs.
Fix by pinning the source of nondeterminism (sort before asserting, inject a fixed clock, freeze the map order).
What NOT to do
- Do not change the assertion to something looser just to make it green.
- Do not skip the test (
it.skip,.onlyon another,pytest.mark.skip). - Do not delete the test. A flaky test still guards something; silencing it removes the guard.
Output format
Diagnosis: shared state | timing | environment
Evidence: <the specific line or behavior that proves it>
Root cause: <one sentence>
Fix: <change to isolation/sequencing/determinism — not to the assertion>If you genuinely cannot reproduce the flake after several isolated runs, say so and report what you ran — do not invent a cause.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

