SSkilltecabyclaudinhocode
Enviar skill
← Voltar para o catálogo

claude-skill-flaky-test-detector

Desenvolvimento

Claude Code skill for detecting flaky test patterns that cause intermittent CI failures

2estrelas
Ver no GitHub ↗Autor: wrsmith108

Flaky Test Detector Skill

A Claude Code skill for detecting flaky test patterns that cause intermittent CI failures.

Trigger Phrases

This skill activates when you mention:

  • "flaky test"
  • "intermittent failure"
  • "test sometimes fails"
  • "race condition in test"
  • "timing issue in test"
  • "test passes locally but fails in CI"
  • "non-deterministic test"

Capabilities

Pattern Detection

Scans *.test.ts and *.spec.ts files to detect:

SeverityPatternRisk
HIGHttl.*:\s*1\b1-second TTL causes second-boundary race conditions
HIGHMath.floor(Date.now() / 1000)Second truncation creates timing edge cases
HIGHsetTimeout([^,]+,\s*\d{1,2})Very short timeouts (<100ms) are unreliable
MEDIUMDate.now() without mockingReal time in tests causes non-determinism
MEDIUMtimeout.*:\s*[1-9]0?\bLow timeout values cause race conditions
MEDIUMnew Date() without mockingReal date in tests causes flakiness
LOWMath.random() without seedingRandom values cause non-determinism
LOWprocess.nextTick in assertionsTiming-dependent assertions

Context Extraction

For each detected pattern, the skill extracts:

  • File path and line number
  • Surrounding code context (3 lines before/after)
  • Pattern severity classification
  • Specific risk explanation

Fix Suggestions

Generates actionable fix suggestions:

  • vi.useFakeTimers() for time-based flakiness
  • TTL increase recommendations
  • Mock injection patterns
  • Deterministic alternatives

Usage

Scan Current Directory

# Run the detector on all test files
npx tsx scripts/index.ts

# Scan specific directory
npx tsx scripts/index.ts ./src/tests

# Output as JSON
npx tsx scripts/index.ts --json

Integration with CI

Add to your CI pipeline to catch flaky patterns before merge:

- name: Check for flaky test patterns
  run: npx tsx scripts/index.ts --ci

Como adicionar

/plugin marketplace add wrsmith108/claude-skill-flaky-test-detector

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Comentários · Nenhum comentário

Entre para comentar. Entrar

  • Ainda não há comentários. Seja o primeiro.