barrier-concurrency-testing

Installation
SKILL.md

Barrier Concurrency Testing

Deterministic race condition testing -- no flaky timing-based tests.

Instead of setTimeout (flaky) or sleep (slow), use barriers to pause execution at exact interleave points. The test controls when each concurrent operation proceeds, making race condition tests deterministic and reproducible on every run.

When to use: Testing concurrent operations, flush conflicts, parallel mutations, race windows between read and write, lock contention scenarios, any code where timing affects correctness.

When not to use: Sequential-only code, simple unit tests, UI components, read-only operations, code with no concurrency concerns.

Rationalizations (Do Not Skip)

Rationalization Why It's Wrong Required Action
"setTimeout is good enough" Timing-based tests are inherently flaky -- they pass 99 times, fail on CI Use barriers for deterministic control
"It passed 10 times, it's fine" Heisenbugs hide in timing windows that haven't been hit yet Barrier at every interleave point
"We don't have race conditions" Any concurrent code has race windows Write a barrier test to prove it
"Barriers are too complex" 15 lines of setup prevents hours of debugging flaky failures Copy the pattern from references
Related skills
Installs
17
GitHub Stars
5
First Seen
Feb 23, 2026