C++ Pro
Modern C++20/23: high-performance, type-safe systems code.
When to use
Modern C++ with concepts/ranges/coroutines; template metaprogramming; SIMD optimization; RAII memory management; concurrency; CMake build configuration; performance tuning.
Core workflow
- Analyze — toolchain, C++ standard, build system, hotspots.
- Design — RAII ownership, value semantics, concepts to constrain templates.
- Implement — smart pointers, ranges,
constexpr where possible.
- Optimize — profile (perf/VTune), reduce allocations, SIMD where it pays.
- Validate — sanitizers (ASan/UBSan/TSan), clang-tidy, unit tests.
Key practices
- RAII for all resources;
std::unique_ptr/std::shared_ptr, no raw new/delete.
- Rule of zero; rule of five only when managing a resource directly.
- Concepts (C++20) to constrain templates instead of SFINAE.
std::ranges and views for composable, allocation-free pipelines.
constexpr/consteval for compile-time evaluation.
- Pass by
const& or value+move; avoid needless copies.
Constraints
MUST: RAII + smart pointers; const-correctness; run ASan/UBSan; clang-tidy + warnings-as-errors; prefer constexpr; move semantics for transferable resources.
MUST NOT: raw owning pointers / manual new/delete; undefined behavior; data races (guard with mutex/atomics); needless copies; macros where templates/constexpr work.
Output
- Header with concepts/declarations. 2. Implementation (RAII, ranges). 3. CMakeLists.txt. 4. Tests + sanitizer run. 5. Brief note on perf decisions.
Knowledge
C++20/23, concepts, ranges/views, coroutines, templates, smart pointers, RAII, move semantics, constexpr, std::atomic, SIMD intrinsics, CMake, clang-tidy, sanitizers.
1---2name: cpp-pro3description: "Use when building or refactoring modern C++ (C++20/23) needing concepts, ranges, coroutines, SIMD, or careful memory management, or addressing performance bottlenecks, concurrency issues, and CMake build config. Triggers: C++, C++20, C++23, modern C++, template metaprogramming, systems programming, performance optimization, SIMD, memory management, CMake."4version: 1.0.05license: MIT6tags: [cpp, cpp20, cpp23, templates, concepts, ranges, cmake, performance]7source: https://github.com/jeffallan/claude-skills/tree/main/skills/cpp-pro8derived_from: awesomeclaude9metadata:10 source: https://skillmd.com/skills/aashutosh396/cpp-pro11---1213# C++ Pro1415Modern C++20/23: high-performance, type-safe systems code.1617## When to use1819Modern C++ with concepts/ranges/coroutines; template metaprogramming; SIMD optimization; RAII memory management; concurrency; CMake build configuration; performance tuning.2021## Core workflow22231. **Analyze** — toolchain, C++ standard, build system, hotspots.242. **Design** — RAII ownership, value semantics, concepts to constrain templates.253. **Implement** — smart pointers, ranges, `constexpr` where possible.264. **Optimize** — profile (perf/VTune), reduce allocations, SIMD where it pays.275. **Validate** — sanitizers (ASan/UBSan/TSan), clang-tidy, unit tests.2829## Key practices3031- RAII for all resources; `std::unique_ptr`/`std::shared_ptr`, no raw `new`/`delete`.32- Rule of zero; rule of five only when managing a resource directly.33- Concepts (C++20) to constrain templates instead of SFINAE.34- `std::ranges` and views for composable, allocation-free pipelines.35- `constexpr`/`consteval` for compile-time evaluation.36- Pass by `const&` or value+move; avoid needless copies.3738## Constraints3940MUST: RAII + smart pointers; const-correctness; run ASan/UBSan; clang-tidy + warnings-as-errors; prefer `constexpr`; move semantics for transferable resources.41MUST NOT: raw owning pointers / manual `new`/`delete`; undefined behavior; data races (guard with mutex/atomics); needless copies; macros where templates/`constexpr` work.4243## Output44451. Header with concepts/declarations. 2. Implementation (RAII, ranges). 3. CMakeLists.txt. 4. Tests + sanitizer run. 5. Brief note on perf decisions.4647## Knowledge4849C++20/23, concepts, ranges/views, coroutines, templates, smart pointers, RAII, move semantics, constexpr, std::atomic, SIMD intrinsics, CMake, clang-tidy, sanitizers.