cypress-flake-fixer
Qué hace
Este agente de IA te ayuda a encontrar y corregir problemas en tus pruebas automatizadas de software (Cypress). Busca patrones de código que causan fallos intermitentes y sugiere correcciones.
Cuándo usarla
- ✓Tus pruebas fallan de vez en cuando, pero no siempre.
- ✓Tus pruebas funcionan en tu ordenador, pero fallan en otro entorno (como la integración continua).
- ✓Estás actualizando Cypress a una versión más reciente y quieres asegurarte de que las pruebas antiguas siguen funcionando.
Link de la skill
https://github.com/github/awesome-copilot/blob/main/skills/cypress-flake-fixer/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Busca y corrige los problemas de pruebas inestables (flaky) en mi proyecto de Cypress.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Analiza el código de tus pruebas de Cypress en busca de patrones conocidos que causan inestabilidad. Después sugiere cambios para que tus pruebas sean más fiables, sin limitarse a aumentar los tiempos de espera ni a forzar acciones.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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.
…
Preguntas frecuentes
¿Qué son las pruebas 'flaky' o inestables?
Son pruebas que a veces pasan y a veces fallan, incluso sin que haya cambios en el código que se prueba. Son frustrantes porque no dan una indicación fiable de si el software funciona o no.
¿Necesito instalar algo para usar este agente?
No, el agente de IA no requiere instalación. Funciona analizando el código que le proporcionas.
¿Qué son los 'antipatrones'?
Son prácticas de programación comunes que, aunque parecen funcionar al principio, suelen provocar problemas a largo plazo, como pruebas inestables o difíciles de mantener.
Detalles
Descripción original del autor
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
Popularidad
- Estrellas en GitHub
- 40 mil
- Posición en el ranking
- #7157
- Licencia
- MIT
- Actualizada
- 15/10/2026
Comentarios
- …
Más skills de este repositorio
acquire-codebase-knowledge
40 milAyuda a tu agente a entender y documentar un proyecto de código existente. Es útil para incorporar a nuevas personas o tener una visión general de la arquitectura.
acreadiness-assess
40 milPermite a tu agente evaluar qué tan preparado está un proyecto para la IA y generar un informe. Es útil para saber qué tan bien está listo un proyecto para usar herramientas de IA.
acreadiness-generate-instructions
40 milAyuda a tu agente a crear instrucciones para herramientas de IA basadas en una evaluación. Es útil para mejorar cómo la IA interactúa con el código y cerrar las brechas detectadas.
acreadiness-policy
40 milPermite a tu agente ayudar a definir o aplicar políticas para la evaluación de proyectos de IA. Es útil para estandarizar cómo se evalúan los proyectos y garantizar el cumplimiento.
Skills parecidas
test-driven-development
311 milEnseña a tu agente a escribir primero una prueba que falle, verla fallar y después escribir el código más pequeño que la hace pasar, antes de construir cualquier función o corrección.
verification-before-completion
311 milEnseña a tu agente a ejecutar comprobaciones reales y leer su resultado antes de afirmar que una tarea, una corrección o una compilación está completa o en buen estado.
migrate-to-shoehorn
310 milSustituye los casts de tipo arriesgados de tus archivos de prueba por la librería shoehorn, para que las pruebas usen datos parciales y sigan pasando las comprobaciones de tipos.