Skip to content
Back to skills

Flaky Tests

ASecurity

Use this skill when the user wants to find which tests are flaky from CI results where the same suite ran several times per commit, e.g. an input.json with runs of {commit, test, outcome}, and have a flaky-tests.csv report written. Not for diagnosing why a single test fails or for fixing tests.

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

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-f58cc8e1/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-flaky-tests-f58cc8e1)

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: "Use this skill when the user wants to find which tests are flaky from CI results where the same suite ran several times per commit, e.g. an input.json with runs of {commit, test, outcome}, and have a flaky-tests.csv report written. Not for diagnosing why a single test fails or for fixing tests."
---

# Flaky test report

A test is flaky on a commit if, on that same commit, it has at least one `pass` run and at least one `fail` run. Produce a CSV ranking flaky tests.

## Inputs
- `input.json` in the working folder: `{"runs": [{"commit": "...", "test": "...", "outcome": "pass"|"fail"}, ...]}`.
- If the file is missing or has no `runs` array, stop and tell the user. Do not invent data.

## Steps
1. Read `input.json`. Run order does not matter.
2. Group runs by (test, commit). Match commit and test strings exactly (case-sensitive, no trimming of meaning). Do not merge different commits.
3. For each test, compute:
   - `flaky_commits` = number of commits where that test has >=1 pass AND >=1 fail.
   - `failures` = total number of `fail` runs of that test across ALL commits, including commits where it was not flaky.
4. Keep only tests with `flaky_commits >= 1`. Tests that always fail, always pass, or fail on one commit and pass on another (never both on the same commit) are excluded.
5. Sort rows by `failures` descending, then by `test` name ascending (plain code-point order). `flaky_commits` is not a sort key.
6. Write `flaky-tests.csv` beside `input.json`.

## Output format
- First line exactly `test,flaky_commits,failures`.
- One line per flaky test: `name,flaky_commits,failures` with integers, no spaces, no quotes (quote a name only if it contains a comma or quote, per CSV rules).
- LF line endings, trailing newline after the last row.
- If no test is flaky, write only the header line.
- Outcomes other than `pass`/`fail`: ignore those runs and mention it in your reply.

## Tips for accuracy
- Tally per test by hand: list each commit with its pass count and fail count, then apply the rules. Re-check the counts before writing.
- Counts of runs per commit can be uneven; that is fine.

## Worked example
Runs: c1 `a` fail, c1 `a` pass, c1 `b` fail, c2 `a` fail, c2 `b` pass.
- `a`: c1 has both -> flaky; c2 fail only. flaky_commits=1, failures=2.
- `b`: c1 fail only, c2 pass only -> never flaky, excluded.

```csv
test,flaky_commits,failures
a,1,2
```

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.