flaky-test-detector
Skill0 starsChanged 45 days agoMITView on GitHub
Runs a test command N times and classifies it STABLE-PASS, STABLE-FAIL (a real bug, not flake) or FLAKY, with a per-run table. Use when: "is this test flaky", "does it pass reliably", "run it N times", "why does this fail intermittently".
3 other projects use a version of this.
Adopted by
Most recently taken up by
- dotnet/fsharptheir own version, first seen Oct 8, 2026
- Maxrall-Inc/nexrall-skillstheir own version, first seen Aug 19, 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
- Maxrall-Inc/nexrall-skills★ 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 repository34 other files it gives its agents.
- audit-codeSkill
- audit-docsSkill
- auditSkill
- bisect-driverSkill
- coding-conventionsSkill
- commit-gateSkill
- compact-ioSkill
- cron-task-manageSkill
- cve-auditSkill
- data-integrity-auditSkill
- decision-logSkill
- deck-builderSkill
- determinism-guardSkill
- etl-validateSkill
- experiment-logSkill
- fetch-firstSkill
- github-repo-polishSkill
- golden-lockSkill
- history-leak-scanSkill
- landing-checkSkill
- llm-eval-harnessSkill
- local-secrets-manageSkill
- long-taskSkill
- milestone-trackSkill
- opus-workersSkill
- path-quirk-auditSkill
- reorg-proposalSkill
- research-briefSkill
- seed-controlSkill
- shell-portabilitySkill
- skill-vetSkill
- small-taskSkill
- token-squeezeSkill
- venue-fitSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
1
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 55
Distinguish red-from-flaky before you debug: if the verdict is STABLE-FAIL, stop looking for a race — the test fails the same way every …
- Very specific: line 65
Do NOT drive a subject with node -e "<quoted code>" on this machine — PS 5.1 mangles quoted -e and leaves 0-byte junk files.
“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 — run N times, classify stability
The engine is flaky-detect.js (portable Node, zero deps). It runs a test
command a fixed number of times, records each run's exit code and duration, and
returns one verdict:
- STABLE-PASS — every run exited 0. Exit
0. - STABLE-FAIL — every run failed with the same nonzero exit every time.
This is a consistently red test: a bug, not flake. Exit
1, labeled so you don't chase a phantom race. - FLAKY — exit codes varied across runs (including nonzero codes that differ,
e.g.
1then2). Non-deterministic; do not trust it as a gate. Exit1.
The harness itself is deterministic — same loop, same capture, every time. Any variation in the verdict comes from the subject, which is exactly what you are trying to measure.
Commands
node flaky-detect.js --cmd "<test command>" [--times N] [--keep-logs <dir>]
node flaky-detect.js --canary
node flaky-detect.js --help- --cmd (required) — the test command, run through the shell in the current working directory.
- --times N — run count (default 5, minimum 2). More runs raise confidence that an intermittent failure is caught.
- --keep-logs
<dir>— save each run's stdout+stderr torun-01.log,run-02.log, … Diff two runs to see what actually differed between a pass and a fail.
Examples
- Confirm a regression test is genuinely deterministic (frozen tests
are pinned byte-exact — they must never flake):
node flaky-detect.js --cmd "python -m pytest tests/test_frozen_regression.py" --times 10A FLAKY verdict here means the "frozen" guarantee is a lie; a STABLE-PASS is the evidence the pin holds. - Chase an intermittent backend test (FastAPI/Postgres — async
ordering and DB state are classic flake sources):
node flaky-detect.js --cmd "pytest tests/test_signup.py::test_guardian_email -q" --times 8 --keep-logs flake-logsthen diffflake-logs/run-03.logagainst a passing run to isolate the non-determinism. - Distinguish red-from-flaky before you debug: if the verdict is STABLE-FAIL, stop looking for a race — the test fails the same way every time, so fix the test or the code. Only FLAKY warrants a hunt for shared state, timing, or ordering.
Windows notes
- PowerShell 5.1: wrap the whole
--cmdvalue in double quotes:node flaky-detect.js --cmd "python -m pytest -q" --times 8. - Git Bash: single quotes work too:
--cmd 'pytest -q'. - Do NOT drive a subject with
node -e "<quoted code>"on this machine — PS 5.1 mangles quoted-eand leaves 0-byte junk files. Point--cmdat a real script or test runner instead. - Duration is wall-clock (ms) and will jitter on a busy machine — it is a diagnostic signal, not part of the verdict. Only exit codes decide the class.
Storage
Nothing is written unless you pass --keep-logs <dir>, which creates the dir and
writes one run-NN.log per run (numbered, zero-padded to at least two digits:
run-01.log, run-02.log, …) plus a meta.txt holding each run's exit code and
duration. Each run-NN.log contains the subject's stdout+stderr only — no
timing header — so diff run-01.log run-02.log shows only real subject deltas,
never the harness's own wall-clock jitter. The tool is otherwise read-only toward
the world — it only launches the command you give it.
Exit codes
0 STABLE-PASS · 1 FLAKY or STABLE-FAIL · 2 usage error (missing --cmd,
--times < 2).
Verification (the done-check)
node flaky-detect.js --canarySelf-tests both directions in a throwaway temp dir: an alternating pass/fail
subject (a script that flips its exit code via a state file) is caught as FLAKY
at 4 runs, an always-pass subject stays quiet as STABLE-PASS, an always-fail
subject is labeled STABLE-FAIL, --keep-logs writes one file per run, and the
usage guards reject bad input. MUST print CANARY PASS 15/15 before you trust a
verdict.
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.

