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.
Cross-language patterns for memory-safe programming including RAII, ownership, smart pointers, and resource management.
| 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 |
Manual (C) → Smart Pointers (C++) → Ownership (Rust) → GC (Go, Java)
Less safe More safe
More control Less control
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
unsafe carelessly - In Rust, minimize it# 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
npx skills add wshobson/memory-safety-patterns下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).
Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
iMessage/SMS CLI for listing chats, history, and sending messages via Messages.app.
Query Google Places API (New) via the goplaces CLI for text search, place details, resolve, and reviews. Use for human-friendly place lookup or JSON output for scripts.
Use the mcporter CLI to list, configure, auth, and call MCP servers/tools directly (HTTP or stdio), including ad-hoc servers, config edits, and CLI/type generation.
Category:developer