Rust Mutability
Interior mutability expert covering Cell, RefCell, Mutex, RwLock patterns, borrow conflicts (E0596, E0499, E0502), and thread-safe mutation strategies.
Install
npx skills add huiali/rust-skills --skill rust-mutabilitygit clone --depth 1 https://github.com/huiali/rust-skills.git /tmp/rust-skills
mkdir -p ~/.claude/skills
cp -r /tmp/rust-skills/.codex/skills/rust-mutability ~/.claude/skills/rust-mutabilityPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
## Mutability Types
| Type | Controller | Thread-Safe | Use Case |
|------|------------|-------------|----------|
| `&mut T` | External caller | Yes | Standard mutable borrow |
| `Cell<T>` | Interior | No | Copy types with interior mutability |
| `RefCell<T>` | Interior | No | Non-Copy types with interior mutability |
| `Mutex<T>` | Interior | Yes | Multi-threaded interior mutability |
| `RwLock<T>` | Interior | Yes | Multi-threaded read-write lock |
## Solution Patterns
### Pattern 1: External Mutability
```rust
// Standard mutable borrow
fn increment(counter: &mut u32) {
*counter += 1;
}
// Mutable method
impl Counter {
fn increment(&mut self) {
self.value += 1;
}
}
```
**When to use**: Default choice, mutability controlled by caller.
### Pattern 2: Cell for Copy Types
```rust
use std::cell::Cell;
struct State {
count: Cell<u32>,
}
impl State {
// Get immutable &self, mutate interior
fn increment(&self) {
self.count.set(self.count.get() + 1);
}
}
```
**When to use**: Simple values (Copy types) need interior mutability.
**Trade-offs**: Only works with Copy types, no references.
### Pattern 3: RefCell for Non-Copy TypesDetails
- Skill name
rust-mutability- Repository
- huiali/rust-skills
- Path
.codex/skills/rust-mutability/SKILL.md- License
- MIT
- Repo updated
- 9 February 2026
FAQ
What does the Rust Mutability skill do?
Interior mutability expert covering Cell, RefCell, Mutex, RwLock patterns, borrow conflicts (E0596, E0499, E0502), and thread-safe mutation strategies.
How do I install the Rust Mutability skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add huiali/rust-skills --skill rust-mutability. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Rust Mutability popular?
It lives in huiali/rust-skills, which has 49 GitHub stars and 7 forks.
Related skills
Rust Actor
49huiali/rust-skills
Actor model expert covering message passing, state isolation, supervision trees, deadlock prevention, fault tolerance, Actix framework, and Erlang-style concurrency patterns.
Rust Anti Pattern
49huiali/rust-skills
Rust anti-patterns and common mistakes expert. Handles code review issues with clone abuse, unwrap in production, String misuse, index loops, and refactoring guidance.
Rust Async
49huiali/rust-skills
Advanced async patterns expert. Handles Stream processing, backpressure control, select/join operations, cancellation, Future trait implementation, and async runtime optimization.
Rust Ownership
49huiali/rust-skills
Ownership, borrowing, and lifetime expert. Handles compiler errors E0382, E0597, E0506, E0507, E0515, E0716, E0106 and provides systematic solutions for memory safety patterns.
Rust Middleware
49huiali/rust-skills
Web middleware expert covering request tracking, CORS configuration, rate limiting, authentication guards, compression, and middleware composition patterns.
Rust Performance
49huiali/rust-skills
Performance optimization expert covering profiling, benchmarking, memory allocation, SIMD, cache optimization, false sharing, lock contention, and NUMA-aware programming.
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.