smithery.ai

m12-lifecycle

Mastering C++ Lifecycle: RAII, Destructors, Static Initialization, Rule of 5.

First seen Apr 13, 2026

Installation

$ npx skills add https://smithery.ai

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery.ai · top by installs.

npx skills add https://smithery.ai

Browse all from smithery.ai

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,358 B
  • docs SUMMARY.md 98 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 2 installs

SKILL.md

C++ Resource Lifecycle

Core Question

When does this die?

  • Stack: End of scope }.
  • Heap: When delete (or smart pointer drop) occurs.
  • Static: At program exit (reverse init order).

Error → Design Question

Issue Design Question
Resource Leak Did you manually open() without a wrapper class?
Use After Free Did you capture a reference to a local variable in a lambda/thread?
Static Fiasco Do statics depend on each other? (Use Meyers Singleton).

Thinking Prompt

  1. Does it have a destructor?

- Yes → RAII. Good. - No → Wrap it.

  1. Does it copy?

- FILE* cannot copy. Delete copy constructor.

Quick Reference

Pattern Use Case
RAII Wrapper FileHandle, LockGuard.
Scope Guard std::scope_exit (Cleanup callback).
Rule of 5 Copy/Move/Destructor implementation logic.