This triggers automatically on Rust ownership errors like E0382 or E0597 and pushes you to ask design questions before reaching for clone(). Instead of just fixing the compiler error, it maps each error code to a fundamental question: who should own this data, is the scope boundary right, should mutation happen elsewhere. The trace up/trace down framework is smart, connecting ownership issues to domain modeling (m09) or resource patterns (m02) when quick fixes fail three times. Best part is the error-to-design-question table that reframes "borrowed value does not live long enough" as "is the scope boundary correct?" It won't teach you ownership from scratch, but it will stop you from cargo cult cloning everything.

skills.sh installs
3.6K
GitHub stars
1.6K
last updated
Aug 21, 2026

Install

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

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/actionbook/rust-skills
Category
Rust
First seen
May 16, 2026

More from actionbook/rust-skills

All 38

Recommended

More Rust
1mohitmishra786 avatarrust-unsafemohitmishra786/low-level-dev-skillsRust unsafe code skill for systems programming. Use when writing or reviewing unsafe Rust, understanding what operations require unsafe, implementing safe abstr611skills.sh installs
2leonardomso avatarrust-skillsleonardomso/rust-skillsComprehensive Rust coding guidelines with 265 rules across 26 categories. Use when writing, reviewing, or refactoring Rust code. Covers ownership, error handlin7Kskills.sh installs
3jeffallan avatarrust-engineerjeffallan/claude-skillsWrites, reviews, and debugs idiomatic Rust code with memory safety and zero-cost abstractions. Implements ownership patterns, manages lifetimes, designs trait h6.7Kskills.sh installs
4actionbook avatarrust-learneractionbook/rust-skillsUse when asking about Rust versions or crate info. Keywords: latest version, what's new, changelog, Rust 1.x, Rust release, stable, nightly, crate info, crates.3.3Kskills.sh installs
5actionbook avatarrust-skill-creatoractionbook/rust-skillsUse when creating skills for Rust crates or std library documentation. Keywords: create rust skill, create crate skill, create std skill, 创建 rust skill, 创建 crat3.3Kskills.sh installs
6actionbook avatarrust-routeractionbook/rust-skillsCRITICAL: Use for ALL Rust questions including errors, design, and coding. HIGHEST PRIORITY for: 比较, 对比, compare, vs, versus, 区别, difference, 最佳实践, best practic2.9Kskills.sh installs