The m01-ownership skill diagnoses and resolves Rust ownership, borrowing, and lifetime errors by guiding developers to understand data ownership requirements rather than applying quick fixes. It serves Rust developers encountering errors like E0382, E0597, and E0506 by providing a systematic thinking process that traces problems to their design roots and determines appropriate patterns like move semantics, references, or shared ownership types. The skill prevents repeated ownership errors by distinguishing between symptom fixes and underlying design issues, escalating to higher-level design skills when patterns persist.

skills.sh installs
809
GitHub stars
1.3K
last updated
Jul 14, 2026

Install

$ npx -y skills add zhanghandong/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/zhanghandong/rust-skills
Category
Rust

More from zhanghandong/rust-skills

All 34

Recommended

More Rust
1mohitmishra786 avatarrust-sanitizers-mirimohitmishra786/low-level-dev-skillsRust sanitizers and Miri skill for memory safety validation. Use when running AddressSanitizer or ThreadSanitizer on Rust code, interpreting sanitizer reports, 604skills.sh installs
2manutej avatarrust-systems-programmingmanutej/luxor-claude-marketplaceComplete guide for Rust systems programming including ownership, borrowing, concurrency, async programming, unsafe code, and performance optimization488skills.sh installs
3zzci avatarpma-rustzzci/skillsProduction-grade Rust acceptance baseline for PMA-managed Rust services and CLIs. Use with /pma when creating, reviewing, or upgrading Rust workspaces, Axum/Tok372skills.sh installs
4dchuk avatarintegrating-tauri-rust-frontendsdchuk/claude-code-tauri-skillsGuides the user through integrating Rust-based WASM frontend frameworks with Tauri v2, covering Leptos and Trunk setup, WASM compilation configuration, Cargo.to248skills.sh installs
5actionbook avatarunsafe-checkeractionbook/rust-skillsCRITICAL: Use for unsafe Rust code review and FFI. Triggers on: unsafe, raw pointer, FFI, extern, transmute, *mut, *const, union, #[repr(C)], libc, std::ffi, Ma3.5Kskills.sh installs
6zhanghandong avatarunsafe-checkerzhanghandong/rust-skillsunsafe checker726skills.sh installs