SkillAgentSearch skills...

memory-safety-patterns

Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C

Install / Use

npx skills add wshobson/agents --skill memory-safety-patterns

Installs into whichever agent you are using.

About this skill
📄

SKILL.md

Installable skill definition

Quality Score

90/100

Supported Platforms

Universal

Our assessment of memory-safety-patterns

memory-safety-patterns scores 90/100 on our quality scale, 89th of 371 Content & Media skills we index (top 24%).

Its SKILL.md is 2.5 KB long, well organised into 14 sections with 2 code examples: a solid amount of guidance for an agent.

With 39,920 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
26/30
Structure
18/20
Description
12/15
Adoption
20/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated 5 days ago, so memory-safety-patterns is actively maintained.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

Safety scan

No issues found

Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands.

Automated pattern scan on 2026-09-26. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.

memory-safety-patterns compared with similar skills

All 4 of these similar skills score higher than memory-safety-patterns; compare them before choosing.

SkillScoreStarsUpdatedFormat
memory-safety-patterns (this skill)by wshobson9039.9k5d agoSKILL.md
siyuanby siyuan-note10046.5ktodayMCP Server
algorithmic-artby anthropics100177.9k3d agoSKILL.md
pptxby anthropics100177.9k3d agoSKILL.md
designby nextlevelbuilder100130.2k4d agoSKILL.md

Frequently asked questions

How do I install memory-safety-patterns?
Run npx skills add wshobson/agents --skill memory-safety-patterns. The install tabs above show the steps for each supported agent.
Which AI agents does memory-safety-patterns work with?
It is written for Universal, as a SKILL.md file. Other agents that read the same format can often use it too.
Is memory-safety-patterns safe to use?
Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is memory-safety-patterns still maintained?
The repository was last updated 5 days ago, so memory-safety-patterns is actively maintained.

name: memory-safety-patterns description: Implement memory-safe programming with RAII, ownership, smart pointers, and resource management across Rust, C++, and C. Use when writing safe systems code, managing resources, or preventing memory bugs.

Memory Safety Patterns

Cross-language patterns for memory-safe programming including RAII, ownership, smart pointers, and resource management.

When to Use This Skill

  • Writing memory-safe systems code
  • Managing resources (files, sockets, memory)
  • Preventing use-after-free and leaks
  • Implementing RAII patterns
  • Choosing between languages for safety
  • Debugging memory issues

Core Concepts

1. Memory Bug Categories

| Bug Type | Description | Prevention | | -------------------- | -------------------------------- | ----------------- | | Use-after-free | Access freed memory | Ownership, RAII | | Double-free | Free same memory twice | Smart pointers | | Memory leak | Never free memory | RAII, GC | | Buffer overflow | Write past buffer end | Bounds checking | | Dangling pointer | Pointer to freed memory | Lifetime tracking | | Data race | Concurrent unsynchronized access | Ownership, Sync |

2. Safety Spectrum

Manual (C) → Smart Pointers (C++) → Ownership (Rust) → GC (Go, Java)
Less safe                                              More safe
More control                                           Less control

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

Do's

  • Prefer RAII - Tie resource lifetime to scope
  • Use smart pointers - Avoid raw pointers in C++
  • Understand ownership - Know who owns what
  • Check bounds - Use safe access methods
  • Use tools - AddressSanitizer, Valgrind, Miri

Don'ts

  • Don't use raw pointers - Unless interfacing with C
  • Don't return local references - Dangling pointer
  • Don't ignore compiler warnings - They catch bugs
  • Don't use unsafe carelessly - In Rust, minimize it
  • Don't assume thread safety - Be explicit

Debugging Tools

# AddressSanitizer (Clang/GCC)
clang++ -fsanitize=address -g source.cpp

# Valgrind
valgrind --leak-check=full ./program

# Rust Miri (undefined behavior detector)
cargo +nightly miri run

# ThreadSanitizer
clang++ -fsanitize=thread -g source.cpp

Related Skills

View on GitHub
GitHub Stars39.9k
CategoryContent
Updated5d ago
Forks4.3k

Languages

Python

Trust signals

100/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

No cautions