# cpp

A skill that sets rules for C++ design: type modeling, ownership, file boundaries and async. Fits .cpp, .hpp, CMake and C++-backed Nitro modules.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 1300 installs · ★ 181 repo stars
- Author: margelo
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/margelo/react-native-skills/tree/HEAD/skills/cpp/SKILL.md
- Updated: 2026-08-21
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/margelo-cpp

## What it does

This skill covers C++ code that needs explicit ownership and predictable native integration. It tells the agent to read generated headers and local ownership patterns first, then model valid states with types before touching behavior.

Rules cover RAII, `std::variant`, `std::optional` and smart pointers. Variants should be expressed through `std::variant`, inheritance or separate concrete types, not one struct with many optional fields. Raw owning pointers are off the table, and `std::mutex` is a last resort.

File names act as scope contracts. `HybridDataScanner.cpp` implements only `HybridDataScanner`; geometry conversions and UI helpers belong in their own files. Files under roughly 300 lines are usually fine. For Nitro modules, the skill requires inheriting from the generated `Hybrid*Spec` and using `std::shared_ptr<Promise<T>>` in async methods. Pair it with `build-nitro-modules` for generated specs and CMake setup.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill cpp -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/cpp/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/cpp/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill cpp -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/cpp/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill cpp -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/cpp/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install margelo/react-native-skills skills/cpp
```

2. **Manually: put the files in place**
- File: `.github/skills/cpp/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill cpp -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/margelo/react-native-skills --path skills/cpp
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/cpp/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add margelo/react-native-skills --skill cpp -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/margelo/react-native-skills/tree/HEAD/skills/cpp/SKILL.md

## When to use it
- design a C++ API with explicit ownership and types
- split a large .cpp file by responsibility
- remove race fixes that rely on sleep_for or extra mutexes
- set async boundaries without blocking caller threads
- match generated HybridObject specs exactly

## Example prompts
- Review `HybridDataScanner.cpp`: what does not belong to this class and where should it move?
- Replace these `std::optional` fields with a `std::variant`, model the states as types.
- Remove `std::mutex` from the callbacks and propose a thread owner for this code.

## Similar
- [cpp-pro](https://affpapa.org/en/nevibecode/skills/cpp-pro.md) — skill · 70 installs
- [modern-cpp](https://affpapa.org/en/nevibecode/skills/modern-cpp.md) — skill · 1800 installs
- [cpp-expert](https://affpapa.org/en/nevibecode/agents/cpp-expert.md) — subagent · ★ 1029 repo stars
- [memory-safety-patterns](https://affpapa.org/en/nevibecode/skills/memory-safety-patterns.md) — skill · 11746 installs
- [build-acceleration](https://affpapa.org/en/nevibecode/skills/build-acceleration.md) — skill · 597 installs
- [qt-cpp-docs](https://affpapa.org/en/nevibecode/skills/qt-cpp-docs.md) — skill · 897 installs

## Other versions with the same name
- [cpp · mindrally](https://affpapa.org/en/nevibecode/skills/cpp.md) — 829 installs

From the same set: [margelo/react-native-skills](https://affpapa.org/en/nevibecode/by/margelo/react-native-skills.md) — 9 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
