flaky-test-finderlisted
Install: claude install-skill Contexory/skills
# Flaky test finder
Flakiness is an empirical claim, and it is the one kind of test problem where reasoning
from the source is actively misleading. A test that looks obviously order-dependent may be
solid; a test that looks pure may fail one run in forty on a loaded machine.
So this skill measures first and reads second.
## Procedure
### 1. Measure the rate
`<skill-dir>` is the directory this SKILL.md was loaded from — the skill installs outside
your project, so its script is named by full path, never relatively.
```
bash <skill-dir>/scripts/rerun.sh "pnpm vitest run path/to/file.test.ts" 30
```
Runs the command N times, reports pass/fail per run, the observed failure rate, and a
Wilson confidence interval for the true rate. **The interval is the point**: three failures
in ten runs and three in a hundred are very different findings, and a bare percentage hides
which one you have.
If the failure rate is 0 over a decent number of runs, say so plainly — "not reproduced in
N runs" is a real result. Do not go on to diagnose a flake you could not observe.
### 2. Split ordering from isolation
The two commonest causes look identical from the failure message. Distinguish them:
- Run the single test **alone**, many times. Failing alone means it is not
order-dependent — look at timing, environment and external state.
- Run the whole file, then the whole suite. If it only fails in the larger set, it is
**shared state or ordering** — something before it leaves a mutation be