C++ patterns for smart pointers, lifetimes, locks, C++20 to 26 changes, compiler defaults, and hardening. Load before any edit to a C++ file or header, however small, and for C++ questions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Cpp Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ku5ic-cpp-patterns)
---
name: cpp-patterns
description: C++ patterns for smart pointers, lifetimes, locks, C++20 to 26 changes, compiler defaults, and hardening. Load before any edit to a C++ file or header, however small, and for C++ questions.
---
# C++ patterns
Default assumption: C++23, ISO/IEC 14882:2024, per isocpp.org's standard page. C++26 isn't published: its DIS ballot didn't pass unanimously, as reported at the November 2026 meeting, and a second ballot is expected. Suggest a C++26 feature only when the build already opts into it.
A standard row applies when the build's `-std` or `/std`, else the compiler's default, is at least its standard, and a compiler row when the project's compiler is at least that release. GCC 16 defaults to `gnu++20`, GCC 11 to 15 and Clang 16 and later to `gnu++17`, and MSVC to `/std:c++14`.
A `.h` header also loads c-patterns, since it may be C.
## Reference files
Loading this skill isn't enough. Before your next edit, read the file of every row that matches it. The rules live in those files, and this one only points at them.
| Before | Read |
| ------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| Writing C++ code, raising `-std`, or upgrading the compiler | [reference/upgrades.md](reference/upgrades.md) |
| Writing, changing, or reviewing C++ code | [reference/anti-patterns.md](reference/anti-patterns.md) |
| Writing a class, a smart pointer, a parameter list, an enum, or a build's flags | [reference/practices.md](reference/practices.md) |
| Configuring compiler warnings, clang-tidy, the analyzers, sanitizers, or clang-format | [reference/tooling.md](reference/tooling.md) |