cypress-flake-fixer
Lets your agent find and fix common issues in automated tests with Cypress. It helps improve test reliability by removing patterns that cause intermittent failures.
What it does
This AI agent helps find and fix issues in your automated software tests (Cypress). It looks for code patterns that cause intermittent failures and suggests corrections.
When to use it
- ✓Your tests fail occasionally, but not always.
- ✓Your tests work on your computer but fail in another environment (like continuous integration).
- ✓You are updating Cypress to a newer version and want to ensure old tests still work.
Example of what to ask your AI
“Find and fix flaky test issues in my Cypress project.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
It analyzes your Cypress test code for known patterns that cause flakiness. It then suggests modifications to make your tests more reliable, without just increasing wait times or forcing actions.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add github/awesome-copilot --skill cypress-flake-fixerOr download just the file:
curl -L https://raw.githubusercontent.com/github/awesome-copilot/main/skills/cypress-flake-fixer/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
Cypress Flake Fixer
Audit an existing Cypress suite for the code patterns that cause intermittent failures, then fix them without hiding the problem behind retries, longer timeouts, or force: true.
When to Use This Skill
- A Cypress spec passes locally and fails in CI, or fails once in every few runs
- The suite contains
cy.wait(<number>),{ force: true }, or tests that only pass in order - Errors mention "detached from the DOM", "timed out retrying", or a subject that "is no longer attached"
- The project is upgrading Cypress across a major version (12 through 16)
- A review of Cypress test code is requested
For writing new Cypress tests from scratch, coding standards are enough. This skill is for diagnosing and repairing an existing suite.
Prerequisites
- Node.js 18 or later to run the scanner (it has no dependencies and does not need Cypress installed)
- The Cypress version, read from
package.json. Fixes differ by major version
Workflow
1. Scan
node ./scripts/scan-cypress.mjs <project-root>
node ./scripts/scan-cypress.mjs <project-root> --json # machine-readable
node ./scripts/scan-cypress.mjs <project-root> --strict # add low-confidence rules
node ./scripts/scan-cypress.mjs cypress/e2e/checkout.cy.ts # one file
The scanner reads the Cypress version from the nearest package.json and grades removed APIs as error when the installed major already rejects them and warn when they break on upgrade. Run --list-rules for the catalog.
Findings are heuristic. Open each location and confirm before editing.
2. Measure before changing anything
When the goal is to fix a specific flaky spec, record how often it fails first. Without a baseline there is no way to tell a fix from luck.
for i in $(seq 1 20); do npx cypress run --spec "cypress/e2e/checkout.cy.ts" --quiet || echo "FAIL $i"; done
A spec that fails 1 run in 10 needs about 30 clean runs after the fix before the fix is believable.
3. Fix in this order
| Order | Rules | Why first |
|---|---|---|
| 1 | CY002, CY003, CY007 graded error |
The test is wrong or already broken; other fixes build on correct command flow |
| 2 | CY001, intercept ordering | Time-based waits are the largest single source of flake |
| 3 | CY005, CY006 | Broken retry-ability causes detached-DOM and one-shot assertion failures |
| 4 | CY004 | force: true hides a real overlap, animation, or disabled state |
| 5 | CY008, CY010, CY012 | State leaks and order dependence |
| 6 | CY013, CY101, CY102 | Selector and assertion hygiene |
Before-and-after code for every rule is in references/anti-patterns.md. Replacements for removed APIs are in references/removed-apis.md. Read the section for the rule being fixed; do not load both files upfront.
4. Replace each fixed wait with the condition it was standing in for
Do not delete a cy.wait(n) or swap it for a guess. Work out what the delay covered:
| The wait covered | Replace with |
|---|---|
| A network request | cy.intercept(...).as('x') registered before the trigger, then cy.wait('@x') |
| A render that follows a request or state change | A .should() on the DOM that results |
| A debounce, throttle, polling interval, or toast timeout | cy.clock() before cy.visit(), then cy.tick(ms) |
| A CSS animation or transition | An assertion on the final state; Cypress already waits for the element to stop moving before acting |
| Client-side hydration of server-rendered HTML | A signal the app sets when hydration finishes (see Gotchas) |
| Unknown | Run the test in npx cypress open, select the wait in the Command Log, and read which requests and DOM changes happened during it |
5. Verify
- Run the changed spec alone, then repeat it at least as many times as the baseline run.
- Rerun the scanner and compare counts per rule.
- Run the full suite once to catch order dependence exposed by the change.
Rules for the fix itself
- Change test code only. If the test exposes an application bug (double submit, missing loading state, race in the UI), report it instead of working around it.
- Do not raise
defaultCommandTimeout, addretries, or add{ force: true }to make a test pass. Each one converts a visible failure into a slower or hidden one. - Do not replace
cy.wait(2000)withcy.wait(5000), or with.should('exist')on an element that was already present.
…
FAQ
What are 'flaky' tests?
Flaky tests are those that sometimes pass and sometimes fail, even without any changes to the code being tested. They are frustrating because they don't give a reliable indication of whether the software is working or not.
Do I need to install anything to use this agent?
No, the AI agent does not require installation. It works by analyzing the code you provide.
What are 'anti-patterns'?
Anti-patterns are common coding practices that, while they might seem to work initially, often lead to problems down the line, such as flaky or hard-to-maintain tests.
Details
Original description by the author
Find and fix flake-prone anti-patterns in an existing Cypress suite, and APIs removed in Cypress 12 to 16. Bundles a zero-dependency scanner for fixed cy.wait() delays, assigned command return values, async/await, force: true, chaining after actions, one-shot expect() inside .then(), conditional testing, and removed APIs such as Cypress.env(), cy.exec(), cy.server()/cy.route(). Use when asked to f
repo: github/awesome-copilot
Popularity
- GitHub stars
- 40k
- Ranking position
- #5100
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
acquire-codebase-knowledge
Helps your agent understand and document an existing code project. It's useful for onboarding new people or getting an overview of the architecture.
github/awesome-copilot
acreadiness-assess
Enables your agent to assess a project's readiness for AI and generate a report. It's useful for understanding how well a project is prepared to use AI tools.
github/awesome-copilot
acreadiness-generate-instructions
Helps your agent create instructions for AI tools based on an assessment. It's useful for improving how AI interacts with code and closing identified gaps.
github/awesome-copilot
acreadiness-policy
Enables your agent to help define or apply policies for AI project assessment. It's useful for standardizing how projects are evaluated and ensuring compliance.
github/awesome-copilot
Similar skills
cpp-testing
Makes your agent write and improve tests for C++ code. It helps set up testing tools and fix errors.
affaan-m/ECC
csharp-testing
Helps your agent create tests for C# and .NET code. It uses best practices to ensure tests are efficient and reliable.
affaan-m/ECC
django-tdd
Enables your agent to apply testing strategies for Django with pytest-django and TDD. It's useful for writing robust tests and ensuring code quality, especially for DRF APIs.
affaan-m/ECC