flaky-test-fixer
Skill4 starsChanged 27 days agoMITView on GitHub
Use when a test passes and fails without code changes, fails only in CI or only when run with other tests, times out intermittently, or the team is retrying, skipping or quarantining unreliable tests — unit, integration or end-to-end.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- DataDog/dd-trace-jstheir own version, first seen Oct 8, 2026
- pinexai/claude-code-skillstheir own version, first seen Jul 18, 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
- pinexai/claude-code-skills★ 1same 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 repository30 other files it gives its agents.
- accessibility-auditSkill
- api-design-reviewSkill
- api-test-writerSkill
- architecture-diagramSkill
- bug-debuggerSkill
- bug-report-writerSkill
- changelog-writerSkill
- codebase-onboardingSkill
- code-reviewSkill
- database-schema-designSkill
- dependency-upgradeSkill
- design-handoff-specSkill
- design-reviewSkill
- dockerize-appSkill
- figma-design-compareSkill
- git-commit-writerSkill
- github-actions-ciSkill
- playwright-e2e-testsSkill
- prd-writerSkill
- proof-of-done-liteSkill
- readme-writerSkill
- refactor-plannerSkill
- security-auditSkill
- seo-auditSkill
- test-case-generatorSkill
- test-plan-writerSkill
- test-writerSkill
- ux-research-synthesisSkill
- ux-writingSkill
- web-performance-auditSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Reproduce the flake: Run the test many times, alone and with the full suite:
≈ “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
Overview
A flaky test has a cause that can be found: timing, shared state, order, environment or randomness. Reproduce the flake reliably, identify which of those it is, and fix the cause. Retries and longer timeouts hide the problem; they do not fix it.
Method
- Reproduce the flake. Run the test many times, alone and with the full suite:
- Jest/Vitest: run in a loop, or
--runInBandvs parallel. - pytest:
pytest -x --count=50(pytest-repeat) and random order with pytest-randomly. - Playwright:
npx playwright test <file> --repeat-each=20 --workers=4. - JUnit:
@RepeatedTest(50)on the test, or run the suite in a shell loop. Record the failure rate and the exact error.
- Jest/Vitest: run in a loop, or
- Classify using the table below. Compare passing and failing runs: logs, timing, order, environment.
- Confirm the cause with a deliberate change that makes it fail every time (shuffle order, add a delay, slow the network, change the time zone).
- Fix the cause, then rerun the loop until there are zero failures across many runs.
- Remove any retries, sleeps or skips added as workarounds.
Causes and fixes
| Cause | Signs | Fix |
| Timing / async | Passes when slow, fails when fast; waitForTimeout, missing await | Await the real condition (event, response, visible element); add missing awaits |
| Shared state | Fails only with other tests; order matters | Fresh data per test, reset singletons, mocks and module state in beforeEach, isolate database (transaction rollback or unique data) |
| Test order | Fails with random ordering | Remove dependence on data created by earlier tests |
| Time and dates | Fails near midnight, month end, DST, other time zones | Freeze or inject the clock; use UTC; avoid new Date() in assertions |
| Randomness | Different inputs per run | Seed the generator or use fixed fixtures |
| Concurrency | Parallel workers clash on ports, files, accounts | Unique ports, temp directories, accounts per worker |
| External services | Network calls to real third parties | Mock third parties; use local containers for owned dependencies |
| Environment | Only in CI | Compare versions, CPU speed, locale, time zone, screen size, env vars |
| Resource leaks | Fails late in long runs | Close servers, connections, timers, listeners in afterEach |
Output
Test: <name and file>
Failure rate: <before> → <after> over <N> runs
Cause: <category and the specific line or condition>
Fix: <change made>Common mistakes
- Adding retries or increasing timeouts and calling it fixed.
- Running the test once after the fix.
- Fixing the test when the flake is a real race condition in product code.
- Quarantining tests with no owner or follow-up date.
Made by Wageesha Tripathi · LinkedIn · Email · More skills
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.

