Smart pointer and resource ownership patterns for Rust heap allocation and reference counting.
Works with
Guides ownership decisions through a three-step model: single vs. shared ownership, single-threaded vs. multi-threaded context, and presence of reference cycles
Covers six core types (Box, Rc, Arc, Weak, Cell, RefCell) with a decision flowchart and quick reference table for choosing the right pattern
Includes common errors and anti-patterns with fixes, such as using Weak to break cycles, av
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versionm02-resourceExecute the skills CLI command in your project's root directory to begin installation:
Fetches m02-resource from zhanghandong/rust-skills and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate m02-resource. Access via /m02-resource in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
0
total installs
0
this week
979
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
979
stars
Layer 1: Language Mechanics
What ownership pattern does this resource need?
Before choosing a smart pointer, understand:
| Error | Don't Just Say | Ask Instead |
|---|---|---|
| "Need heap allocation" | "Use Box" | Why can't this be on stack? |
| Rc memory leak | "Use Weak" | Is the cycle necessary in design? |
| RefCell panic | "Use try_borrow" | Is runtime check the right approach? |
| Arc overhead complaint | "Accept it" | Is multi-thread access actually needed? |
Before choosing a smart pointer:
What's the ownership model?
What's the thread context?
Are there cycles?
When pointer choice is unclear, trace to design:
"Should I use Arc or Rc?"
↑ Ask: Is this data shared across threads?
↑ Check: m07-concurrency (thread model)
↑ Check: domain-* (performance constraints)
| Situation | Trace To | Question |
|---|---|---|
| Rc vs Arc confusion | m07-concurrency | What's the concurrency model? |
| RefCell panics | m03-mutability | Is interior mutability right here? |
| Memory leaks | m12-lifecycle | Where should cleanup happen? |
From design to implementation:
"Need single-owner heap data"
↓ Use: Box<T>
"Need shared immutable data (single-thread)"
↓ Use: Rc<T>
"Need shared immutable data (multi-thread)"
↓ Use: Arc<T>
"Need to break reference cycle"
↓ Use: Weak<T>
"Need shared mutable data"
↓ Single-thread: Rc<RefCell<T>>
↓ Multi-thread: Arc<Mutex<T>> or Arc<RwLock<T>>
| Type | Ownership | Thread-Safe | Use When |
|---|---|---|---|
Box<T> |
Single | Yes | Heap allocation, recursive types |
Rc<T> |
Shared | No | Single-thread shared ownership |
Arc<T> |
Shared | Yes | Multi-thread shared ownership |
Weak<T> |
Weak ref | Same as Rc/Arc | Break reference cycles |
Cell<T> |
Single | No | Interior mutability (Copy types) |
RefCell<T> |
Single | No | Interior mutability (runtime check) |
Need heap allocation?
├─ Yes → Single owner?
│ ├─ Yes → Box<T>
│ └─ No → Multi-thread?
│ ├─ Yes → Arc<T>
│ └─ No → Rc<T>
└─ No → Stack allocation (default)
Have reference cycles?
├─ Yes → Use Weak for one direction
└─ No → Regular Rc/Arc
Need interior mutability?
├─ Yes → Thread-safe needed?
│ ├─ Yes → Mutex<T> or RwLock<T>
│ └─ No → T: Copy? → Cell<T> : RefCell<T>
└─ No → Use &mut T
| Problem | Cause | Fix |
|---|---|---|
| Rc cycle leak | Mutual strong refs | Use Weak for one direction |
| RefCell panic | Borrow conflict at runtime | Use try_borrow or restructure |
| Arc overhead | Atomic ops in hot path | Consider Rc if single-threaded |
| Box unnecessary | Data fits on stack | Remove Box |
| Anti-Pattern | Why Bad | Better |
|---|---|---|
| Arc everywhere | Unnecessary atomic overhead | Use Rc for single-thread |
| RefCell everywhere | Runtime panics | Design clear ownership |
| Box for small types | Unnecessary allocation | Stack allocation |
| Ignore Weak for cycles | Memory leaks | Design parent-child with Weak |
| When | See |
|---|---|
| Ownership errors | m01-ownership |
| Interior mutability details | m03-mutability |
| Multi-thread context | m07-concurrency |
| Resource lifecycle | m12-lifecycle |
Make data-driven prioritization decisions faster
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Prerequisites
Time Estimate
30-60 minutes to see productivity improvements
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid when
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
mattpocock/skills
parcadei/continuous-claude-v3
cursor/plugins
ailabs-393/ai-labs-claude-skills
pproenca/dot-skills
mattpocock/skills
Keeps context tight: m02-resource is the kind of skill you can hand to a new teammate without a long onboarding doc.
I recommend m02-resource for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
Solid pick for teams standardizing on skills: m02-resource is focused, and the summary matches what you get after install.
m02-resource has been reliable in day-to-day use. Documentation quality is above average for community skills.
m02-resource reduced setup friction for our internal harness; good balance of opinion and flexibility.
m02-resource has been reliable in day-to-day use. Documentation quality is above average for community skills.
Registry listing for m02-resource matched our evaluation — installs cleanly and behaves as described in the markdown.
We added m02-resource from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
m02-resource fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
m02-resource is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
showing 1-10 of 68