Skip to content
Back to skills

Flaky Tests

ASecurity

Find flaky tests from a CI run log. Use whenever a task gives an input.json with a "runs" array of {commit, test, outcome} records (pass/fail) and asks for flaky-tests.csv, flaky test detection, or a flakiness report per commit. Works by hand, no scripts needed.

  • 24 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 6, 2026
developmentgoapi

Works with

  • api

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill flaky-tests --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flaky Tests?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Flaky Tests
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-flaky-tests-1aad2f58/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-flaky-tests-1aad2f58)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: flaky-tests
description: Find flaky tests from a CI run log. Use whenever a task gives an input.json with a "runs" array of {commit, test, outcome} records (pass/fail) and asks for flaky-tests.csv, flaky test detection, or a flakiness report per commit. Works by hand, no scripts needed.
---

# Flaky test report

Input: `input.json` in the working folder, `{"runs": [{"commit", "test", "outcome"}, ...]}`.
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". A test that only fails (or only passes) on a commit is not flaky there; consistent failure is a real break, not flakiness.
- **flaky_commits** = number of distinct commits on which the test is flaky.
- **failures** = total count of "fail" runs of that test across ALL commits, including commits where it was not flaky. (Example: a test flaky on commit A with 1 fail, and failing consistently on commit B, has failures = 2.)
- A test appears in the output only if flaky_commits >= 1.

## Procedure (do it by hand, carefully)

1. Read input.json. Ignore run order; it does not matter.
2. Build a tally per (test, commit): number of passes and number of fails. Go through the runs one at a time and keep a written list so none are missed. Treat commit and test names as exact strings.
3. For each test: count commits where passes>=1 and fails>=1 (flaky_commits), and sum fails over all its commits (failures).
4. Drop tests with flaky_commits = 0.
5. Sort rows by failures descending; ties broken by test name ascending (plain alphabetical, case-sensitive). Do NOT sort by flaky_commits.
6. Write flaky-tests.csv.

## Output format

- First line exactly: `test,flaky_commits,failures`
- One line per flaky test: `name,flaky_commits,failures`, no quotes, no spaces, integers.
- Newline after each line, including the last. 
- If no test is flaky, the file contains only the header line.

## Check against example

Runs: commit X: api pass, api fail, ui fail, ui pass, db fail; commit Y: db pass, ui fail, api pass.
- api: flaky on X only; fails = 1 → `api,1,1`
- ui: flaky on X; fails on X and Y = 2 → `ui,1,2`
- db: never mixed in a commit → excluded.
Sorted by failures desc: `ui,1,2` then `api,1,1`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.