Skip to content
Back to skills

Flaky Tests

ASecurity

Find and fix flaky tests: reproduce, classify the cause (time, order, async, shared state, network) and prevent

  • 7 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 30, 2026
ai-agentstestingdebuggingdatabase

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add ansh44233/forge --skill flaky-tests --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flaky Tests?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Flaky Tests
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ansh44233-flaky-tests/badge)](https://www.skillsdirectory.com/skills/ansh44233-flaky-tests)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Find and fix flaky tests: reproduce, classify the cause (time, order, async, shared state, network) and prevent
profile: standard
tags: testing, quality, debugging
---

# Flaky tests

Use when a test passes and fails without code changes.

## Reproduce
1. Run the single test in a loop (for example 50 times) and with the full suite, in random order where the runner supports it.
2. Record failure rate, error message and environment (CI vs local, parallelism).

## Classify the cause
- Time: real clocks, timezones, timeouts that are too tight. Fix with fake timers or an injected clock.
- Order and shared state: globals, database rows, files or env vars left by other tests. Isolate fixtures and reset state.
- Async: missing awaits, fixed sleeps, assertions before the UI or event settles. Wait for conditions, not durations.
- Randomness: unseeded random data. Seed it and log the seed.
- External services and network: mock at the boundary, or use contract tests.
- Resources: ports, temp directories and parallel workers colliding. Allocate unique ones.

## Fix
Fix the cause, not the symptom. Retries and longer timeouts hide real bugs. Quarantine only with an owner and a deadline.

## Verify
The loop that reproduced the failure now passes every time (for example 200 runs), plus the full suite in random order.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.