Skip to content
Development
Skill

/flaky-test-investigation

Use when tests pass and fail intermittently without code changes, or a test passes alone but fails in the full suite.

From plugin
agent-powerups
8114 skills46 agents54 commands

Claude Code

$ npx -y skills add yeaight7/agent-powerups --skill flaky-test-investigation --agent claude-code

SKILL.md

flaky-test-investigation.SKILL.md
name: flaky-test-investigation
description: Use when tests pass and fail intermittently without code changes, or a test passes alone but fails in the full suite.

Purpose

Flaky tests erode trust in CI. Do not just re-run them and hope for the best — isolate the flake vector, fix it, and prove the fix with a stress loop.

When to Use

  • A test fails intermittently in CI but passes locally (or vice versa)
  • A test passes alone but fails in the full suite
  • A re-run "fixed" a failure and nobody knows why

Inputs

  • The flaky test's name/path and the runner command for it
  • Recent failing runs, if available, to estimate the failure rate

Workflow

1. **Isolate the test.** Run the specific failing test by itself. If it passes alone, the flake is likely an **order dependency** or **state leakage** from a previous test — run the suite up to and including it to confirm.

2. **Stress test.** Run the test in a tight loop to establish the failure rate before changing anything:

   for i in {1..100}; do npm test -- -t "My Test" || echo "FAIL on run $i"; done

(Adapt the inner command to the project's runner; some runners have repeat flags built in.)

3. **Check the common vectors:**

  • **Time** — does the test rely on `Date.now()` or `setTimeout`? Mock the clock.
  • **Async/Promises** — asserting before a background task finishes? Ensure proper `await` or `waitFor` usage.
  • **Shared state** — reusing database records, global singletons, or mutated variables between runs? Ensure clean teardowns in `afterEach`.
  • **Randomness** — random IDs or sort orders? Force deterministic seeds or sort orders.

4. **Prove the fix.** Do not just guess. The fix must be verified by running the stress test loop again and achieving a 100% pass rate.

Output

  • The identified flake vector (order/state, time, async, randomness)
  • The fix, plus stress-loop evidence (pre-fix failure rate vs post-fix 100% pass)

Verification

  • [ ] Test run in isolation to separate order-dependency from intrinsic flake
  • [ ] Stress loop run before the fix to establish a baseline failure rate
  • [ ] Flake vector named explicitly
  • [ ] Stress loop re-run after the fix with a 100% pass rate

Failure Modes

  • **Re-run and hope** — a green re-run proves nothing; the flake is still there.
  • **Fixing without a baseline** — without a pre-fix failure rate, a "fix" cannot be distinguished from luck.
  • **Quarantining forever** — skipping the test removes the signal but keeps the bug.
Read more
@yeaight7
Ships withagent-powerups

Curated power-ups for coding agents: skills, slash commands, MCP configs, hooks, AGENTS.md templates, and workflows for serious software engineering. Claude Code, Codex, Antigravity CLI, Cursor and more

8114 skills46 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
8
Star history of yeaight7/agent-powerups on GitHub, a chart by star-history.com

Other skills on agent-powerups.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills13d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react4d252k
@facebook@facebookInstall Skill

Questions about flaky-test-investigation.

Which coding agents can use flaky-test-investigation?
flaky-test-investigation installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.