rust-concurrency

rust-concurrency is a skill for Claude Code, Codex from heyAyushh/stacc. It costs 40 tokens per session (987 once invoked), scanned A, original, MIT.

A guide to choosing between threads, asynchronous code, and shared-state tools in Rust based on the kind of work and data sharing involved.

In plain words
What is it for?
Use it when handling CPU-heavy or input/output-heavy work, fixing Send or Sync errors, sharing state, or investigating deadlocks.
Why use it?
It helps prevent unsuitable concurrency designs, thread-safety errors, and deadlocks—situations where tasks wait indefinitely for each other.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when handling CPU-heavy or input/output-heavy work, fixing Send or Sync errors, sharing state, or investigating deadlocks.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/heyayushh/stacc/concurrency
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 heyAyushh/stacc --skill concurrency
Clone the repo
git clone --depth 1 https://github.com/heyAyushh/stacc

Made for: Claude Code, Codex.

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 rust-concurrency

README.md
[![agentmods](https://agentmods.dev/badge/skills/heyayushh/stacc/concurrency/github.svg)](https://agentmods.dev/skills/heyayushh/stacc/concurrency)
Your own site
<a href="https://agentmods.dev/skills/heyayushh/stacc/concurrency"><img src="https://agentmods.dev/badge/skills/heyayushh/stacc/concurrency/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 rust-concurrency

Your own site · 80×15
<a href="https://agentmods.dev/skills/heyayushh/stacc/concurrency"><img src="https://agentmods.dev/badge/skills/heyayushh/stacc/concurrency.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 987 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.00040 $0.00987
Opus 5 $0.00020 $0.00494
Sonnet 5 $0.00008 $0.00197
Haiku 4.5 $0.00004 $0.00099

Measured 9d ago against content hash ec615ca8787c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

rust-concurrency 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 9d 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.

configs/stacks/rust/concurrency/SKILL.md · 145 lines

How it starts

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

Concurrency

Layer 1: Language Mechanics

Core Question

Is this CPU-bound or I/O-bound, and what's the sharing model?

Before choosing concurrency primitives:

  • What's the workload type?
  • What data needs to be shared?
  • What's the thread safety requirement?

Thinking Prompt

Before adding concurrency:

  1. What's the workload?

    • CPU-bound → threads (std::thread, rayon)
    • I/O-bound → async (tokio, async-std)
    • Mixed → hybrid approach
  2. What's the sharing model?

    • No sharing → message passing (channels)
    • Immutable sharing → Arc<T>
    • Mutable sharing → Arc<Mutex<T>> or Arc<RwLock<T>>
  3. What are the Send/Sync requirements?

    • Cross-thread ownership → Send
    • Cross-thread references → Sync
    • Single-thread async → spawn_local

Decision Flowchart

What type of work?
├─ CPU-bound → std::thread or rayon
├─ I/O-bound → async/await
└─ Mixed → hybrid (spawn_blocking)

Need to share data?
├─ No → message passing (channels)
├─ Immutable → Arc<T>
└─ Mutable →
   ├─ Read-heavy → Arc<RwLock<T>>
   └─ Write-heavy → Arc<Mutex<T>>
   └─ Simple counter → AtomicUsize

Async context?
├─ Type is Send → tokio::spawn
├─ Type is !Send → spawn_local
└─ Blocking code → spawn_blocking

Send/Sync Markers

Marker Meaning Example
Send Can transfer ownership between threads Most types
Sync Can share references between threads Arc<T>
!Send Must stay on one thread Rc<T>
!Sync No shared refs across threads RefCell<T>

Quick Reference

Pattern Thread-Safe Blocking Use When
std::thread Yes Yes CPU-bound parallelism
async/await Yes No I/O-bound concurrency
Mutex<T> Yes Yes Shared mutable state
RwLock<T> Yes Yes Read-heavy shared state
mpsc::channel Yes Optional Message passing
Arc<Mutex<T>> Yes Yes Shared mutable across threads

Read the full file on GitHub · 145 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. 9d ago First seen · 145 lines · 40 tokens per session scan A ec615ca8787c

Subscribe to this mod's changes

rust-concurrency is a skill published in the GitHub repository heyAyushh/stacc (3 stars, last pushed 2mo ago), licensed MIT. It adds 40 tokens to every session and 987 once invoked, about $0.0002 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-03.

Related

Other skills, from other repositories

rust-check

Run cargo check on the current Rust project to find compile errors.

Hmbown/CodeWhale · 15 tokens

stack-trace-rust-probe

Internal helper for meta-stack-trace-investigator. Use when a Rust panic or backtrace needs Rust-specific Result/Option checks, cargo test guidance, and patch targets.

opensquilla/opensquilla · 42 tokens

hotpath_init

Configure hotpath profiling in a Rust project. Adds the hotpath dependency with feature-gated setup, instruments main with hotpath::main, functions with measure/measureall, and wraps channels, mutexes, rwlocks, streams, futures, reqwest clients, axum routers and byte-level I/O with hotpath macros. Use when the user…

pawurb/hotpath-rs · 88 tokens

clickhouse-rust-type-mismatches

Fix ClickHouse query errors in Rust when using clickhouse-rs crate. Use when: (1) "string is not valid utf8" errors - typically FixedString columns need CAST to String, (2) "tag for enum is not valid" errors - typically Option fields receiving non-NULL values, (3) Sum/count aggregations returning Float64 but Rust…

divinevideo/divine-mobile · 280 tokens

fastly-compute-rust-edition2024-fix

Fix Fastly Compute Rust build failures caused by edition2024 dependencies. Use when: (1) cargo build fails with "feature edition2024 is required", (2) wit-bindgen or wasip2 crates fail to download/parse, (3) Fastly SDK pulls in incompatible transitive dependencies, (4) Build worked before but fails after dependency…

divinevideo/divine-mobile · 116 tokens

memory-safety-patterns

Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C. Use when writing safe systems code, managing resources, or preventing memory bugs.

rmyndharis/antigravity-skills · 45 tokens