m07-concurrency

Diagnose Rust Send/Sync violations and design safe multi-threaded solutions.

1.4k|110|Updated Jan 17, 2026
One-click install
npx skills add https://github.com/actionbook/rust-skills --skill m07-concurrency-actionbook
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m07-concurrency
Source: https://github.com/actionbook/rust-skills/tree/main/skills/m07-concurrency
Command: npx skills add https://github.com/actionbook/rust-skills --skill m07-concurrency-actionbook

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps Rust developers diagnose concurrency errors and design correct multi-threaded solutions.

Core Features & Use Cases

  • Pattern selection: Arc<T>, Mutex<T>, RwLock<T>, channels, and atomic types to satisfy Send/Sync requirements.
  • Error diagnosis: identify E0277 and related Send/Sync violations in Web, CLI, or data-processing contexts, and propose fixes.
  • Architecture guidance: trace domain constraints and propose safe concurrency designs with appropriate task models (threads vs async).

Quick Start

Analyze a type that cannot be sent between threads and propose a safe Arc-based design.

Frequently Asked Questions about m07-concurrency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Rust code throw a Send or Sync error when sharing types across threads?

Send or Sync errors occur because a type contains non-thread-safe components. This skill diagnoses concurrency violations and proposes safe designs using Arc, Mutex, or RwLock to satisfy compiler requirements.

How do I choose between Arc and Rc for multi-threaded Rust applications?

Use Arc for thread-safe reference counting and Rc for single-threaded contexts. This skill analyzes types and selects correct concurrency patterns like Arc<T> to safely share data across threads.

When should I use async runtime instead of OS threads for Rust concurrency?

Choose async for I/O-bound workloads and threads for CPU-bound tasks. This skill provides architecture guidance to trace domain constraints and select appropriate task models based on workload.

What is the best way to prevent deadlocks when using Mutex in Rust?

Prevent deadlocks by ensuring correct lock scoping and avoiding holding multiple locks simultaneously. This skill enforces practical requirements for safe lock usage and correct multi-threaded design.

Can I use channels instead of Mutex for Rust concurrency?

Yes, channels enable message passing to avoid shared state. This skill covers channels alongside atomic types and locks, helping select appropriate concurrency patterns for specific use cases.

How do I fix E0277 Send/Sync violations in Rust Web services?

Fix E0277 violations by wrapping non-Send types in thread-safe constructs. This skill identifies these errors in Web, CLI, or data-processing contexts and proposes safe Arc-based designs to resolve them.