Claude Marketplaces
SkillsMCP serversMarketplacesDigestTools
Submit

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP servers by category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control
Claude Marketplaces

An independent directory of skills, plugins and MCP servers for Claude Code. Not affiliated with Anthropic.

Browse

  • Skills
  • MCP servers
  • Marketplaces
  • Weekly digest
  • Skill index
  • MCP index
  • Marketplace index

Site

  • About
  • Tools
  • Submit
  • Feedback
  • Privacy
  • llms.txt
  • Plugins reference

Maker

  • Snug
  • Agent Caffeine
  • knobs
  • Wax
  • Vectoys
  • mertduzgun.com
Crafted at
Skills/Documentation
wshobson avatar

Memory Safety Patterns

wshobson/agents

This one bridges the gap between C's manual memory management and Rust's compile-time guarantees by showing you the actual patterns that prevent use-after-free bugs, double-frees, and memory leaks across all three languages. It covers RAII destructors in C++, Rust's ownership system with borrowing rules, smart pointers like unique_ptr and shared_ptr, and even defensive patterns for C like goto cleanup. What I like is that it doesn't just show syntax but explains the tradeoffs between safety and control, plus it includes concrete examples of breaking reference cycles and handling interior mutability. Great for systems programmers who need to write bulletproof resource management code.

installs
11.8K
GitHub stars
41.8K
last updated
Aug 21, 2026
View on GitHubSave

Install

$ npx -y skills add wshobson/agents --skill memory-safety-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

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 TypeDescriptionPrevention
Use-after-freeAccess freed memoryOwnership, RAII
Double-freeFree same memory twiceSmart pointers
Memory leakNever free memoryRAII, GC
Buffer overflowWrite past buffer endBounds checking
Dangling pointerPointer to freed memoryLifetime tracking
Data raceConcurrent unsynchronized accessOwnership, 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

Sponsors

SnugThe clipboard manager you and your agent can use, safelyAgent CaffeineClose your lid, come back to finished workWaxBlock anything with supervision, without erasing your iPhoneOpen StepsSponsoredFree and open-source skills that make AI coding agents easier to understand, verify, and control.

Details

Repository
github.com/wshobson/agents
Categories
Documentation, Rust

More from wshobson/agents

All 174
  • Market Sizing Analysis11.8K
  • Gitops Workflow11.8K
  • Python Observability11.6K
  • Shellcheck Configuration11.6K
  • Python Configuration11.6K
  • Cost Optimization11.6K
  • Embedding Strategies11.5K
  • Go Concurrency Patterns11.4K
  • Billing Automation11.3K
  • Startup Metrics Framework11.3K
  • Data Quality Frameworks11.3K
  • Prometheus Configuration11.3K
  • K8s Manifest Generator11.3K
  • Python Background Jobs11.2K
  • Ml Pipeline Workflow11.2K
  • Context Driven Development11.2K
  • Dependency Upgrade11.2K
  • Competitive Landscape11.1K
  • Memory Forensics11.1K
  • Bats Testing Patterns11.1K
  • Workflow Patterns11.1K
  • Risk Metrics Calculation11.1K
  • Cqrs Implementation11.1K
  • Python Resource Management11.1K

Recommended

More Documentation
1haydenbleasel avatarultracitehaydenbleasel/ultraciteUltracite is a zero-config linting and formatting preset for JavaScript/TypeScript projects. Use when: (1) Setting up or initializing Ultracite in a project (ul11.7Kinstalls
2google avatargcloudgoogle/skillsProvides safety-critical validation, guardrails, and data reduction for gcloud CLI operations across Google Cloud Platform (GCP) services and infrastructure. Us11.2Kinstalls
3wshobson avatarcontext-driven-developmentwshobson/agentsCreates and maintains project context artifacts (product.md, tech-stack.md, workflow.md, tracks.md) in a `conductor/` directory. Scaffolds new projects from scr11.2Kinstalls
4intellectronica avatarcontext7intellectronica/agent-skillsRetrieve up-to-date documentation for software libraries, frameworks, and components via the Context7 API. This skill should be used when looking up documentati11.2Kinstalls
5base44 avatarbase44-sdkbase44/skillsThe base44 SDK is the library to communicate with base44 services. In projects, you use it to communicate with remote resources (entities, backend functions, ai11.1Kinstalls
6wshobson avatarbats-testing-patternswshobson/agentsMaster Bash Automated Testing System (Bats) for comprehensive shell script testing. Use when writing tests for shell scripts, CI/CD pipelines, or requiring test11.1Kinstalls