cpp-engineering
Write modern C++ — RAII, value semantics, STL-first design, sanitizers and static analysis in the loop.
SKILL.mdskills/cpp-engineering/SKILL.md
GitHubC++ Engineering
Modern C++ done deliberately: resources managed by construction, types that carry meaning, and tooling that catches what eyes miss.
When to use
- C++ services, tooling, game/perf code, cross-platform libraries.
- Modernizing legacy C++ toward C++17/20/23.
Method
- RAII everywhere: resources (memory, files, sockets, locks) owned by objects; destructors clean up; no manual pairing.
- Value semantics first: prefer values,
const, and references; move semantics where copies are expensive; follow the Rule of Zero (write special members only when you must). - Smart pointers with intent:
unique_ptrdefault;shared_ptronly for real shared ownership;weak_ptrto break cycles. No raw owning pointers in new code. - STL-first: algorithms over hand loops; containers matched to access patterns; ranges where available.
- Exceptions policy: pick one per codebase (exceptions on/off), document it, and be consistent.
- Tooling gates: clang-tidy + clang-format; ASan/UBSan/TSan test builds; warnings as errors.
- Templates sparingly: for real genericity, not vanity; keep error messages readable.
- ABI discipline: for libraries: stable interfaces, pimpl where needed, versioned symbols.
Quality gates
- clang-tidy clean on the diff; warnings-as-errors build green.
- Sanitizer-clean test run.
- No raw owning pointers or manual
new/deletein new code. - Rule of Zero honored (special members only when justified).
Red lines
- No dangling references across async boundaries.
- No macros where language features exist.
Related
c-engineering (FFI boundaries) · rust-engineering (when rewriting hot paths) · testing-strategy.