Flaky test hunter: rerun tests N times and find the unstable ones

Reruns a test command N times, records pass/fail, timings and output of every run, and reports tests that both passed and failed, with failure rates and likely causes.

ClaudeHermes AgentCodexCursorMIT (modify, redistribute and use commercially)Python

What it does

Finds flaky tests from recorded evidence instead of guesses.

  • Runs the given test command N times and saves each run's exit code, duration and output (log files)
  • Aggregates per-test results from pytest, jest, vitest, mocha, go test, unittest, cargo test and TAP output
  • Reports tests that both passed and failed as flaky, and tests that failed every time as always failing, with failing run numbers and failure rates
  • Shows min, median and max run time and records timed-out runs
  • Includes a reference of common causes (order dependence, time, randomness, network, async, parallelism) and how to confirm them

How to use

python scripts/flaky_hunter.py --runs 20 -- pytest -rA -q tests/test_api.py
python scripts/flaky_hunter.py --runs 20 --timeout 120 --shell "npx jest --verbose --runInBand"

Results go to flaky-report/report.md, results.json and logs/. The agent reads the failing logs and the test code, then reports likely causes and fixes.

Requirements

  • Python 3 (standard library only)
  • An environment that can run the project's tests

Caveats

  • The command is executed N times as given; run suites that touch databases or external services in a test environment.
  • Per-test results need a reporter that prints one line per test (-rA, --verbose, -v). Unrecognized output still gives run-level results and logs.
  • No failure in N runs does not prove a test is not flaky.

How to install

  1. Unzip the downloaded file (it contains a flaky-test-hunter/ folder with SKILL.md).
  2. Copy the whole folder into your agent's skills folder.
    • Claude: ~/.claude/skills/ (per project: .claude/skills/)
    • Hermes Agent: ~/.hermes/skills/
    • Codex: ~/.agents/skills/ / Cursor: ~/.cursor/skills/
    • Claude app (claude.ai): upload the ZIP in Customize → Skills
  3. Restart the agent and check that the skill appears in its skill list.

Step-by-step install for Windows / Mac and each agent

Seller

AI Skill Market (official)

44 published skills

Seller profile and all skills