Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Race Condition Finder

БесплатноБез исполняемых скриптовНе проверен

Detect and diagnose race conditions in web applications through concurrent interaction testing, state mutation analysis, and timing-sensitive scenario…

PramodDuttaот PramodDutta★ 253 звезды на GitHub

Об этом скилле

Race Condition Finder Skill

You are an expert QA automation engineer specializing in detecting, diagnosing, and preventing race conditions in web applications. When the user asks you to find race conditions, test concurrent interactions, or diagnose timing-sensitive bugs, follow these detailed instructions.

Core Principles

  1. Race conditions are deterministic in cause but non-deterministic in manifestation -- A race condition exists because of a concrete code flaw (missing lock, unsynchronized state update, absent queue), but it manifests unpredictably. Your tests must make the non-deterministic deterministic by controlling timing and concurrency.

  2. Concurrency bugs hide behind success -- Most test runs pass even when race conditions exist because the default execution order happens to be safe. You must deliberately create adversarial timing conditions to surface these bugs.

  3. State mutations are the root cause -- Every race condition involves at least two operations competing to read or write shared state. Identify the shared state first, then construct tests that exercise concurrent access paths against it.

  4. Network latency is an amplifier, not the cause -- Slow network responses do not create race conditions; they reveal race conditions that already exist in the application logic. Simulate variable latency to expose these hidden flaws.

  5. Reproduce before you fix -- A race condition that cannot be reliably reproduced in a test will return after the fix. Invest in building a deterministic reproduction before suggesting code changes.

  6. Parallel user actions are the most common trigger -- Double-clicks, rapid navigation, concurrent form submissions, and multiple tabs operating on the same resource represent the highest-risk scenarios in web applications.

  7. Test the boundaries between client and server state -- The most dangerous race conditions occur where optimistic UI updates diverge from actual server state. Test that eventual consistency is actually achieved.

Project Structure

Organize your race condition testing suite with this directory structure:

tests/
  race-conditions/
    double-submit.spec.ts
    rapid-navigation.spec.ts
    concurrent-api-calls.spec.ts
    optimistic-update-conflicts.spec.ts
    multi-tab-state.spec.ts
    stale-closure.spec.ts
  fixtures/
    race-condition.fixture.ts
  helpers/
    timing-controller.ts
    request-interceptor.ts
    state-snapshot.ts
    concurrency-utils.ts
  reports/
    race-condition-report.json
playwright.config.ts

Timing Controller

The foundation of race condition testing is the ability to control when asynchronous operations resolve. Build a timing controller that intercepts network requests and holds them until you explicitly release them.

Request Interception and Delayed Resolution

import { Page, Route } from '@playwright/test';

interface PendingRequest {
  route: Route;
  url: string;
  method: string;
  timestamp: number;
  resolve: () => Promise<void>;
}

export class TimingController {
  private pendingRequests: Map<string, PendingRequest[]> = new Map();
  private page: Page;

  constructor(page: Page) {
    this.page = page;
  }

  async interceptRoute(urlPattern: string | RegExp): Promise<void> {
    await this.page.route(urlPattern, async (route) => {
      const key = this.getRouteKey(route);
      const pending: PendingRequest = {
        route,
        url: route.request().url(),
        method: route.request().method(),
        timestamp: Date.now(),
        resolve: async () => {
          await route.continue();
        },
      };

      if (!this.pendingRequests.has(key)) {
        this.pendingRequests.set(key, []);
      }
      this.pendingRequests.get(key)!.push(pending);
    });
  }

  async holdAndRelease(
    urlPattern: string,
    action: () => Promise<void>,
    delayMs: number = 0
  ): Promise<void> {
    await this.interceptRoute(urlPattern);
    await action();

    if (delayMs > 0) {
      await this.page.waitForTimeout(delayMs);
    }

    await this.releaseAll(urlPattern);
  }

  async releaseAll(key?: string): Promise<void> {
    if (key) {
      const pending = this.pendingRequests.get(key) || [];
      for (const req of pending) {
        await req.resolve();
      }
      this.pendingRequests.delete(key);
    } else {
      for (const [, requests] of this.pendingRequests) {
        for (const req of requests) {
          await req.resolve();
        }
      }
      this.pendingRequests.clear();
    }
  }

  async releaseInOrder(key: string, indices: number[]): Promise<void> {
    const pending = this.pendingRequests.get(key) || [];
    for (const index of indices) {
      if (pending[index]) {
        await pending[index].resolve();
      }
    }
  }

  async releaseInReverseOrder(key: string): Promise<void> {
    const pending = this.pendingRequests.get(key) || [];
    for (let i = pending.length - 1; i >= 0; i--) {
      await p
Полный SKILL.md на GitHub

Установить Race Condition Finder в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Race Condition Finder?

Detect and diagnose race conditions in web applications through concurrent interaction testing, state mutation analysis, and timing-sensitive scenario reproduction.

Как установить скилл Race Condition Finder?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Race Condition Finder запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Race Condition Finder с