m02-resource — Claude Code skill: what it does, how to install
Guides AI agents in choosing the right Rust smart pointers and ownership models. Useful when designing data structures or preventing memory leaks.
npx skills add actionbook/rust-skills --skill m02-resource -a claude-codeWhat m02-resource does
This skill guides coding assistants through Rust resource management. Instead of blindly wrapping types in heap allocations, it forces the agent to inspect the ownership model. The agent checks whether data has a single owner or shared access, runs on one thread or multiple threads, and contains reference cycles.
The skill includes decision flows for mapping errors to design fixes. It directs single-owner heap data to Box, single-threaded shared data to Rc, and cross-thread sharing to Arc. Placing Arc everywhere adds unneeded atomic overhead on hot paths. For interior mutability, it contrasts Cell for copyable types against RefCell and synchronization primitives, while pushing Weak to break reference cycles.
What it helps with
- select between
RcandArcbased on thread requirements - resolve reference cycles using
Weakpointers - eliminate unnecessary
Boxheap allocations for small types - configure interior mutability without runtime borrow panics
Example prompts for the agent
- Should I use Rc or Arc for this single-threaded tree structure?
- I have a runtime panic with RefCell borrow, how should I restructure this?
- Can this recursive enum fit on the stack or does it need Box?
How to install m02-resource
1Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m02-resource -a claude-code2Manually: put the files in place
~/.claude/skills/m02-resource/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/m02-resource/
1Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m02-resource -a codex2Manually: put the files in place
.agents/skills/m02-resource/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m02-resource -a cursor2Manually: put the files in place
.cursor/skills/m02-resource/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install actionbook/rust-skills m02-resource2Manually: put the files in place
.github/skills/m02-resource/SKILL.md1Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m02-resource -a gemini-cli2Platform CLI
gemini skills install https://github.com/actionbook/rust-skills --path skills/m02-resourceManually: put the files in place
.devin/skills/m02-resource/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add actionbook/rust-skills --skill m02-resource -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about m02-resource
How to install m02-resource in Claude Code?
Run npx skills add actionbook/rust-skills --skill m02-resource -a claude-code in your terminal. You can also place the configuration file directly at ~/.claude/skills/m02-resource/SKILL.md.
What does m02-resource do?
It establishes decision rules for Rust memory management. The agent evaluates thread contexts, ownership boundaries, and cycle risks before proposing smart pointers.
How does the skill prevent memory leaks in reference counting?
It identifies mutual strong references in Rc or Arc structures. To break the cycle, it directs the agent to replace one direction with a Weak reference.