Back to list
spjoshis

rust-ownership

by spjoshis

Modular Claude plugins for agent-based expertise and reusable skills across software development and Agile. Easily extend, share, and automate best practices for modern development.

1🍴 0📅 Dec 30, 2025

SKILL.md


name: rust-ownership description: Master Rust ownership, borrowing, lifetimes, and memory safety. Understand move semantics, references, and zero-cost abstractions.

Rust Ownership System

Master Rust's ownership system for writing safe, efficient, and concurrent code without garbage collection.

Core Concepts

Ownership Rules

  1. Each value has an owner
  2. Only one owner at a time
  3. Value dropped when owner goes out of scope
fn main() {
    let s1 = String::from("hello");
    let s2 = s1; // s1 moved to s2, s1 no longer valid

    println!("{}", s2); // OK
    // println!("{}", s1); // Error: value borrowed after move
}

Borrowing

fn main() {
    let s1 = String::from("hello");

    let len = calculate_length(&s1); // Borrow s1

    println!("Length of '{}' is {}", s1, len); // s1 still valid
}

fn calculate_length(s: &String) -> usize {
    s.len()
} // s goes out of scope but nothing happens (doesn't own the data)

Mutable References

fn main() {
    let mut s = String::from("hello");

    change(&mut s);

    println!("{}", s); // "hello, world"
}

fn change(s: &mut String) {
    s.push_str(", world");
}

Lifetimes

fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
    if x.len() > y.len() {
        x
    } else {
        y
    }
}

Best Practices

  1. Prefer borrowing over ownership transfer
  2. Use mutable references sparingly
  3. Understand lifetime elision rules
  4. Use smart pointers (Box, Rc, Arc) when needed
  5. Leverage the borrow checker

Resources

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新

+5
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

0/5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon