agentleFS
chatquillchatquill/claude-code-websites/.claude/skills/test-flakiness/SKILL.md

test-flakiness

Skill1 starsChanged 24 days agoMITView on GitHub

Finds and fixes flaky tests: reruns suspects to measure flake rate, diagnoses causes (timing, shared state, order dependence, network, clocks, animations) and proposes root-cause fixes. Use when CI fails intermittently or a test passes on retry.

11 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Test config (retries, parallelism, timeouts)

    line 18
  2. Very specific:

    Use the trace (npx playwright show-trace) for e2e failures.

    line 43
  3. Very specific:

    If it cannot be fixed now: quarantine only with the user's approval, a TODO(owner, date) comment and a tech-debt entry (/tech-debt add).

    line 50

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Flakiness

A flaky test is a bug in the test or in the product. It is never fixed by deleting it, skipping it silently, or bumping a timeout without a reason.

Inputs

  • The suspect test(s), or CI history the user pastes
  • Test config (retries, parallelism, timeouts)
  • Playwright traces in test-results/ if present

Phases

Phase 1: Measure

Rerun the suspect N times in isolation and in the full suite, e.g. npx playwright test <file> --repeat-each=20, npx vitest run <file> in a loop, pytest -p no:randomly <file> vs pytest -p randomly, go test -count=20 -race. Report the failure rate alone vs in the suite (suite-only failures point to shared state).

Phase 2: Diagnose

test-engineer checks the usual causes:

SymptomLikely causeFix
Passes alone, fails in suiteshared DB rows, global mocks, module stateper-test data, reset mocks, isolate workers
Fails on slow CIfixed sleeps, racing async UIweb-first assertions, wait for network idle / response
Fails near midnight/month endreal clockfake timers / fixed Date
Random order failuresorder dependencemake each test self-sufficient
Animation/screenshot diffstransitions, fontsdisable animations, wait for fonts
External callsreal networkmock at the boundary

Use the trace (npx playwright show-trace) for e2e failures.

Phase 3: Fix

Propose the root-cause fix with the evidence. Ask before editing. Rerun the measurement; it must reach 0 failures in the same number of runs.

If it cannot be fixed now: quarantine only with the user's approval, a TODO(owner, date) comment and a tech-debt entry (/tech-debt add).

Next step

Back to the work CI was blocking.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.