m01-ownership

Diagnose and resolve Rust ownership, borrowing, and lifetime errors.

1|Updated May 29, 2026
One-click install
npx skills add https://github.com/simorgh3196/tsuzulint --skill m01-ownership
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: m01-ownership
Source: https://github.com/simorgh3196/tsuzulint/tree/main/.agents/skills/m01-ownership
Command: npx skills add https://github.com/simorgh3196/tsuzulint --skill m01-ownership

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps Rust developers diagnose and resolve ownership, borrowing, and lifetime issues to prevent compile-time errors and runtime bugs.

Core Features & Use Cases

  • Guided ownership patterns: Clarifies when to move, clone, borrow, or use smart pointers to avoid common borrow checker errors.
  • Lifetime reasoning: Explains how to annotate lifetimes and manage data lifespans in APIs and data structures.
  • Practical refactor guidance: Provides actionable strategies to refactor code to satisfy borrow rules in real-world projects.

Quick Start

Use the examples in this Skill to identify and fix common ownership errors in Rust projects.

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 for moved values and complex borrow patterns?

To resolve Rust borrow checker errors, analyze your code to determine whether to move, clone, borrow, or use smart pointers like Rc/Arc. Refactoring complex borrow patterns requires identifying where values are moved and applying safe borrowing strategies to satisfy compile-time constraints.

How do I annotate lifetimes in Rust APIs and data structures?

Annotating lifetimes in Rust APIs involves explicitly specifying how long references remain valid. You manage data lifespans by adding lifetime parameters to function signatures and struct definitions, ensuring references do not outlive their underlying data and preventing dangling pointer errors.

When should I use Rc or Arc instead of borrowing in Rust?

Use Rc or Arc in Rust instead of standard borrowing when you need shared ownership of data across multiple parts of your program. Smart pointers allow multiple owners, whereas borrowing enforces a single owner, making Rc/Arc necessary for complex sharing patterns that violate borrow rules.

What is the best way to refactor Rust code that violates ownership rules?

The best way to refactor Rust code violating ownership rules is to apply guided ownership patterns: clarify when to move, clone, or borrow values. Implement concrete design decisions by enforcing safe patterns and using explicit lifetimes to resolve structural borrow conflicts.

Why does Rust require explicit lifetimes and how do they prevent runtime bugs?

Rust requires explicit lifetimes to enforce compile-time guarantees that references remain valid, preventing runtime bugs like dangling pointers. By annotating lifetimes, the borrow checker verifies that data lifespans in APIs and data structures are managed safely without memory violations.

Can this analyze Rust projects with complex borrow patterns and guide refactorings?

Yes, it analyzes Rust projects with complex borrow patterns, moved values, and lifetime constraints. It diagnoses ownership issues and describes the functions and tools required to implement concrete refactorings and design decisions for resolving borrow checker errors.