.cursor/skills/qa-flaky-detector/SKILL.md
Analyze CI history and test execution data to identify flaky tests using 4-pattern classification -- race conditions, shared state, time-dependency, external dependencies -- with suggested fixes.
npx skillsauth add AZANIR/qa-skills qa-flaky-detectorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Identify and classify flaky tests from CI history and test execution data. Flaky tests pass and fail intermittently for the same code, wasting CI time and masking real failures. This skill detects flakiness, classifies root causes into four patterns, and suggests targeted fixes.
| Pattern | Description | Typical Causes | Suggested Fixes |
|---------|-------------|----------------|-----------------|
| 1. Race conditions | Async timing, DOM not ready, API response order | Missing awaits, no explicit waits, parallel execution | Add explicit waits, await chains, waitForSelector |
| 2. Shared state | Test order dependency, global state mutation, DB leftover | Global vars, singletons, uncleared DB/cache | Isolate tests, beforeEach cleanup, transactional rollback |
| 3. Time-dependency | Timezone, date/time mocking, daylight saving | new Date(), Date.now(), hardcoded dates | Mock time (Jest useFakeTimers, freezegun), use fixed dates |
| 4. External dependencies | Network calls, third-party APIs, file system | Live HTTP, external services, temp files | Mock/stub APIs, use fixtures, deterministic file paths |
See references/flaky-patterns.md for detailed patterns with code examples and fixes.
passes / (passes + failures) over recent runsawait on async operationssetTimeout/setInterval without cleanupnew Date() or Date.now() without mockingbeforeEach/afterEach cleanupSee references/ci-analysis.md for CI history analysis methods.
# Flaky Test Report — [Project/Branch]
## Summary
| Test | Failure Rate | Runs | Classification | Priority |
|------|--------------|------|----------------|----------|
| auth.login.spec.ts:42 | 23% | 26 | Race condition | High |
| checkout.flow.spec.ts:15 | 12% | 18 | Shared state | High |
| utils.date.spec.ts:8 | 8% | 12 | Time-dependency | Medium |
## Detailed Findings
### auth.login.spec.ts:42 — "should redirect after login"
- **Failure rate:** 6/26 (23%)
- **Classification:** Race condition
- **Likely cause:** DOM not ready before assertion
- **Suggested fix:** Add `await page.waitForSelector('#dashboard')` before assertion
| Need | Skill | Usage | |------|-------|-------| | Parse JUnit/Allure | qa-test-reporter | Aggregate results from multiple runs | | Fix broken selectors | qa-test-healer | Apply suggested waits/selectors | | Create fix tasks | qa-task-creator | Generate tasks for flaky test fixes | | Test strategy | qa-test-strategy | Document flaky mitigation in strategy |
Can do (autonomous):
Cannot do (requires confirmation):
Will not do (out of scope):
| Symptom | Likely Cause | Fix | |---------|--------------|-----| | No flaky tests found | Too few runs, or tests truly stable | Increase run count; verify CI artifacts parsed | | All tests flagged | Threshold too strict | Raise pass-rate threshold; exclude known-broken tests | | Wrong classification | Heuristics insufficient | Review code manually; add custom pattern to references | | Missing CI data | Format not supported | Check qa-test-reporter; add parser for format | | Fix doesn't work | Root cause different | Re-classify; try alternative pattern fixes | | Pass rate 0% | Test always fails | Exclude from flaky report; treat as broken |
| Topic | Reference |
|-------|-----------|
| Flaky patterns with code examples and fixes | references/flaky-patterns.md |
| CI history analysis methods | references/ci-analysis.md |
tools
Analyze OpenAPI/Swagger spec (JSON or YAML) against existing test files and generate an HTML coverage report with QA automation tasks. Use when user provides an OpenAPI spec file and wants to know test coverage status.
testing
Universal QA plan generator supporting 10 plan types including test plans, sprint plans, regression plans, release plans, UAT plans, performance plans, migration plans, onboarding plans, and custom plans.
development
Generate consumer-driven contract tests using Pact for JavaScript and Python to verify microservice API compatibility between consumer and provider.
development
Master skill coordinating all QA skills through pipeline modes (full-cycle, docs-only, testcases-only, write-tests, report), formalized handoff chains, scheduler rules, and framework/language selection based on project context.