flaky-test-specialist

Diagnose and fix intermittent Playwright and Vitest test failures.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Whaleylaw/llm-lawyer --skill flaky-test-specialist
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flaky-test-specialist
Source: https://github.com/Whaleylaw/llm-lawyer/tree/main/.claude/skills/flaky-test-specialist
Command: npx skills add https://github.com/Whaleylaw/llm-lawyer --skill flaky-test-specialist

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Intermittent and non-deterministic test failures caused by timing issues, race conditions, shared state, resource leaks, or environment-specific behavior that make test suites unreliable in local development or CI pipelines.

Core Features & Use Cases

  • Identify flaky tests through repeated runs and CI log analysis and classify root causes (timing, order, environment, network).
  • Replace arbitrary sleeps with condition-based waits, enforce proper async/await usage, and apply Playwright/Vitest best practices to remove timing dependencies.
  • Improve test isolation by resetting state, cleaning resources, mocking network/time, and recommending deterministic patterns for concurrent operations; useful for Playwright end-to-end tests and Vitest unit tests.
  • Debugging aids such as adding logs, screenshots, traces, and running tests in isolation or with retries as a last-resort mitigation.

Quick Start

Diagnose the intermittent test by running it repeatedly, identify missing waits or shared state, replace sleeps with condition-based waits or mocks, and verify the fix by re-running the test 50+ times in CI.

Frequently Asked Questions about flaky-test-specialist

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

FAQPage Schema
How do I fix intermittent flaky test failures in my CI pipeline?▼

Fix intermittent flaky test failures by diagnosing timing issues and race conditions, replacing arbitrary timeouts with condition-based waits, and verifying the fix by running the test repeatedly in CI.

What causes race conditions and timing-dependent flakiness in Vitest?▼

Race conditions and timing-dependent flakiness in Vitest are caused by missing waits, improper async/await handling, shared state, and network timing issues. Applying deterministic patterns and test isolation resolves these failures.

How do I replace arbitrary sleeps with condition-based waits in Playwright?▼

Replace arbitrary sleeps with condition-based waits in Playwright by using proper waitFor methods and async/await handling to remove timing dependencies and stabilize end-to-end test execution.

Does this approach work for both Vitest unit tests and Playwright end-to-end tests?▼

Yes, this approach works for both Vitest unit tests and Playwright end-to-end tests by applying framework-specific best practices to improve test isolation, clean resources, and mock network timing.

What is the best way to debug flaky tests caused by shared state and resource leaks?▼

The best way to debug flaky tests caused by shared state and resource leaks is to reset state, clean resources, add tracing logs or screenshots, and run tests in isolation to identify the root cause.

When should I use fake timers or deterministic network mocks to stabilize flaky tests?▼

Use fake timers or deterministic network mocks to stabilize flaky tests when facing non-deterministic network timing issues or concurrent operations that require controlled, predictable execution environments.