m01-ownership

Diagnose Rust ownership, borrowing, and lifetime errors with layered analysis.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers reason about Rust ownership, borrowing, and lifetimes to diagnose and fix common compiler errors by applying a layered cognitive approach that clarifies data ownership and scope.

Core Features & Use Cases

  • Guided thinking prompts to map data ownership, lifetime requirements, and sharing needs.
  • Pattern-driven guidance for using Arc/Rc, references, and move semantics across modules.
  • Practical examples and anti-patterns for ownership design in APIs, data structures, and wrappers.

Quick Start

Start by presenting a failing Rust function or module that triggers ownership-related errors and ask the AI to walk through the layered reasoning to identify ownership boundaries and appropriate fixes.

Frequently Asked Questions about m01-ownership

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

FAQPage Schema
Why does my Rust code fail to compile with borrow checker errors like E0382?

Rust borrow checker errors like E0382 occur when ownership and borrowing rules are violated. This skill guides a layered analysis of data ownership to map lifetime requirements and identify fixes for move-out issues without runtime changes.

How do I fix E0597 lifetime errors in Rust structs and APIs?

To fix E0597 lifetime errors, you must add explicit lifetime annotations to your Rust structs and APIs. This skill provides pattern-driven guidance for enforcing lifetime constraints and resolving scope mismatches across modules.

What is the best way to share data across Rust threads without triggering ownership errors?

The best way to share data across Rust modules while satisfying the borrow checker is using Arc or Rc wrappers. This skill provides anti-patterns and practical examples for proper sharing via Arc/Rc and references.

How do I resolve Rust move semantics issues in my functions?

Resolving Rust move semantics issues requires using borrowing where possible instead of transferring ownership. This skill helps you walk through layered reasoning to identify ownership boundaries and apply appropriate fixes across functions.

When do I need explicit lifetime annotations in Rust?

You need explicit lifetime annotations in Rust when the compiler cannot infer the relationships between references, often in structs and APIs. This skill helps diagnose these constraints and enforces proper annotations to resolve errors.