ownership-borrowing

ownership-borrowing is a skill for Claude Code from VersoXBT/claude-initial-setup. It costs 63 tokens per session (1,836 once invoked), scanned A, original, MIT.

A guide to Rust ownership, borrowing, lifetimes, and smart pointers. These are the rules Rust uses to manage memory safely without a garbage collector.

In plain words
What is it for?
Use it when working with references, lifetime annotations, move semantics, or pointers such as Box, Rc, and Arc.
Why use it?
It helps explain borrow-checker errors and clarifies when data is moved, borrowed, copied, cloned, or shared.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-initial-setup plugin — 75 skills, 15 commands, 14 agents, 2 hooks shipped together

Good fit Use it when working with references, lifetime annotations, move semantics, or pointers such as Box, Rc, and Arc.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/versoxbt/claude-initial-setup/ownership-borrowing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add VersoXBT/claude-initial-setup --skill ownership-borrowing
Clone the repo
git clone --depth 1 https://github.com/VersoXBT/claude-initial-setup

Made for: Claude Code.

Or install claude-initial-setup, the plugin that ships this one along with the rest of its 75 skills, 15 commands, 14 agents, 2 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ownership-borrowing

README.md
[![agentmods](https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/ownership-borrowing/github.svg)](https://agentmods.dev/skills/versoxbt/claude-initial-setup/ownership-borrowing)
Your own site
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/ownership-borrowing"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/ownership-borrowing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ownership-borrowing

Your own site · 80×15
<a href="https://agentmods.dev/skills/versoxbt/claude-initial-setup/ownership-borrowing"><img src="https://agentmods.dev/badge/skills/versoxbt/claude-initial-setup/ownership-borrowing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,836 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.01836
Opus 5 $0.00032 $0.00918
Sonnet 5 $0.00013 $0.00367
Haiku 4.5 $0.00006 $0.00184

Measured 7d ago against content hash 33cbfe797197, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

ownership-borrowing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/rust/ownership-borrowing/SKILL.md · 244 lines

How it starts

The opening of the file, as written. The whole thing — 244 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rust Ownership and Borrowing

Understand and apply Rust's ownership system to write memory-safe code without a garbage collector. Master borrowing rules, lifetimes, and smart pointers.

When to Use

  • Encountering borrow checker errors ("cannot borrow as mutable")
  • Deciding between references, cloning, and moving
  • Adding lifetime annotations to structs or functions
  • Choosing between Box, Rc, Arc for heap allocation and sharing
  • Understanding when to derive Clone vs Copy

Core Patterns

Pattern 1: Ownership Rules

Three rules govern all Rust memory:

  1. Each value has exactly one owner.
  2. When the owner goes out of scope, the value is dropped.
  3. Ownership can be transferred (moved) but not duplicated (unless Copy).
fn main() {
    let name = String::from("Alice"); // name owns the String
    let greeting = greet(name);       // ownership moves to greet
    // println!("{name}");            // ERROR: name was moved
    println!("{greeting}");
}

fn greet(name: String) -> String {    // takes ownership
    format!("Hello, {name}!")         // returns a new owned String
}

Pattern 2: Borrowing -- Shared and Mutable References

Borrow data without taking ownership. Two rules:

  • Any number of shared references (&T) OR exactly one mutable reference (&mut T).
  • References must always be valid (no dangling pointers).
fn analyze(data: &[i32]) -> (i32, i32) {
    // Shared borrow: can read, cannot modify
    let sum: i32 = data.iter().sum();
    let count = data.len() as i32;
    (sum, count)
}

fn normalize(data: &mut Vec<f64>) {
    // Mutable borrow: can read and modify
    let max = data.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
    if max != 0.0 {
        for val in data.iter_mut() {
            *val /= max;
        }
    }
}

fn main() {
    let mut values = vec![1.0, 2.0, 3.0];
    normalize(&mut values);     // mutable borrow
    let (sum, _) = analyze(&[1, 2, 3]); // shared borrow
    println!("{sum}");
}

Pattern 3: Lifetimes

Read the full file on GitHub · 244 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 244 lines · 63 tokens per session scan A 33cbfe797197

Subscribe to this mod's changes

ownership-borrowing is a skill published in the GitHub repository VersoXBT/claude-initial-setup (4 stars, last pushed 4mo ago), licensed MIT. It adds 63 tokens to every session and 1,836 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

sota-rust

State-of-the-art Rust engineering (2026) for writing and auditing Rust code. Covers idiomatic ownership and API design, error handling and panic policy, unsafe discipline with Miri, async/tokio (cancellation safety, structured concurrency, graceful shutdown), security and supply chain (cargo audit/deny/vet, integer…

martinholovsky/SOTA-skills · 199 tokens

implement

Use in the Implement phase whenever writing or editing production Java code, or fixing a bug, in a Spring/Spring Boot project. Enforces test-first (red-green-refactor), executes the approved plan step by step, and honors the project's path-scoped tech-stack rules and the task's enforcement set. Preloaded into…

taipt1504/claudehut · 73 tokens

claudehut-workflow

Use at the start of every session and whenever beginning a coding task in a Java/Spring backend - establishes the ClaudeHut 7-phase agentic workflow, the complexity-tier routing that lets small tasks skip deliberation phases, and the laws that govern which skills and rules must fire. Injected at session start; also…

taipt1504/claudehut · 86 tokens

rust_expert

Systems programming with Rust. Ownership, borrowing, lifetimes, and safety patterns.

ApexIQ/skillsmith · 20 tokens

temporal-python-testing

Test Temporal workflows with pytest, time-skipping, and mocking strategies. Covers unit testing, integration testing, replay testing, and local development setup. Use when implementing Temporal workflow tests or debugging test failures.

wshobson/agents · 45 tokens

rust-patterns

Rust: ownership, lifetimes, async (Tokio), Result/anyhow/thiserror, traits, unsafe. Triggers: Rust, borrow checker, lifetime, Tokio, cargo, trait, impl, Result, unsafe, clippy.

softspark/ai-toolkit · 53 tokens