Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when you need to apply Java concurrency best practices — including thread safety fundamentals, ExecutorService thread pool management, concurrent design patterns like Producer-Consumer, asynchronous programming with CompletableFuture, immutability and safe publication, deadlock avoidance, virtual threads, structured concurrency, scoped values, backpressure, cancellation discipline, and observability for concurrent systems. This should trigger for requests such as Review Java code for concurr
.claude/skills/jabrena-125-java-concurrency/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-20 | ✗→✓ | ▲ Improved | 45% | 0% |
| case-19 | ✓→✗ | ▼ Worse | -61% | 0% |
| case-04 | ✓→✓ | = Same ✓ | 63% | 0% |
| case-05 | ✓→✓ | = Same ✓ | 51% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 35% | 0% |
Identify and apply Java concurrency best practices to improve thread safety, scalability, and maintainability by using modern java.util.concurrent utilities and virtual threads.
What is covered in this Skill?
ConcurrentHashMap, AtomicInteger, ReentrantLock, ReadWriteLock, Java Memory ModelExecutorService thread pool configuration: sizing, keep-alive, bounded queues, rejection policies, graceful shutdownBlockingQueueCompletableFuture for non-blocking async composition (thenApply/thenCompose/exceptionally/orTimeout)volatile, static initializers)Executors.newVirtualThreadPerTaskExecutor()) for I/O-bound scalabilityStructuredTaskScope) for related subtasks in Java 27 previewScopedValue over ThreadLocal for immutable cross-task dataInterruptedException disciplineCallerRunsPolicytryLock with timeoutsVirtualThreadPinned)UncaughtExceptionHandler observabilityLongAdder, CopyOnWriteArrayList, StampedLock, Semaphore, CountDownLatch, PhaserScope: The reference is organized by examples (good/bad code patterns) for each core area. Apply recommendations based on applicable examples.
Before applying any concurrency changes, ensure the project compiles. If compilation fails, stop immediately — compilation failure is a blocking condition. After applying improvements, run full verification.
./mvnw compile or mvn compile before applying any change./mvnw clean verify or mvn clean verify after applying improvementsRun ./mvnw compile or mvn compile and stop immediately if compilation fails.
Read references/125-java-concurrency.md and identify thread-safety, coordination, and throughput issues to address.
Implement suitable concurrency patterns, structured task scopes where they fit related subtasks, cancellation discipline, and fit-for-purpose primitives.
Run ./mvnw clean verify or mvn clean verify after applying improvements.
For detailed guidance, examples, and constraints, see references/125-java-concurrency.md.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 4,345 | 5,280 | +22% | 1 | 1 | 0% | 198 | 1,040 | +425% | 0 | 0 | — |
case-02 | fail→fail | 4,776 | 5,328 | +12% | 1 | 1 | 0% | 182 | 935 | +414% | 0 | 0 | — |
case-03 | fail→fail | 16,965 | 4,941 | -71% | 1 | 1 | 0% | 3,006 | 996 | -67% | 0 | 0 | — |
case-04 | pass→pass | 10,006 | 12,466 | +25% | 1 | 1 | 0% | 1,522 | 2,483 | +63% | 0 | 0 | — |
case-05 | pass→pass | 7,258 | 6,109 | -16% | 1 | 1 | 0% | 1,125 | 1,694 | +51% | 0 | 0 | — |
case-06 | pass→pass | 12,229 | 19,572 | +60% | 1 | 1 | 0% | 2,047 | 2,773 | +35% | 0 | 0 | — |
case-07 | pass→pass | 5,705 | 5,609 | -2% | 1 | 1 | 0% | 944 | 1,580 | +67% | 0 | 0 | — |
case-08 | pass→pass | 6,123 | 6,514 | +6% | 1 | 1 | 0% | 1,013 | 1,806 | +78% | 0 | 0 | — |
case-09 | pass→pass | 14,484 | 6,682 | -54% | 1 | 1 | 0% | 2,144 | 1,870 | -13% | 0 | 0 | — |
case-10 | pass→pass | 11,853 | 8,291 | -30% | 1 | 1 | 0% | 1,885 | 2,023 | +7% | 0 | 0 | — |
case-11 | pass→pass | 4,603 | 3,735 | -19% | 1 | 1 | 0% | 731 | 1,325 | +81% | 0 | 0 | — |
case-12 | pass→pass | 4,641 | 3,612 | -22% | 1 | 1 | 0% | 685 | 1,228 | +79% | 0 | 0 | — |
case-13 | pass→pass | 16,959 | 11,482 | -32% | 1 | 1 | 0% | 2,688 | 2,521 | -6% | 0 | 0 | — |
case-14 | pass→pass | 3,723 | 4,929 | +32% | 1 | 1 | 0% | 631 | 1,584 | +151% | 0 | 0 | — |
case-15 | pass→pass | 6,300 | 6,656 | +6% | 1 | 1 | 0% | 983 | 1,818 | +85% | 0 | 0 | — |
case-16 | pass→pass | 6,257 | 8,157 | +30% | 1 | 1 | 0% | 1,026 | 2,047 | +100% | 0 | 0 | — |
case-17 | pass→pass | 10,285 | 8,591 | -16% | 1 | 1 | 0% | 1,602 | 2,160 | +35% | 0 | 0 | — |
case-18 | pass→pass | 4,056 | 4,157 | +2% | 1 | 1 | 0% | 583 | 1,386 | +138% | 0 | 0 | — |
case-19 | pass→fail | 14,455 | 5,546 | -62% | 1 | 1 | 0% | 2,639 | 1,025 | -61% | 0 | 0 | — |
case-20 | fail→pass | 4,873 | 2,116 | -57% | 1 | 1 | 0% | 717 | 1,041 | +45% | 0 | 0 | — |
case-21 | pass→pass | 8,917 | 5,521 | -38% | 1 | 1 | 0% | 1,537 | 1,727 | +12% | 0 | 0 | — |
case-22 | pass→pass | 5,361 | 4,873 | -9% | 1 | 1 | 0% | 845 | 1,451 | +72% | 0 | 0 | — |
case-23 | pass→pass | 15,724 | 15,848 | +1% | 1 | 1 | 0% | 2,513 | 3,494 | +39% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted, and 19 counted toward the lift figure. The other 4 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of 0 percentage points is the difference between those two pass rates over the 19 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.