Skills memory-safety-patterns
๐Ÿ“ฆ

memory-safety-patterns

Content revision r1 Safe โš™๏ธ External commands๐ŸŒ Network access๐Ÿ“ Filesystem access

Apply Memory Safety Patterns

Memory bugs cause crashes, leaks, and security defects in systems software. This skill gives practical patterns for safer resource ownership across C, C++, and Rust.

Supports: Claude Codex Code(CC)
๐Ÿฅ‰ 77 Bronze

Install with my Agent

Copy this request to your Agent. It includes the canonical Skill page and manifest.

Agent request
Review the Skillstore skill "memory-safety-patterns" from https://skillstore.io/skills/wshobson-memory-safety-patterns.md and its manifest at https://skillstore.io/api/skills/wshobson-memory-safety-patterns/manifest. Verify the artifact. You may proceed after verification, subject to the environment's own policy.

Your Agent should still show its plan and request any confirmation required by the security policy.

Test it

Using "memory-safety-patterns". I need to manage a file handle in C++ without leaks.

Expected outcome:

  • Use a RAII wrapper that owns the file handle and closes it in the destructor.
  • Delete copy operations, allow move operations, and keep ownership transfer explicit.
  • Add error handling at construction so invalid resources cannot escape.

Using "memory-safety-patterns". My Rust service shares counters across worker threads.

Expected outcome:

  • Use Arc for shared ownership across threads.
  • Use atomics for simple counters and Mutex or RwLock for compound state.
  • Join worker handles and handle lock errors deliberately.

Using "memory-safety-patterns". I am reviewing a C API that allocates several resources.

Expected outcome:

  • Define clear create and destroy functions for every owned resource.
  • Use one cleanup path that frees resources in reverse allocation order.
  • Document which function owns each pointer after every call.

Security Audit

Safe
v7 โ€ข 7/7/2026 Open versioned report

All static findings are false positives from Markdown examples, code fences, public reference links, or illustrative C, C++, and Rust snippets. No prompt injection, hidden automation, data exfiltration intent, or malicious semantic behavior was found in SKILL.md.

1
Files scanned
605
Lines analyzed
0
Review items
0
False positives ignored
No confirmed security findings were detected by the latest completed static and semantic audit. This does not prove the skill has no side effects.
Audited by: codex View Audit History โ†’
Share & cite this report

Share the versioned assessment report, neutral badge, embed card, and citations. Skillstore reports evidence without deciding whether this Skill is safe.

Open versioned report
Security Assessment

Copy report link

https://skillstore.io/skills/wshobson-memory-safety-patterns/audits/7?utm_source=security_passport&utm_medium=share&utm_campaign=versioned_report

Markdown badge

[![Skillstore security assessment](https://skillstore.io/badges/skills/wshobson-memory-safety-patterns/security.svg)](https://skillstore.io/skills/wshobson-memory-safety-patterns?utm_source=security_passport_badge)

HTML badge

<a href="https://skillstore.io/skills/wshobson-memory-safety-patterns?utm_source=security_passport_badge"><img src="https://skillstore.io/badges/skills/wshobson-memory-safety-patterns/security.svg" alt="Skillstore security assessment" loading="lazy"></a>

Embed card

<iframe src="https://skillstore.io/embed/skills/wshobson-memory-safety-patterns.html" title="Skillstore Security Assessment" sandbox="allow-popups allow-popups-to-escape-sandbox" loading="lazy" referrerpolicy="no-referrer" width="420" height="180"></iframe>
Academic citations (APA ยท BibTeX ยท CFF)

APA citation

wshobson. (2026). memory-safety-patterns security audit report (audit version 7) [Author version unspecified]. Skillstore. https://skillstore.io/skills/wshobson-memory-safety-patterns/audits/7

BibTeX citation

@techreport{wshobson-wshobson-memory-safety-patterns-2026, author = {wshobson}, title = {memory-safety-patterns security audit report (audit version 7)}, institution = {Skillstore}, year = {2026}, number = {7}, url = {https://skillstore.io/skills/wshobson-memory-safety-patterns/audits/7}, note = {Author version unspecified} }

CITATION.cff

cff-version: 1.2.0 message: "If you use this Skill, cite its author and this versioned security audit report." title: "memory-safety-patterns security audit report (audit version 7)" version: "unspecified" type: report authors: - name: "wshobson" date-released: "2026-07-07" url: "https://skillstore.io/skills/wshobson-memory-safety-patterns/audits/7" identifiers: - type: other value: "skillstore:wshobson-memory-safety-patterns:audit:7" description: "Skillstore immutable audit report identifier"

Compare variants

2 installable variants

Each author remains a separate installable skill. The recommended variant is ranked by Skillstore evidence.

Why this variant is first

Highest Skillstore Score
sickn33 Recommended

sickn33-memory-safety-patterns

Skillstore Score 78
Evidence Confidence High
Skillstore usage 18
Updated

2026-08-21

wshobson Current

wshobson-memory-safety-patterns

Skillstore Score 77
Evidence Confidence High
Skillstore usage 17
Updated

2026-08-21

Skillstore Score

Why this score Evidence Confidence: High
55
Architecture
85
Maintainability
87
Content
71
Community
78
Spec Compliance

What You Can Build

Harden C++ Resource Management

Use RAII and smart pointer patterns to reduce leaks, double frees, and unsafe manual cleanup.

Plan Rust Ownership Models

Map shared state, borrowing, lifetimes, and concurrency choices before implementing Rust components.

Audit C Cleanup Paths

Review create and destroy flows, goto cleanup blocks, and local resource ownership contracts.

Try These Prompts

Explain Memory Risks
Explain the main memory safety risks in my C or C++ module. Focus on ownership, cleanup, and bounds checks.
Choose Ownership Pattern
Help me choose between unique ownership, shared ownership, borrowing, or cleanup functions for this resource design.
Refactor For RAII
Review this C++ resource management design and suggest a RAII wrapper, move behavior, and safe destructor strategy.
Compare Cross-Language Safety
Compare C, C++, and Rust approaches for this concurrency-heavy component. Recommend memory safety patterns and testing tools.

Best Practices

  • Prefer ownership models that make cleanup automatic and visible.
  • Use safe containers and checked access when correctness matters.
  • Run sanitizers and memory tools on critical code paths.

Avoid

  • Do not share mutable state without an explicit synchronization strategy.
  • Do not hide resource ownership behind unclear raw pointer contracts.
  • Do not copy examples without adapting error handling and lifecycle rules.

Frequently Asked Questions

Which languages does this skill cover?
It focuses on C, C++, and Rust, with brief comparisons to managed languages.
Can it find memory bugs automatically?
No. It provides review guidance and patterns, but it does not run analyzers or inspect binaries.
Is it useful for new Rust developers?
Yes. It explains ownership, borrowing, lifetimes, reference counting, and thread-safe sharing.
Does it replace AddressSanitizer or Valgrind?
No. It recommends these tools, but testing and runtime analysis are still required.
Can it help modernize older C++ code?
Yes. It can guide changes from raw resource handling to RAII and smart pointers.
What should I provide when using it?
Provide the language, resource type, ownership expectations, concurrency model, and failure handling requirements.

Developer Details

Author

wshobson

License

MIT

Skillstore revision

r1

Version notice

The author did not declare a version.

Ref

36e07d5e13068e5be64447e8f20b427cf2cbd21a

Maintenance freshness

7/18/2026

Usage

14 downloads ยท 286 views

File structure

๐Ÿ“„ SKILL.md

More from wshobson

View all
View all