detecting-race-conditions

detecting-race-conditions is a skill for Claude Code from UnboundCompute/security-agent-skills. It costs 133 tokens per session (1,396 once invoked), scanned A, original, MIT.

A method for finding race conditions in concurrent software, where the result can change depending on the order in which operations overlap. It covers shared state, check-then-act bugs, and time-of-check to time-of-use gaps.

In plain words
What is it for?
Use it to inspect multithreaded, asynchronous, or multiprocess code and shared databases, caches, files, counters, or maps for unsafe interleavings and stale checks.
Why use it?
These bugs often do not appear in one line of code and can be missed by ordinary searches. The method helps determine whether a harmful ordering of operations is actually possible, using only an authorized source target.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the security-agent-skills plugin — 194 skills shipped together

Good fit Use it to inspect multithreaded, asynchronous, or multiprocess code and shared databases, caches, files, counters, or maps for unsafe interleavings and stale checks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/unboundcompute/security-agent-skills/detecting-race-conditions
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add UnboundCompute/security-agent-skills --skill detecting-race-conditions
Clone the repo
git clone --depth 1 https://github.com/UnboundCompute/security-agent-skills

Made for: Claude Code.

Or install security-agent-skills, the plugin that ships this one along with the rest of its 194 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for detecting-race-conditions

README.md
[![agentmods](https://agentmods.dev/badge/skills/unboundcompute/security-agent-skills/detecting-race-conditions/github.svg)](https://agentmods.dev/skills/unboundcompute/security-agent-skills/detecting-race-conditions)
Your own site
<a href="https://agentmods.dev/skills/unboundcompute/security-agent-skills/detecting-race-conditions"><img src="https://agentmods.dev/badge/skills/unboundcompute/security-agent-skills/detecting-race-conditions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for detecting-race-conditions

Your own site · 80×15
<a href="https://agentmods.dev/skills/unboundcompute/security-agent-skills/detecting-race-conditions"><img src="https://agentmods.dev/badge/skills/unboundcompute/security-agent-skills/detecting-race-conditions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 133 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,396 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00133 $0.01396
Opus 5 $0.00067 $0.00698
Sonnet 5 $0.00027 $0.00279
Haiku 4.5 $0.00013 $0.00140

Measured 6d ago against content hash 847e5e6b7256, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

detecting-race-conditions scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/detecting-race-conditions/SKILL.md · 113 lines

How it starts

The opening of the file, as written. The whole thing — 113 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Detecting race conditions

Race bugs don't live in one line - they live in the gap between two operations that another actor can slip through. There's no tainted value to trace and no single sink to grep; you find them by asking what state is shared, what runs concurrently, and where a window opens between deciding something and acting on it. This skill covers the recurring shapes and how to confirm a real window.

When to use

  • Multithreaded / async / multiprocess code, or a shared resource (DB row, cache, counter, file, in-memory map) touched by concurrent requests.
  • A "check then act" sequence where the check's truth can expire before the act: balance/quota checks, auth-then-use, uniqueness/dedup guards, file existence checks, one-time tokens.

Scope check

Authorized source only. If you can't name the authorization, stop.

The shapes and how to confirm each

Confirmation of a race is an interleaving witness: two concrete operation orders where one is safe and the other, achievable by an attacker, is not.

  1. TOCTOU (time-of-check to time-of-use). State is validated, then used, and it can change in between. Classic filesystem form: access(path) / stat(path) then open(path) - a symlink swap in the window redirects the open. General form: any check(x); … ; use(x) where x (or what it names) is mutable by another actor in the gap. Confirm: identify the shared thing, show a writer that can change it between check and use.

  2. Check-then-act on shared state without atomicity. "If not exists, create"; "if balance ≥ n, deduct n"; "if not already redeemed, redeem." Two requests both pass the check before either acts → double-spend, duplicate creation, coupon reuse. Confirm: two concurrent runs both read the pre-act value; neither the read+act is atomic (no transaction, lock, SELECT … FOR UPDATE, compare- and-swap, or unique constraint).

  3. Unsynchronized shared mutable state. A field/map/counter read and written by multiple threads with no lock/atomic. Confirm: two threads reach the same memory, at least one writes, no happens-before relationship (no shared lock, no atomic, no ownership handoff) orders them.

Read the full file on GitHub · 113 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 113 lines · 133 tokens per session scan A 847e5e6b7256

Subscribe to this mod's changes

detecting-race-conditions is a skill published in the GitHub repository UnboundCompute/security-agent-skills (5 stars, last pushed 3d ago), licensed MIT. It adds 133 tokens to every session and 1,396 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.

Related

Other skills, from other repositories

ffuf-claude-skill

Skill "ffuf-claude-skill" from Agent-Threat-Rule/agent-threat-rules, covering ffuf claude skill, when to use this skill and instructions.

Agent-Threat-Rule/agent-threat-rules · 14 tokens

codeinspectus-fix-one

Investigate and remediate exactly one user-selected CodeInspectus finding with evidence-gated reproduction, a separately approved minimal patch, focused regression testing, and an exact-prior-scan rescan. Use when a user asks an agent to examine, reproduce, fix, or verify one CodeInspectus finding without batching…

Synvoya/codeinspectus · 76 tokens

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

KalarisLabs/Skill-Doctor · 21 tokens

gauntlex:doctor

Full GAUNTLEX environment health check — model reachable, ChromaDB writable, AVF fixtures pass, no unexpected outbound network (air-gap verification). Use before first run or when debugging failures.

sanjoy1234/gauntlex · 45 tokens

prodcheck-review

Review this codebase against the prodcheck pre-production checklists — security, performance, scale, integrations and post-launch readiness. Use when asked to check whether a project is ready to ship, to audit an area before launch, or to work through a specific checklist. Produces evidence with file:line citations…

FarzamHabibi/pre-production-checklist · 70 tokens

diagnose-bundle

Maintainer/dev skill that triages an anonymised diagnostic bundle (appsec-diag-.tgz, produced by scripts/diagnosticbundle.py) a user sent after a pipeline failure. Runs the deterministic inspect, then cross-references the plugin source (scripts/, compact runtimes, agents/, AGENTS.md) and known-bug history to produce a…

appsec-foundry/appsec-advisor · 96 tokens