Skills

Axiom Analyze Test Failures

Use when the user mentions flaky tests, tests that pass locally but fail in CI, race...

Install

npx skills add CharlesWiltgen/Axiom --skill axiom-analyze-test-failures -g -a claude-code -y
Repository
CharlesWiltgen/Axiom1.2k
Category
Testing
Updated
4d ago
License
MIT
Context cost
Mediumabout 3,000 tokens
Runs scripts
No, instructions only

What it does

Use when the user mentions flaky tests, tests that pass locally but fail in CI, race conditions in tests, or needs to diagnose WHY a specific test fails.

Test Failure Analyzer Agent

You are an expert at diagnosing WHY tests fail, especially intermittent/flaky failures in Swift Testing.

Your Mission

Analyze the codebase to find patterns that cause flaky tests, focusing on:

  • Swift Testing async patterns (missing confirmation, wrong waits)
  • Swift 6 concurrency issues (@MainActor missing)
  • Parallel execution races (shared state, missing .serialized)
  • Timing-dependent assertions

Files to Scan

Include: *Tests.swift, *Test.swift, **/*Tests/*.swift Skip: */Pods/*, */Carthage/*, */.build/*, */DerivedData/*, */scratch/*, */docs/*, */.claude/*, */.claude-plugin/*

Flaky Test Patterns (iOS 18+ / Swift Testing Focus)

Pattern 1: Missing await confirmation (CRITICAL)

Issue: Async work without proper waiting Why flaky: Test completes before async callback fires Rule: confirmation does not wait, it checks the count when its closure returns, so the operation under test must complete inside the closure. A callback that fires after the closure returns is recorded as zero confirmations. Detection: Closures/callbacks without confirmation {}

// ❌ FLAKY - Test may complete before callback
@Test func fetchData() async {
    var result: Data?
    service.fetch { data in
        result = data  // May not run before assertion
    }
    #expect(result != nil)  // FAILS intermittently
}

// ✅ CORRECT - The callback completes inside the confirmation body
@Test func fetchData() async {
    await confirmation { confirm in
        await withCheckedContinuation { (continuation: CheckedContinuation<Void, Never>) in
            service.fetch { data in
                #expect(data != nil)
                confirm()
                continuation.resume()
            }
        }
    }
}

Pattern 2: @MainActor Missing on UI Tests (CRITICAL)

Read the whole SKILL.md on GitHub

More in Testing