From trunk
Common flaky test patterns and how to fix them. Use when debugging test failures, writing new tests, investigating non-deterministic behavior, or when a user mentions "flaky" tests.
How this skill is triggered — by the user, by Claude, or both
Slash command
/trunk:flaky-test-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
When helping users write or debug tests, apply these patterns to avoid introducing flakiness.
When helping users write or debug tests, apply these patterns to avoid introducing flakiness.
sleep() or fixed timeouts instead of polling/waiting for conditions. Async operations assumed to complete in order. Shared mutable state accessed from concurrent threads.sleep(N) with explicit waits that poll for the expected condition. Use synchronization primitives (mutexes, channels, barriers) for concurrent access. Ensure async operations use proper await chains.Date.now(), time.time(), or system clocks directly. Comparing timestamps with exact equality. Hardcoded dates that have now passed.tearDown/afterEach.afterEach/tearDown rather than relying on test order. Avoid global mutable state.finally/defer/afterEach).expected 0.3, got 0.30000000000000004.toBeCloseTo, assertAlmostEqual, assert_in_delta). Define an explicit epsilon/tolerance.Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
npx claudepluginhub trunk-io/claude-code-plugin --plugin trunk