Find flaky tests in CI run data. Use whenever the user has an input.json with a "runs" array of {commit, test, outcome} records and wants flaky-tests.csv (columns test,flaky_commits,failures), or asks which tests are flaky, unstable, or intermittently failing across repeated runs per commit. Works by hand, with no scripts.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Flaky Tests?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-flaky-tests-ada20219)
---
name: flaky-tests
description: Find flaky tests in CI run data. Use whenever the user has an input.json with a "runs" array of {commit, test, outcome} records and wants flaky-tests.csv (columns test,flaky_commits,failures), or asks which tests are flaky, unstable, or intermittently failing across repeated runs per commit. Works by hand, with no scripts.
---
# Flaky test report
Input: `input.json` with `runs`: array of `{commit, test, outcome}` (outcome is "pass" or "fail"). Output: `flaky-tests.csv` in the same folder as `input.json`.
## Definitions
- A test is **flaky on a commit** if, among that commit's runs of that test, there is at least one "pass" AND at least one "fail". Judge each (commit, test) pair separately. Runs are grouped by commit hash, regardless of where they appear in the array (they may be interleaved).
- A test that only fails (or only passes) on a commit is not flaky there. Consistent failure is a broken test, not a flaky one.
- A test is **reported** if it is flaky on at least one commit. Tests never flaky are omitted entirely.
## Columns
- `test`: the test name.
- `flaky_commits`: number of distinct commits on which the test is flaky.
- `failures`: total number of "fail" runs of that test across ALL commits and all runs, including commits where it was not flaky (e.g. a commit where it failed every time still counts). Count each fail record once.
## Procedure
1. Read `input.json`.
2. For each distinct test name, make a tally per commit: number of passes and number of fails. Write this out in your notes by walking the array once, record by record, so no record is skipped.
3. For each test, flaky_commits = commits with passes>0 and fails>0; failures = sum of fails over every commit.
4. Keep only tests with flaky_commits >= 1.
5. Sort rows by `failures` descending; break ties by `test` name ascending (plain alphabetical, case-sensitive character order). Do not sort by flaky_commits and do not use input order.
6. Write `flaky-tests.csv` beside `input.json`: header line `test,flaky_commits,failures`, then one row per test, comma-separated, no spaces, no quotes (unless a name contains a comma or quote), newline-separated. If no test is flaky, write only the header line.
## Check against an example
Test `ui_render`: commit A has pass+fail (flaky), commit B has only fail. flaky_commits=1, failures=2. Test `api_login`: flaky on A with one fail, passes on B: 1,1. `db_migrate` fails on A only and passes on B with no mixing: omitted. Order: ui_render (2 fails) before api_login (1 fail). Where failures tie, alphabetical: queue_drain before zip_export.
Before writing, re-verify the counts of any test with many records by recounting its fails directly from the array.