cpp

Installation
SKILL.md

C++

Use this skill for C++ code that needs clear ownership, strong type modeling, maintainable file boundaries, and predictable native integration. When the code is part of a Nitro Module, pair this with build-nitro-modules for generated specs, Promise mapping, CMake, and HybridObject constraints.

Workflow

  1. Read the generated headers, public API shape, and local ownership patterns before editing.
  2. Model valid states with types before implementing behavior.
  3. Keep headers small and stable; push implementation details into .cpp files.
  4. Split helpers by responsibility instead of growing a primary implementation file.
  5. Make ownership, lifetime, threading, and async boundaries explicit.

Type-Safe API Design

  • Represent state variants with std::variant, inheritance, or separate concrete types. Do not encode variants as one struct with many std::optional fields.
  • Keep related values nonoptional on the variant where they are valid. If barcode and barcodeType must exist together, put both on ScannedBarcode.
  • Use std::optional for real domain absence inside one state, not for "maybe this object is a different kind of thing".
  • Prefer compile-time flow over caller-side optional probing.
Installs
117
GitHub Stars
133
First Seen
Jun 3, 2026
cpp — margelo/react-native-skills