
Fix
Diagnose and fix flaky Playwright E2E tests using a structured taxonomy for timing, isolation, environment, and CI failures.
Overview
Fix is an agent skill most often used in Ship (also Build) that classifies flaky E2E tests and applies Playwright-oriented remediation patterns.
Install
npx skills add https://github.com/alirezarezvani/claude-skills --skill fixWhat is this skill?
- Decision tree branches timing/async, test isolation, environment drift, and CI infrastructure
- Concrete Playwright fixes: missing await, waitForTimeout replacement, per-test DB and storage cleanup
- Local vs suite vs CI failure modes with targeted remediation
- Category-specific snippets for race conditions, shared state, viewport, timezone, and worker OOM
- 4-branch flaky test decision tree (timing, isolation, environment, infrastructure)
Adoption & trust: 1.6k installs on skills.sh; 17.5k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Playwright suite passes sometimes and fails other times with no clear code change, blocking merges and eroding trust in CI.
Who is it for?
Solo builders maintaining Playwright E2E tests who see intermittent CI failures or order-dependent suite behavior.
Skip if: Teams needing greenfield test strategy, load testing, or unit-test-only debugging without browser automation.
When should I use this skill?
Use when flaky Playwright or E2E tests fail intermittently locally, in suite, or in CI and you need categorized fixes.
What do I get? / Deliverables
You get a labeled root cause (timing, isolation, environment, or infrastructure) and concrete test changes that make failures reproducible and fixes durable.
- Updated test files with deterministic waits and isolation
- Documented failure category per flaky spec
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Flaky E2E failures surface hardest at ship when suites gate releases and CI, even though fixes touch test code written during build. Testing is the canonical shelf because the skill is a decision tree and fix patterns for unstable automated tests, not general app debugging.
Where it fits
Stabilize new checkout E2E specs before merging feature work.
Unblock a release when merge queue fails on intermittent login tests.
Reduce noise after scaling CI workers or changing default timezone.
How it compares
Use instead of random timeout increases or disabling tests without a documented failure category.
Common Questions / FAQ
Who is fix for?
Solo and indie developers shipping web apps with Playwright who need a systematic way to stop flaky end-to-end tests from blocking releases.
When should I use fix?
Use it during Ship when CI is unreliable, after Build when new E2E specs flake under parallel runs, or in Operate when production-like environments expose timing bugs in tests.
Is fix safe to install?
It is procedural guidance for editing tests and config; review the Security Audits panel on this page before installing any skill from the catalog.
SKILL.md
READMESKILL.md - Fix
# Flaky Test Taxonomy ## Decision Tree ``` Test is flaky │ ├── Fails locally with --repeat-each=20? │ ├── YES → TIMING / ASYNC │ │ ├── Missing await? → Add await │ │ ├── waitForTimeout? → Replace with assertion │ │ ├── Race condition? → Wait for specific event │ │ └── Animation? → Wait for animation end or disable │ │ │ └── NO → Continue... │ ├── Passes alone, fails in suite? │ ├── YES → TEST ISOLATION │ │ ├── Shared variable? → Make per-test │ │ ├── Database state? → Reset per-test │ │ ├── localStorage? → Clear in beforeEach │ │ └── Cookie leak? → Use isolated contexts │ │ │ └── NO → Continue... │ ├── Fails in CI, passes locally? │ ├── YES → ENVIRONMENT │ │ ├── Viewport? → Set explicit size │ │ ├── Fonts? → Use Docker locally │ │ ├── Timezone? → Use UTC everywhere │ │ └── Network? → Mock external services │ │ │ └── NO → INFRASTRUCTURE │ ├── Browser crash? → Reduce workers │ ├── OOM? → Limit parallel tests │ ├── DNS? → Add retry config │ └── File system? → Use unique temp dirs ``` ## Common Fixes by Category ### Timing / Async **Missing await:** ```typescript // BAD — race condition page.goto('/dashboard'); expect(page.getByText('Welcome')).toBeVisible(); // GOOD await page.goto('/dashboard'); await expect(page.getByText('Welcome')).toBeVisible(); ``` **Clicking before visible:** ```typescript // BAD — element may not be ready await page.getByRole('button', { name: 'Submit' }).click(); // GOOD — ensure visible first const submitBtn = page.getByRole('button', { name: 'Submit' }); await expect(submitBtn).toBeVisible(); await submitBtn.click(); ``` **Race with network:** ```typescript // BAD — data might not be loaded await page.goto('/users'); await expect(page.getByRole('table')).toBeVisible(); // GOOD — wait for API response const responsePromise = page.waitForResponse('**/api/users'); await page.goto('/users'); await responsePromise; await expect(page.getByRole('table')).toBeVisible(); ``` ### Test Isolation **Shared state fix:** ```typescript // BAD — tests share userId let userId: string; test('create', async () => { userId = '123'; }); test('read', async () => { /* uses userId */ }); // GOOD — each test is independent test('read user', async ({ request }) => { const response = await request.post('/api/users', { data: { name: 'Test' } }); const { id } = await response.json(); // Use id within this test }); ``` **localStorage cleanup:** ```typescript test.beforeEach(async ({ page }) => { await page.goto('/'); await page.evaluate(() => localStorage.clear()); }); ``` ### Environment **Explicit viewport:** ```typescript test.use({ viewport: { width: 1280, height: 720 } }); ``` **Timezone-safe dates:** ```typescript // BAD expect(dateText).toBe('March 5, 2026'); // GOOD — timezone independent expect(dateText).toMatch(/\d{1,2}\/\d{1,2}\/\d{4}/); ``` ### Infrastructure **Retry config:** ```typescript // playwright.config.ts export default defineConfig({ retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 2 : undefined, }); ``` **Increase timeout for CI:** ```typescript test.setTimeout(60_000); // 60s for slow CI ``` --- name: "fix" description: >- Fix failing or flaky Playwright tests. Use when user says "fix test", "flaky test", "test failing", "debug test", "test broken", "test passes sometimes", or "intermittent failure". --- # Fix Failing or Flaky Tests Diagnose and fix a Playwright test that fails or passes intermittently using a systematic taxonomy. ## Input `$ARGUMENTS` contains: - A test file path: `e2e/login.spec.ts` - A test name: ""should redirect after login"` - A description: `"the checkout test fails in CI but passes locally"` ## Steps ### 1. Reproduce the Failure Run the test to capture the error: ```bash npx playwright test <file> --reporter=list ``` If the test passes, it's likely flaky. Run burn-in: ```bash npx playwright test <file> --repeat-each=10 --reporter=list