agentleFS
magia187magia187/premium-agent-skills/skills/flaky-test-triage/SKILL.md

flaky-test-triage

Skill0 starsChanged 2 months agoMITView on GitHub

Use when a test fails intermittently or only on CI. Decide quarantine vs fix, then stabilize with determinism (fake clocks, isolation, retries at the right layer) — never by sprinkling sleeps.

5 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use accessibility-audit.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • GitHubSkill

    accessibility-audit

    Audits actual components and routes against applicable WCAG 2.2 A/AA criteria using consumer-owned design-system evidence and repository tools. Use when asked for an accessibility audit, a11y check, keyboard or focus review, contrast check, or screen-reader verification.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Do not disable large swaths of the suite or delete tests without confirmation.

    line 27
  2. Very specific:

    Do not merge with --no-verify to bypass red CI without explicit approval.

    line 28

“Common” is measured: kept by at least 6 in 10 of the 5 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

Flaky Test Triage

When to use

  • A test fails sometimes locally or on CI and passes on retry.
  • CI is red due to known intermittent failures blocking merges.
  • The user asks to "fix the flake", "quarantine", or "stabilize CI".

When not to use

  • Deterministic failures that reproduce every run (use repro-first).
  • Production incidents unrelated to the test suite (use incident-hotfix).
  • Rewriting the entire test framework as the first response.

Assumptions

  • Access to CI logs, test runner, and ability to re-run targeted tests.
  • Quarantine mechanisms may exist (skip annotations, quarantine lists, issue links).
  • Do not disable large swaths of the suite or delete tests without confirmation.
  • Do not merge with --no-verify to bypass red CI without explicit approval.

Workflow

  1. Confirm flakiness: fail rate, environments, and whether order/parallelism matters.
  2. Decide: fix now (default if bisectable) vs quarantine with a tracked issue (if blocking many engineers).
  3. Root-cause toward non-determinism: time, randomness, shared state, network, ordering.
  4. Fix with fakes/isolation/idempotent setup — not sleep.
  5. Prove stability with repeated runs; remove quarantine when green.

Steps

  1. Characterize — Capture failing assertion, seed, CI node, and whether --repeat / reruns flake.
  2. Isolate — Run the single test file repeatedly; try serial vs parallel to detect crosstalk.
  3. Decide — Fix-now if cause is clear within a tight time box; else quarantine one test with owner + issue, not the whole file unless confirmed.
  4. Determinism toolkit — Fake timers/clocks; seed RNGs; unique temp dirs; wait on conditions/events, not fixed sleeps; mock network; reset DB/fixtures per test.
  5. Guardrails — Prefer explicit readiness checks (waitFor, polling with timeout) over arbitrary delay.
  6. Verify — Re-run enough iterations to be confident; document the root cause in the PR/issue.

Success criteria

  • Flake is classified (time/random/shared state/network/order) or honestly unknown.
  • Either a real fix lands, or a narrow quarantine with tracking issue and owner.
  • No new fixed sleep/setTimeout delays used as the primary "fix".
  • Repeated runs pass (or quarantine is verified to unblock CI intentionally).
  • Broad test deletions or suite-wide skips were confirmed or avoided.

Out of scope

  • Permanent lowering of coverage goals to hide flakes.
  • Infrastructure replacement (new CI vendor) as the first step.
  • Load testing production from the test suite.

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.