Skip to main content
skill CX Codex

fix-flaky-tests — Claude Code skill: fix flaky tests

The skill reads a test's failure history in Tuist, works out the root cause and patches the test. Useful when a test passes and fails at random.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add tuist/agent-skills --skill fix-flaky-tests -a claude-code
Open on GitHub

What fix-flaky-tests does

Everything runs through the Tuist CLI. The skill pulls reliability metrics with tuist test case show <id-or-identifier> --json, lists flaky runs with tuist test case run list Module/Suite/TestCase --flaky --json, then reads the failure message, file path and line number from tuist test case run show <test-case-run-id> --json. It opens the source at that path and edits it.

With no test given, it discovers them itself: tuist test case list --flaky --json --page-size 50. Tests are grouped by suite, since several flaky cases in one suite often share a cause. It also checks whether failures share a test_run_id — those may come from a process crash rather than a bug in the test.

The skill carries a catalogue of usual suspects: missing waits and race conditions, shared state between tests, dependence on network, time or hardcoded paths, and ordering. Crashes are read from crash_report, including EXC_BREAKPOINT, EXC_BAD_ACCESS and EXC_CRASH. Fixes are meant to be the smallest change that removes the cause, with no refactoring around it. Verification is a repeated run through xcodebuild test with -test-iterations and -run-tests-until-failure; the skill suggests starting at 50–100 iterations for fast unit tests and 2–5 for slower integration ones. One caveat: a race or a CI-only timing issue may not reproduce locally, and then the skill works from logs and code analysis instead.

What it helps with

  • find the cause of a test that fails intermittently
  • tell a test bug apart from a process crash on CI
  • remove a test's dependence on current time or timezone
  • untangle tests that share global state
  • confirm a fix with repeated test runs

Example prompts for the agent

  • Investigate the failures of Module/Suite/TestCase and fix it
  • Find every flaky test in the project and fix them
  • Why does this test only fail on CI? Check the run history

How to install fix-flaky-tests

1Skills CLI (Vercel)

npx skills add tuist/agent-skills --skill fix-flaky-tests -a claude-code

2Manually: put the files in place

~/.claude/skills/fix-flaky-tests/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/fix-flaky-tests/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about fix-flaky-tests

How do I install fix-flaky-tests in Claude?

Run npx skills add tuist/agent-skills --skill fix-flaky-tests -a claude-code. The skill lands in ~/.claude/skills/fix-flaky-tests/SKILL.md.

What does fix-flaky-tests do?

It reads a test's metrics and run history in Tuist, traces the flakiness to a failure message and source line, and applies a targeted fix to the test.

Does fix-flaky-tests need Tuist?

Yes. Every step goes through the Tuist CLI — metrics, the list of flaky runs and failure details all come from its data.

Similar skills

All skills for Testing and QA →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor