cpp-professional-usage

Enforce RAII ownership, ABI boundary safety, and undefined-behavior avoidance in C and C++ code.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill cpp-professional-usage
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpp-professional-usage
Source: https://github.com/machenjie/rd-skills/tree/main/src/foundation/capabilities/cpp-professional-usage
Command: npx skills add https://github.com/machenjie/rd-skills --skill cpp-professional-usage

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill reduces catastrophic C/C++ defects by enforcing disciplined resource ownership, eliminating undefined behavior, and standardizing how native code manages errors, ABI boundaries, and thread safety.

Core Features & Use Cases

  • RAII-first ownership enforcement: requires every owned resource to be released by destructors using smart pointers or stack-based RAII, not raw owning pointers.
  • Undefined-behavior and correctness guardrails: blocks patterns that commonly lead to silent failure, such as null dereferences, signed-overflow UB, aliasing violations, and data races.
  • Native ABI and boundary policies: specifies stable ABI expectations (visibility, extern "C" interface constraints, and semver discipline) and ensures exceptions don’t escape FFI/ABI boundaries.
  • Quality evidence baseline: defines sanitizer lanes (ASan/UBSan/TSan/MSan) plus static analysis and fuzzing expectations for critical native code.

Quick Start

Use the cpp-professional-usage skill to review a proposed C++ change for RAII correctness, UB/aliasing risks, ABI boundary safety, and documented thread-safety and error-handling rules.

Frequently Asked Questions about cpp-professional-usage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce RAII ownership and eliminate raw owning pointers in C++?▼

To enforce RAII ownership in C++, require every owned resource to be released by destructors using smart pointers or stack-based RAII, explicitly eliminating raw owning pointers to prevent resource leaks and ensure exception safety.

What is the best way to prevent undefined behavior and data races in native C++ code?▼

Preventing undefined behavior in native C++ requires blocking null dereferences, signed-overflow, and aliasing violations, while establishing sanitizer lanes using ASan, UBSan, TSan, and MSan to catch data races and silent failures.

How do I maintain ABI compatibility across C++ library boundaries?▼

Maintaining ABI compatibility requires specifying stable ABI expectations with visibility constraints, extern "C" interfaces, and semver discipline, ensuring exceptions never escape FFI or ABI boundaries to prevent runtime crashes.

Does C++20 require explicit thread-safety and memory-ordering contracts for native libraries?▼

C++20 native libraries require explicit thread-safety and memory-ordering contracts to prevent data races in concurrent environments, standardizing how native code manages errors and documents concurrency risks across boundaries.

What sanitizer and fuzzing baseline should I use for performance-critical C++ code?▼

A quality evidence baseline for performance-critical C++ code defines sanitizer lanes using ASan, UBSan, TSan, and MSan, plus static analysis and fuzzing expectations to eliminate silent failures and verify correctness.