SkillVaultskills Browse all 500 skills

Code Quality · Version 1.4.0 · Reviewed 2026-08-02

Concurrency Safety Reviewer

Make a defensible decision about race-condition review and deadlock analysis with evidence, explicit trade-offs, and a verification plan.

4 method steps 6 documented failure modes 5 diagnostic checks 7 quality gates

Reviews shared state, lock ordering, atomics, task lifetime, cancellation, queue bounds, and memory visibility for concurrency defects.

₹99 one-time

Get this skill archive

What this skill helps you do

  • Race-condition review
  • Deadlock analysis
  • Task-lifetime safety

How Concurrency Safety Reviewer works

You provide

Shared-state access paths, pool sizing, and symptoms

It inspects

Read-modify-write and lock ordering for race-condition review

It decides

A deadlock analysis fix using atomic or constraint enforcement

You verify

Reproduce under real concurrency and confirm one outcome

What it checks first

Concurrency Safety Reviewer reviews shared state, lock ordering, atomics, task lifetime, cancellation, queue bounds, and memory visibility for concurrency defects. Use it when the work involves Race-condition review, Deadlock analysis, Task-lifetime safety.

  1. Every read-modify-write on shared state and whether it is atomic, locked, or transactional.
  2. Lock acquisition order across code paths, since inconsistent ordering is the definition of a deadlock risk.
  3. Whether async work outlives the request that started it, and what cancels it.
  4. Pool sizing relative to the blocking behavior of the work, because blocking calls on a small pool serialize everything.
  5. Whether the failure reproduces under load or only in production, which indicates a timing-dependent defect.

Failure modes it recognizes

  • Lost update where two transactions read the same value and the second write silently discards the first.
  • Deadlock from two paths acquiring the same two locks in opposite order.
  • Thread-pool exhaustion where blocking I/O on the pool starves the work that would release it.
  • A cancelled request whose downstream work continues, consuming capacity and producing orphaned writes.
  • Double execution of a scheduled job when two instances both believe they hold leadership.
  • Unbounded queue growth converting backpressure into memory exhaustion.

Answers it will reject

  • Adding a sleep to fix a race, which changes the probability without removing the defect.
  • Widening a lock to make a bug disappear, trading correctness ambiguity for a throughput collapse.
  • Assuming a single instance, which becomes false at the first horizontal scale event.
  • Using a database read followed by an application-level uniqueness check instead of a unique constraint.

Decision rules it applies

  • Prefer atomic database operations and unique constraints over application-level coordination.
  • Acquire locks in a globally consistent order and hold them for the shortest possible span.
  • Make operations idempotent so that at-least-once execution is safe.
  • Bound every queue and every retry; unbounded means the failure mode is chosen by the environment.

Evidence it asks for

  • Reproduce under concurrency with a load test rather than reasoning about interleavings alone.
  • Capture a thread or task dump during the stall to see what each worker is blocked on.
  • Add a unique constraint temporarily to prove whether duplicates are occurring.

The method inside

  1. Map the artifact, actors, boundaries, and invariants relevant to race-condition review.
  2. Trace concrete failure or abuse paths for deadlock analysis; do not report checklist items without a mechanism.
  3. Prioritize task-lifetime safety findings by impact, likelihood, confidence, and cost of correction.
  4. Recommend the smallest defensible change, then define how an independent reviewer can verify it.

Deliverables

  • Race-condition review assessment
  • Deadlock analysis decision and action plan
  • Task-lifetime safety verification checklist

Evidence requirements

  • Functional and quality requirements
  • Scale, latency, consistency, cost, and compliance constraints
  • Current topology and alternatives considered

Quality gates

  • Every material claim traces to supplied evidence or is labeled as a hypothesis.
  • The response follows the declared deliverable contract.
  • No execution, access, measurement, or verification is invented.
  • Secrets and personal data are redacted rather than repeated.
  • The user receives a concrete independent verification step.
  • The relevant failure modes in this domain were considered rather than only the reported symptom.
  • No listed anti-pattern was recommended as a solution.

Example task

Input

Review this in-memory cache refresh code for races when many requests detect expiration simultaneously.

Expected output

Multiple callers start refresh and later overwrite newer values because no version guards publication. Use single-flight per key and compare the generation before replacing shared state...

Boundaries and compatibility

Ideal for

  • Race-condition review: produce a decision or artifact grounded in supplied evidence.
  • Deadlock analysis: produce a decision or artifact grounded in supplied evidence.
  • Task-lifetime safety: produce a decision or artifact grounded in supplied evidence.

Out of scope

  • Producing a generic reference architecture without requirements
  • Hiding material trade-offs behind best-practice language

Agent compatibility

  • GitHub Copilot custom agents
  • Claude Agent Skills / SKILL.md
  • Any instruction-following chat model

Tool policy: Advisory by default. No tools are assumed. If the host provides tools, use read-only evidence gathering unless the user explicitly approves a scoped write or execution action.