
Fix Flaky Tests
Fixes flaky tests by analyzing failure patterns from Tuist test insights, identifying...
Install
npx skills add tuist/tuist --skill fix-flaky-tests -g -a claude-code -y- Repository
- tuist/tuist5.9k
- Category
- Testing
- Updated
- 3d ago
- License
- See repository
- Context cost
- Mediumabout 2,056 tokens
- Runs scripts
- No, instructions only
What it does
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.
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


