m01-ownership

Diagnose Rust borrow-checker errors and design lifetime-safe structs.

3|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/0xharryriddle/codex-field-kit --skill m01-ownership-0xharryriddle
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m01-ownership
Source: https://github.com/0xharryriddle/codex-field-kit/tree/main/archive/upstream/chasebuild-agent-skills/rust/skills/m01-ownership
Command: npx skills add https://github.com/0xharryriddle/codex-field-kit --skill m01-ownership-0xharryriddle

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The Skill helps engineers understand, diagnose, and fix Rust ownership and lifetime issues by mapping compiler errors to actionable design decisions and safe patterns.

Core Features & Use Cases

  • Diagnose common Rust ownership and borrowing errors (E0382, E0597, E0506, E0507, E0515, E0716, E0106) and guide fixes.
  • Provide decision-making guidance on when to move, clone, borrow, or share data, and how to design lifetime-safe APIs and structs.
  • Real-world use: refactor code that moves values or returns references from short-lived scopes into robust ownership boundaries.

Quick Start

Scan a Rust project for ownership and lifetime issues and output a prioritized, actionable fix plan.

Frequently Asked Questions about m01-ownership

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

FAQPage Schema
How do I fix Rust borrow-checker errors like E0382 and E0597?

Rust borrow-checker errors like E0382 and E0597 are fixed by mapping the compiler diagnostics to ownership design decisions, tracing whether values should be moved, cloned, or borrowed to establish safe lifetime boundaries.

When do I need to use explicit lifetimes in Rust structs?

Explicit lifetimes in Rust structs are needed when storing references to data owned by another scope, ensuring the referenced data outlives the struct to satisfy the borrow-checker and maintain memory safety.

What is the best way to decide between moving, cloning, or borrowing data in Rust?

Deciding between moving, cloning, or borrowing data in Rust depends on ownership boundaries: move transfers ownership for exclusive access, clone duplicates data for independent lifetimes, and borrow provides temporary access without ownership transfer.

How do I resolve Rust error E0507 when trying to modify a borrowed value?

Resolving Rust error E0507 involves changing the borrowing strategy, typically by mutating the original owner directly, using mutable borrows, or restructuring data ownership to allow safe modification without moving borrowed content.

Why does my Rust function fail to return a reference from a local scope?

A Rust function fails to return a reference from a local scope because the local variable is dropped at the end of the scope, violating lifetime rules; you must either return owned data or pass references with adequate lifetimes into the function.

Can I scan an entire Rust project for ownership and lifetime issues automatically?

Yes, you can scan a Rust project for ownership and lifetime issues to output a prioritized, actionable fix plan, diagnosing common borrowing errors and guiding safe lifetime boundary designs across the codebase.