flaky-test-fixer
Installation
SKILL.md
Flaky Test Fixer
Overview
A flaky test has a cause that can be found: timing, shared state, order, environment or randomness. Reproduce the flake reliably, identify which of those it is, and fix the cause. Retries and longer timeouts hide the problem; they do not fix it.
Method
- Reproduce the flake. Run the test many times, alone and with the full suite:
- Jest/Vitest: run in a loop, or
--runInBandvs parallel. - pytest:
pytest -x --count=50(pytest-repeat) and random order with pytest-randomly. - Playwright:
npx playwright test <file> --repeat-each=20 --workers=4. - JUnit:
@RepeatedTest(50)on the test, or run the suite in a shell loop. Record the failure rate and the exact error.
- Jest/Vitest: run in a loop, or
- Classify using the table below. Compare passing and failing runs: logs, timing, order, environment.
- Confirm the cause with a deliberate change that makes it fail every time (shuffle order, add a delay, slow the network, change the time zone).
- Fix the cause, then rerun the loop until there are zero failures across many runs.
- Remove any retries, sleeps or skips added as workarounds.