flaky-test-fixer
Skill1 starsChanged 4 months agoMITView on GitHub
Use this skill when a test is reported as flaky, passes and fails across otherwise-identical runs, or fails intermittently in CI without a code change. Triggers include: "flaky test", "this passes sometimes", "fails intermittently", "de-flake this", "test is flaky in CI", or a test that fails on re-run with no changes. Do NOT use this skill for a test that fails consistently and deterministically every time — that's a normal bug, use root-cause-debugger for it instead. This skill is specifically for nondeterministic pass/fail behavior.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- WST2002/claude-code-skillstheir own version, first seen Oct 17, 2026
- DataDog/dd-trace-jstheir own version, first seen Oct 8, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- DataDog/dd-trace-js★ 840same name
- WST2002/claude-code-skills★ 4same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- dependency-upgradeSkill
- frugal-contextSkill
- incident-triageSkill
- root-cause-debuggerSkill
- run-receiptSkill
- session-handoffSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
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
- Very specific: line 38
Run scripts/detect_nondeterminism.py <path> to get a ranked list of suspects across these categories as a starting point — it's a …
- Distinctive: line 47
If a category from step 1 is suspected, target evidence for it specifically (e.g.
- Distinctive: line 62
Re-run N times to confirm stability: before removing any quarantine.
- Distinctive: line 68
Never treat "add a retry" or "increase the timeout" as the fix — those are acceptable only as a temporary quarantine measure, explicitly …
- Distinctive: line 71
Never permanently delete or silently skip a flaky test without stating the suspected or confirmed cause.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flaky Test Fixer
When this fires
Flaky tests get "fixed" by re-running until green, adding a retry wrapper, or bumping a timeout — none of which address why the test is nondeterministic in the first place. The flake keeps eating CI time and occasionally masks a real bug. This skill forces a classify-prove-fix sequence instead of a band-aid.
Protocol
Classify the likely nondeterminism source. Common categories:
- Time/clock — wall-clock assertions, timing-sensitive waits
- Test ordering — state leaking between tests, order-dependent fixtures
- Concurrency/races — unsynchronized shared state across threads/async
- Shared mutable state — module/class-level globals mutated by multiple tests
- Network/IO — real network calls, filesystem races, external services
- Random seeds — unseeded randomness in test data or logic
Run
scripts/detect_nondeterminism.py <path>to get a ranked list of suspects across these categories as a starting point — it's a grep-based heuristic, not a diagnosis by itself.- Prove it. Reproduce the nondeterminism directly:
- Re-run the test N times in isolation (e.g. 20–50x) and record the pass/fail rate.
- Re-run the full suite with test order randomized/reversed to check for ordering dependence.
- If a category from step 1 is suspected, target evidence for it specifically (e.g. run with a fixed seed to confirm randomness is the driver, or run single-threaded to rule out races).
- Quarantine — if the test needs to stop blocking CI while under investigation, mark/skip it explicitly with a comment referencing a tracking issue and an owner. Quarantining is a holding pattern, not a fix, and must never be silent (no unexplained skips).
- Fix at the source. Address the actual mechanism found in step 2 — seed the randomness, isolate the shared state, mock the clock/network, fix the race. Do not fix flakiness by adding blind retries or increasing timeouts as the primary remedy; that hides the mechanism instead of removing it.
- Re-run N times to confirm stability before removing any quarantine. The same N (or greater) used to prove the flake in step 2 must now pass consistently.
Hard rules
- Never treat "add a retry" or "increase the timeout" as the fix — those are acceptable only as a temporary quarantine measure, explicitly labeled as such, never presented as root-caused.
- Never permanently delete or silently skip a flaky test without stating the suspected or confirmed cause.
- A cause is not confirmed until reproduced — "probably a race condition" without a repeated-run or targeted test is a hypothesis, not a finding.
- Quarantine must be trackable: a skip/xfail needs a comment with a reason and a reference (ticket, TODO with owner) — never a bare skip.
Output
Classification: <category from step 1, with reasoning>
Proof: <N runs, X passed / Y failed — and/or the targeted evidence gathered>
Quarantine: <applied / not needed — reference if applied>
Fix: <what was changed and why it addresses the mechanism, not the symptom>
Stability re-run: <N/N passed after fix>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
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.

