fix-flaky-tests
Qué hace
Esta skill investiga pruebas automatizadas inestables, que pasan y fallan sin cambios en el código, y las arregla. Está pensada para desarrolladores que quieren que su conjunto de pruebas sea fiable.
Cuándo usarla
- ✓Cuando Tuist marca una prueba como inestable y quieres arreglarla.
- ✓Cuando fallan muchas pruebas al azar y quieres encontrar la causa común.
- ✓Cuando quieres descubrir y arreglar todas las pruebas inestables de un proyecto.
Link de la skill
https://github.com/tuist/tuist/blob/main/skills/skills/fix-flaky-tests/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
“Encuentra las pruebas inestables de mi proyecto y arregla la que falla con más frecuencia.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
El agente lee la fiabilidad y los detalles de fallo de cada prueba inestable, lee su código fuente en la línea indicada, identifica el patrón que causa la inestabilidad, la arregla y luego ejecuta la prueba varias veces para confirmarlo.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Fix Flaky Tests
Quick Start
You'll typically receive a Tuist test case URL or identifier. Follow these steps to investigate and fix it:
- Run
tuist test case show <id-or-identifier> --jsonto get reliability metrics for the test. - Run
tuist test case run list Module/Suite/TestCase --flaky --jsonto see flaky run patterns. - Run
tuist test case run show <test-case-run-id> --jsonon failing flaky runs to get failure messages and file paths. - Read the test source at the reported path and line, identify the flaky pattern, and fix it.
- Verify by running the test multiple times to confirm it passes consistently.
If no specific test is provided, start with the Discovery section below.
Discovery
When no specific test case is provided, find all flaky tests in the project:
tuist test case list --flaky --json --page-size 50
This returns all test cases currently flagged as flaky. Key fields:
module.name/suite.name/name— the test identifieravg_duration— helps prioritize (fix fast unit tests first)is_quarantined— whether the test is already quarantined
Triage strategy:
- Group tests by suite — multiple flaky tests in the same suite often share a root cause.
- Check if failures share a
test_run_id— tests that all failed in the same run may have been killed by a process crash, not individual test bugs. - Look at failure messages to categorize: test logic bugs vs infrastructure issues (network errors, server 502s, conflicts on retry).
Investigation
1. Get test case metrics
You can pass either the UUID or the Module/Suite/TestCase identifier:
tuist test case show <id> --json
tuist test case show Module/Suite/TestCase --json
Key fields:
reliability_rate— percentage of successful runs (higher is better)flakiness_rate— percentage of runs marked flaky in the last 30 daystotal_runs/failed_runs— volume contextlast_status— current state
2. View flaky run history
tuist test case run list Module/Suite/TestCase --flaky --json
The identifier uses the format ModuleName/SuiteName/TestCaseName or ModuleName/TestCaseName when there is no suite. This returns only runs that were detected as flaky.
3. View full run history
tuist test case run list Module/Suite/TestCase --json --page-size 20
Look for patterns:
- Does it fail on specific branches?
- Does it fail only on CI (
is_ci: true) or also locally? - Are failures clustered around specific commits?
4. Get failure details
tuist test case run show <test-case-run-id> --json
Key fields:
failures[].message— the assertion or error messagefailures[].path— source file pathfailures[].line_number— exact line of failurefailures[].issue_type— type of issue (assertion_failure, etc.)repetitions— if present, shows retry behavior (pass/fail sequence)test_run_id— the broader test run this execution belongs tocrash_report— crash report data (present when the test runner crashed); containsexception_type,signal,exception_subtype, andtriggered_thread_frames
Code Analysis
- Open the file at
failures[0].pathand go tofailures[0].line_number. - Read the full test function and its setup/teardown.
- Identify which of the common flaky patterns below applies.
- Check if the test shares state with other tests in the same suite.
Common Flaky Patterns
Timing and async issues
- Missing waits: Test checks a result before an async operation completes. Fix: use
await, expectations with timeouts, or polling. - Race conditions: Multiple concurrent operations access shared state. Fix: synchronize access or use serial queues.
- Hardcoded timeouts:
sleep(1)or fixed delays that are too short on CI. Fix: use condition-based waits instead of fixed delays.
Shared state
- Test pollution: One test modifies global/static state that another test depends on. Fix: reset state in setUp/tearDown or use unique instances per test.
- Singleton contamination: Shared singletons carry state between tests. Fix: inject dependencies or reset singletons.
- File system leftovers: Tests leave files that affect subsequent runs. Fix: use temporary directories and clean up.
Environment dependencies
- Network calls: Tests hit real services that may be slow or unavailable. Fix: mock network calls.
- Date/time sensitivity: Tests depend on current time or tim
Preguntas frecuentes
¿Cómo encuentra las pruebas inestables?
Enumera las pruebas marcadas como inestables en las estadísticas de pruebas de Tuist.
¿Qué pasa si no se indica ninguna prueba?
Descubre las pruebas inestables del proyecto y las agrupa por suite.
¿Cómo confirma un arreglo?
Ejecuta la prueba varias veces para comprobar que pasa de forma constante.
Detalles
Descripción original del autor
Fixes flaky tests by analyzing failure patterns from Tuist test insights, identifying root causes, and applying targeted corrections. Can be invoked with a specific test case URL (e.g. `https://tuist.dev/{account}/{project}/tests/test-cases/{id}`) or without arguments to discover and fix all flaky tests in the project.
repo: tuist/tuist
Popularidad
- Estrellas en GitHub
- 5,9 mil
- Posición en el ranking
- #14544
- Licencia
- —
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
analyze-selective-testing
5,9 milAyuda a tu agente a comprobar lo bien que la prueba selectiva de Xcode omitió los objetivos de prueba sin cambios, y a averiguar por qué cambió la omisión entre ejecuciones.
compare-builds
5,9 milAyuda a tu agente a comparar dos compilaciones de Xcode para encontrar las compilaciones más lentas, los cambios en el uso de la caché y los problemas nuevos.
compare-bundles
5,9 milAyuda a tu agente a comparar dos paquetes de app para encontrar cambios de tamaño, archivos añadidos o eliminados y diferencias entre plataformas.
compare-cache-runs
5,9 milAyuda a tu agente a comparar dos ejecuciones de caché para encontrar cambios en las tasas de aciertos y explicar por qué se invalidó la caché.
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.