debug-flaky-tests

Diagnose non-deterministic test failures by classifying root causes like shared state and race conditions.

9|3|Updated Jun 13, 2026
One-click install
npx skills add https://github.com/Sir-chawakorn/sanook-cli --skill debug-flaky-tests
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debug-flaky-tests
Source: https://github.com/Sir-chawakorn/sanook-cli/tree/main/skills/debug-flaky-tests
Command: npx skills add https://github.com/Sir-chawakorn/sanook-cli --skill debug-flaky-tests

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the frustration of flaky tests that pass locally but fail intermittently in CI, preventing the masking of real bugs with unreliable retry mechanisms.

Core Features & Use Cases

  • Deterministic Reproduction: Provides a systematic framework to loop, randomize, and isolate tests to force failure.
  • Root Cause Analysis: Classifies flakes into categories like shared state, async timing, real-clock dependence, and unseeded randomness.
  • Remediation Strategy: Offers specific technical patterns for fixing flakes, such as injecting fake clocks, pinning timezones, and replacing sleeps with awaited conditions.

Quick Start

Use the debug-flaky-tests skill to analyze the non-deterministic failure in the user authentication test suite and provide a remediation plan.

Frequently Asked Questions about debug-flaky-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why do my tests pass locally but fail intermittently in CI/CD pipelines?

Intermittent CI/CD test failures often stem from non-deterministic behavior like shared state, race conditions, or clock drift. Diagnosing these flaky tests involves classifying the root cause and applying patterns like injecting fake clocks or isolating test execution.

How do I debug race conditions and async timing issues in my test suite?

Debugging async timing and race conditions requires replacing sleeps with awaited conditions to ensure deterministic execution. Root cause analysis identifies these timing flakes, and remediation strategies enforce isolated state management for robust asynchronous handling.

What is the best way to reproduce a flaky test that only fails occasionally?

The best way to reproduce a flaky test is through deterministic reproduction, using a systematic framework to loop, randomize, and isolate tests to force the intermittent failure. This exposes the non-deterministic root cause for reliable debugging.

How do I fix test failures caused by unseeded randomness and timezone dependencies?

Fixing failures from unseeded randomness and timezone dependencies involves specific remediation patterns like seeding random number generators and pinning timezones. Root cause analysis classifies these flakes to apply the correct technical fix.

When should I not use retry mechanisms for failing automated tests?

Retry mechanisms should be avoided when intermittent failures mask real production bugs, as they erode developer trust. Instead of unreliable retries, apply root cause analysis to eliminate non-deterministic test failures and restore suite integrity.