Rust ownership and lifetime error guide that maps compiler codes to design questions before quick fixes.

skills.sh installs
3.7K
GitHub stars
1.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers ownership, borrowing, and lifetime errors E0382, E0597, E0506, E0507, E0515, E0716, and E0106
  • Includes an error-to-design-question table, a thinking prompt, and a quick-reference of move, borrow, clone, Rc, Arc, and Cow patterns
  • Guides escalation to smart pointers, interior mutability, or domain modeling when the same error persists after repeated fixes
  • Designed for Rust developers who hit borrow checker errors and want to fix the underlying design rather than just clone

Install

$ npx -y skills add actionbook/rust-skills --skill m01-ownership -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Ownership & Lifetimes

Layer 1: Language Mechanics

Core Question

Who should own this data, and for how long?

Before fixing ownership errors, understand the data's role:

  • Is it shared or exclusive?
  • Is it short-lived or long-lived?
  • Is it transformed or just read?

Error → Design Question

ErrorDon't Just SayAsk Instead
E0382"Clone it"Who should own this data?
E0597"Extend lifetime"Is the scope boundary correct?
E0506"End borrow first"Should mutation happen elsewhere?
E0507"Clone before move"Why are we moving from a reference?
E0515"Return owned"Should caller own the data?
E0716"Bind to variable"Why is this temporary?
E0106"Add 'a"What is the actual lifetime relationship?

Thinking Prompt

Before fixing an ownership error, ask:

  1. What is this data's domain role?
    • Entity (unique identity) → owned
    • Value Object (interchangeable) → clone/copy OK
    • Temporary (computation result) → maybe restructure

Details

Repository
github.com/actionbook/rust-skills
Categories
Rust, Learning & Teaching
First seen
May 16, 2026

More from actionbook/rust-skills

All 38

Similar to M01 Ownership

More Rust