Flaky Test Hunter
Run the test suite N times on an interval, capture intermittent failures, isolate flakes, and open a fix PR.
by Trooper
/loop 1d Start the "Flaky Test Hunter" loop. Goal: identified flaky tests are fixed or quarantined with a PR open Max iterations: 20 Between iterations run: npm test -- --repeat-each=5 2>&1 | tee /tmp/flake-run.log Exit when: no flaky failures in the last N-run batch or fix PR is open Step 1: Run tests N times, capture flakes, isolate root cause, and open a fix PR. ## Before you start Connect plugins: - GitHub (required) — Read branches, PRs, reviews, checks, workflow runs, and source diffs. Attach skills: - Loop runner (required) — Self-pace iterations, run the check between passes, and stop only on the exit condition. - Code change + local verification (optional) — Edit code safely, run commands, and keep changes scoped. - CI debugging (optional) — Read failing checks, logs, and the smallest actionable root cause. - Test repair (optional) — Run tests, triage failures, and avoid weakening the suite. Self-pace this loop. After each iteration, run the check command, read the output, and only continue if the exit condition is not met. Stop when the exit condition passes or max iterations is reached. Give a short status update each pass.
Paste the kickoff prompt into Cursor, Claude Code, or Codex. Deeplinks do not install hook files.
1. Run N times
Execute the suite repeatedly to surface intermittent failures.
2. Capture flakes
Log failing specs, seeds, and stack traces from inconsistent runs.
3. Isolate and fix
Reproduce the flake, patch root cause, and open a fix PR.
Guardrails
Rules the agent must follow so it cannot cheat the exit condition.
- Do not delete tests without evidence they are truly obsolete
- Quarantine flakes only with a linked fix issue
- Log seed, timing, and environment for each flake
More Testing loops
Test Until Green
Run your test suite, fix the smallest root cause on failure, and repeat until every test passes.
E2E Until Green
Run Playwright or Cypress end-to-end tests with annotated failure screenshots, fix root causes, and loop until the suite is green.
CI Failure Watcher
Poll CI on an interval, investigate failures when checks go red, and push fixes until green.
