cpp-systems skill
✓ VerifiedApply modern C++ patterns including RAII, ownership models, template usage, and CMake tooling for writing, reviewing, and debugging systems code.
- GitHub stars
- 45
- Files
- 7
- Last commit
- Nov 7, 2026
- License
- MIT
- Allowed tools
- —
What does the cpp-systems skill do?
cpp-systems is an agent skill. Apply modern C++ patterns including RAII, ownership models, template usage, and CMake tooling for writing, reviewing, and debugging systems code.
Summary generated from the skill's SKILL.md.
About the cpp-systems skill
Writing, reviewing, or debugging systems-level C++ code is what this skill enables for developers working with modern standards like C++17 and C++20. It provides guidance on implementing RAII, managing resource ownership through smart pointers, and handling move semantics to prevent memory leaks. An agent should load this skill when tasked with refactoring classes to follow the rule of zero or five, analyzing template errors, or managing CMake tooling.
The skill focuses on strict discipline regarding API and ABI boundaries, ensuring that changes to public headers do not break compatibility. It helps identify defects such as raw new or delete calls in application code and suggests appropriate alternatives like std::unique_ptr or std::shared_ptr. It also accounts for specific project constraints, such as environments using -fno-exceptions or embedded targets that lack RTTI and dynamic allocation. Developers can use it to verify code against clang-tidy, address sanitizer, and thread sanitizer requirements.
What an agent can do with it
- 1Refactor resource managementConvert manual memory management to RAII using smart pointers to ensure safe resource release.
- 2Review ownership semanticsAnalyze function parameters to determine if they should consume ownership or merely observe data.
- 3Audit class special membersCheck if adding a destructor has accidentally disabled move operations in a class.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the cpp-systems skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the cpp-systems skill in Claude Code
~/.claude/skills/cpp-systems/SKILL.md
$ npx degit iliaal/ai-skills/skills/cpp-systems ~/.claude/skills/cpp-systemsInstall the cpp-systems skill in Claude Code (project)
.claude/skills/cpp-systems/SKILL.md
$ npx degit iliaal/ai-skills/skills/cpp-systems .claude/skills/cpp-systemsInstall the cpp-systems skill in Codex
~/.agents/skills/cpp-systems/SKILL.md
$ npx degit iliaal/ai-skills/skills/cpp-systems ~/.agents/skills/cpp-systemsInstall the cpp-systems skill in Gemini CLI
~/.gemini/skills/cpp-systems/SKILL.md
$ npx degit iliaal/ai-skills/skills/cpp-systems ~/.gemini/skills/cpp-systemsInstall the cpp-systems skill in Claude.ai
npx degit iliaal/ai-skills/skills/cpp-systems cpp-systems && zip -r cpp-systems.zip cpp-systems # claude.ai → Customize → Skills → + → Create skill → Upload a skill → cpp-systems.zip
Automated checks
Ran Nov 14, 2026Full report →Passed our automated checks. That is not a security audit: read the scripts before you let an agent run them. How checks work
- Source repository linked and reachableiliaal/ai-skills/skills/cpp-systems is public and reachablegithub.com/iliaal/ai-skills/tree/HEAD/skills/cpp-systems ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-11-07github.com/iliaal/ai-skills/commits ↗Pass
- No download-and-run or credential theft in scriptsNo scripts in the skill folderPass
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/iliaal/ai-skills/blob/HEAD/skills/cpp-systems/SKI ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/iliaal/ai-skills/blob/HEAD/skills/cpp-systems/SKI ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 90 linesgithub.com/iliaal/ai-skills/blob/HEAD/skills/cpp-systems/SKI ↗Pass
SKILL.md
View on GitHubC++ Systems & Libraries
Covers C++17 as the baseline, with C++20 features called out where a project's standard allows them. For plain C (manual lifetimes, status enums, native extensions), see the ia-c-systems skill.
Working rules
- Make resource ownership explicit and use RAII for release on every exit path.
- Keep borrowed views within backing-storage lifetimes and review copy/move behavior when special members change.
- Follow the project's error model and supported language standard.
- Preserve ABI and avoid invoking unknown callbacks while holding locks or invalidatable container iterators.
Repo conventions outrank this skill
Check CMakeLists.txt for CXX_STANDARD, read .clang-format and .clang-tidy, and read two adjacent translation units before writing. Where they conflict with the rules below, they win.
The conflicts that actually happen:
| Local constraint | Consequence |
|---|---|
-fno-exceptions |
Error handling is codes or expected-alikes. Constructors cannot report recoverable failure, so use a fallible factory or construct a valid fallback state. new (std::nothrow) only where the project's OOM policy is to observe null and recover; plain new is fine where the policy is termination |
| Standard pinned below C++17 | No std::optional/string_view/structured bindings/if constexpr; check before using any |
| Public header is ABI-stable | No layout changes, no inline-function changes, no added virtuals: load the ABI reference |
| Embedded or freestanding target | No RTTI, no dynamic allocation in hot paths, possibly no STL containers |
Ownership and RAII
Every resource has exactly one owner, and that owner is an object whose destructor releases it. A raw new or delete in application code is a defect.
std::unique_ptr<T>for sole ownership. It is the default; it costs nothing over a raw pointer.std::shared_ptr<T>only where lifetime is genuinely shared and cannot be expressed as "the owner outlives the users". Reach for it third, not first.std::weak_ptr<T>to break ownership cycles. LeakSanitizer does report a cycle that is unreachable from any root, but not one still reachable from a global or other registered root, and detection varies by platform and configuration. Do not rely on the sanitizer to find these.- Raw
T*andT&mean non-owning observation, and are correct in that role. A parameter takingunique_ptrby value is announcing that it consumes ownership; one takingT*is announcing it does not. std::span<T>(C++20) or a pointer-plus-length pair for a borrowed contiguous range in a new public API, sinceconst std::vector<T>&there refuses every other container. On a C++17 baseline, or for internal code whose callers all hold vectors anyway,const std::vector<T>&is fine and simpler.
Rule of zero: a class that owns nothing declares no destructor, no copy, and no move. Composing members that manage themselves gets all five special members correct for free. Rule of five: declaring any one of destructor, copy constructor, copy assignment, move constructor, or move assignment obliges the author to reason about all five. A user-declared destructor suppresses the implicit move operations, so a class that gained a destructor silently started deep-copying where it used to move.
Discipline
- Preserve behavior and API compatibility unless a break was requested. A public header change is a decision, not a cleanup.
- Do not introduce a template, an inheritance hierarchy, or a policy parameter for a single call site.
#includewhat the file uses; do not rely on transitive includes from another header.- No
using namespaceat namespace scope in a header. Fully qualify instead, or scope theusingto a function body. - When a constraint forces a deviation, comment at the deviation site and state the constraint.
Verify
- Build clean with
-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Werror clang-tidyreports no new findings on the diff- Tests pass under
-fsanitize=address,undefinedwith zero reports - Any threaded code touched by the change exercised under TSan with zero reports; the warning bundle above does not catch lock misuse
clang-format --dry-run --Werrorproduces no diff- No new raw
new/delete, no newshared_ptrwhereunique_ptrsuffices - Any class that gained a destructor has its move operations reviewed
Task-specific references
Read the relevant reference before implementing or reviewing the matching behavior:
- For constness, errors, API/ABI changes, templates, or standard-library behavior: value-and-interface-design.md.
- For threading, compiler setup, tests, or build analysis: concurrency-and-verification.md.
Existing specialized references, when the corresponding topic applies:
Files in this skill
7cpp-systems skill questions
How do I install the cpp-systems skill in Claude Code?
Run npx degit iliaal/ai-skills/skills/cpp-systems ~/.claude/skills/cpp-systems. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the cpp-systems skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
How should I handle resource ownership in C++?
Every resource should have exactly one owner using RAII, where the owner's destructor releases the resource. Use std::unique_ptr for sole ownership and std::shared_ptr only when lifetime is genuinely shared.
How should I handle errors if the project is compiled with -fno-exceptions?
In this case, error handling should use error codes or expected-like types. Since constructors cannot report recoverable failures, you should use a fallible factory or construct a valid fallback state.