# m01-ownership

Guides AI agents through Rust ownership and lifetime errors without spraying .clone() calls across the codebase.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 3400 installs · ★ 1545
- Author: actionbook
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/actionbook/rust-skills/tree/HEAD/skills/m01-ownership/SKILL.md
- Updated: 2026-08-23
- HTML: https://affpapa.org/en/nevibecode/skills/m01-ownership

## What it does

The skill instructs coding agents on handling Rust borrow checker failures such as `E0382`, `E0597`, or `E0506`. Rather than slapping `.clone()` on every moved variable or pinning `'static` everywhere, the agent investigates who should hold the data. It analyzes scope boundaries and reference lifetimes first.

Its internal prompt framework maps compiler diagnostic codes directly to architectural questions. It distinguishes between data entities with dedicated identities, interchangeable value objects, and temporary values. If three consecutive fixes fail, the skill directs the agent to rethink data ownership instead of repeating compiler workarounds.

Scattering `.clone()` across functions masks architectural flaws and adds heap allocations. This skill forces the assistant to respect Rust borrow semantics before touching memory buffers.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m01-ownership -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/m01-ownership/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/m01-ownership/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m01-ownership -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/m01-ownership/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m01-ownership -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/m01-ownership/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install actionbook/rust-skills m01-ownership
```

2. **Manually: put the files in place**
- File: `.github/skills/m01-ownership/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m01-ownership -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/actionbook/rust-skills --path skills/m01-ownership
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/m01-ownership/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill m01-ownership -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/actionbook/rust-skills/tree/HEAD/skills/m01-ownership/SKILL.md

## When to use it
- resolve `E0382` moved value errors without wasteful heap cloning
- fix lifetime scope mismatches like `E0597` and `E0515`
- determine when to switch from references to `Arc` or `Rc`
- redesign structs and function signatures instead of fighting the borrow checker

## Example prompts
- I got error E0382 on this line, help me fix ownership without cloning
- Why does this reference fail with E0597 here?
- Review this function signature to resolve borrowed value does not live long enough

## Similar
- [migrate-to-shoehorn](https://affpapa.org/en/nevibecode/skills/migrate-to-shoehorn.md) — skill · 475388 installs
- [write-swift](https://affpapa.org/en/nevibecode/skills/write-swift.md) — skill · 119300 installs
- [megacave](https://affpapa.org/en/nevibecode/skills/megacave.md) — skill · 25400 installs
- [find-docs](https://affpapa.org/en/nevibecode/skills/find-docs.md) — skill · 9400 installs
- [typescript-advanced-types](https://affpapa.org/en/nevibecode/skills/typescript-advanced-types.md) — skill · 92169 installs
- [smart-explore](https://affpapa.org/en/nevibecode/skills/smart-explore.md) — skill · 7300 installs

From the same set: [actionbook/rust-skills](https://affpapa.org/en/nevibecode/by/actionbook/rust-skills.md) — 33 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
