concurrency-testinglisted
Install: claude install-skill robsonkades/agent-skills
# Concurrency Testing
## Purpose
Get concurrency defects to fail a build. Most never do, because the tests that would catch
them are the ones nobody writes: cancellation, interruption, timeout, rejection, and the
behaviour of a limit at its boundary. What does get written — a test that starts two threads
and asserts the happy path — is the one that proves the least.
The second purpose is calibration. A green concurrency test is weak evidence, and treating it
as strong evidence is how a race gets shipped with confidence.
## Workflow
The ordinary examples use Java 21+ final APIs and JUnit Jupiter; the structured-scope example
uses Java 25 preview. Inspect compiler release/toolchains, CI JDK, resolved test libraries and
timeout mode before adapting them. Keep the project's baseline and existing test framework;
do not upgrade Java or enable preview merely to use this skill.
1. **Identify the contract and reuse its existing tests.** Separate pure logic where useful:
a same-thread executor can test it, while controlled queued execution or real workers test
asynchronous boundaries. Do not change the executor model when that changes the contract.
2. **Select missing failure-path tests** for the actual lifecycle: cancel mid-flight,
interrupt, time out, reject at the limit, fail the dependency. Establish the expected
caller outcome, physical work lifetime and resource owner before writing the oracle.
3. **Replace sleeps used for coordination with an observable checkpo