agentleFS
codebygarvcodebygarv/Ai-skills/skills/development/concurrency-race-detector/SKILL.md

concurrency-race-detector

Skill26 starsChanged 4 months agoMITView on GitHub

Identifies race conditions, mutex contention, unsafe shared state, and deadlocks in concurrent and async code.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When debugging intermittent bugs that only reproduce under high concurrency or specific network latency.

    line 12
  2. Very specific:

    Database Transaction Isolation: Check for lost updates or phantom reads under READ COMMITTED isolation.

    line 22

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Purpose

Detect and resolve concurrency vulnerabilities, shared-state data races, asynchronous interleaving bugs, lock inversion deadlocks, and missed synchronization in multi-threaded or async event-loop environments.

When to Use

  • When debugging intermittent bugs that only reproduce under high concurrency or specific network latency.
  • Reviewing shared in-memory caches, counter updates, or distributed lock implementations.
  • Writing Go goroutines, Rust async/tokio, Java threads, or Node.js async operations with shared references.

What to Analyze

  1. Shared Mutable State: Find variables, collections, or files accessed concurrently without atomics or locks.
  2. Check-Then-Act Flaws (TOCTOU): Inspect code where state is checked, and acted upon in separate non-atomic operations.
  3. Lock Ordering & Deadlocks: Trace acquisition order of multiple mutexes across threads.
  4. Node.js Event Loop Interleaving: Identify await calls between reading and writing shared object properties.
  5. Database Transaction Isolation: Check for lost updates or phantom reads under READ COMMITTED isolation.

Output Format

  • Vulnerability Breakdown: Exact line references and the failing execution trace interleaving.
  • Reproduction Scenario: Sequence diagram or step-by-step thread execution trace showing the race.
  • Remediation Code: Thread-safe refactoring using atomic primitives, locks, mutexes, or immutability.
  • Verification Strategy: Stress test script / race detector command (e.g. go test -race).

Avoid

  • Assuming single-threaded JavaScript runtimes are immune to async race conditions across await boundaries.
  • Suggesting coarse global locks that kill multi-core throughput.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.