Skip to content
Development
Skill

/sota-c-cpp

State-of-the-art C and C++ engineering rules (2026 baseline) that Claude applies when writing or auditing C/C++. Covers modern idioms (RAII, value semantics, smart pointers, C++23), memory safety (lifetimes, bounds, sanitizers, hardening flags), undefined behavior, security (SEI

From plugin
sota-skills
2342 skills1 hook
Install
$ npx -y skills add martinholovsky/SOTA-skills --skill sota-c-cpp --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/sota-c-cpp

Context preview

The summary Claude sees to decide when to auto-load this skill.

State-of-the-art C and C++ engineering rules (2026 baseline) that Claude applies when writing or auditing C/C++. Covers modern idioms (RAII, value semantics, smart pointers, C++23), memory safety (lifetimes, bounds, sanitizers, hardening flags), undefined behavior, security (SEI

SKILL.md

sota-c-cpp.SKILL.md
name: sota-c-cpp
description: >-
  State-of-the-art C and C++ engineering rules (2026 baseline) that Claude
  applies when writing or auditing C/C++. Covers modern idioms (RAII, value
  semantics, smart pointers, C++23), memory safety (lifetimes, bounds,
  sanitizers, hardening flags), undefined behavior, security (SEI CERT C/C++,
  MISRA, integer/buffer/format-string, injection), concurrency (C/C++ memory
  model, atomics, data races), build/tooling/CI (CMake, clang-tidy, cppcheck,
  ASan/UBSan/TSan, vcpkg/Conan, supply chain), and performance. Trigger keywords
  - C, C++, cpp, RAII, smart pointer, unique_ptr, shared_ptr, undefined
  behavior, UB, buffer overflow, use-after-free, double-free, sanitizer, ASan,
  UBSan, TSan, valgrind, CMake, clang-tidy, clang-format, cppcheck, MISRA, CERT
  C, memory safety, std::thread, atomics, std::move. Use for BOTH building
  C/C++ libraries/systems and reviewing or auditing them.

SOTA C & C++ (2026)

Expert-level rules for producing and auditing production C and C++. C and C++ are *memory-unsafe by default*: the compiler will not stop you from reading freed memory, overrunning a buffer, or invoking undefined behavior (UB) that the optimizer then weaponizes. These rules exist to claw back the safety the language doesn't give you — through RAII, the type system, sanitizers, hardened build flags, and disciplined review. Baseline: C++23 (ISO/IEC 14882:2024) and C17/C23; flag where a control needs a newer toolchain. C++26 is feature-complete (DIS ballot 2026) — contracts, reflection, erroneous behavior for uninitialized reads, and a standardized hardened standard library; the last is usable today via libc++/libstdc++ hardening flags (`rules/02`). Every rule states the *why*; every rules file ends with an audit checklist of grep/clang-tidy/ sanitizer patterns.

Purpose

Two consumers, one source of truth:

  • **BUILD mode** — generating new C/C++: follow the rules as defaults, not

suggestions. Prefer C++ with RAII over raw C idioms unless the target is C. Deviate only with a comment justifying it.

  • **AUDIT mode** — reviewing existing C/C++: hunt violations using the audit

checklists, classify by severity, report in the finding format below. Memory- safety and UB findings are presumed exploitable until proven otherwise.

**What this skill covers about embedded work, and what it does not.** It carries the safety-critical *coding* standards — MISRA C:2025 / C++:2023 and SEI CERT (`rules/04`), freestanding builds with exceptions disabled (`rules/01` §7), banned APIs and hardened build flags — so a firmware codebase gets real coverage of the language layer. It does **not** cover the systems layer that makes embedded work its own discipline: interrupt service routines and reentrancy, DMA buffer coherency, memory-mapped I/O and `volatile` semantics against a peripheral, RTOS task scheduling and priority inversion, WCET and timing analysis, or linker scripts and startup code. No skill in this library owns those today. Say so when the task reaches them rather than generalising from the desktop rules — guidance that sounds authoritative outside its scope is the failure `sota-skill-security` exists to catch.

BUILD mode

1. Before writing, read the rules files relevant to the task (see index). A parser handling untrusted bytes needs `02`, `03`, `04`; a threaded service needs `05`. 2. Apply the **top-10 non-negotiables** (below) unconditionally. 3. New projects: CMake (≥3.20) with `-Wall -Wextra -Wpedantic -Werror`, the [OpenSSF hardening flags](https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html) (`rules/04`), a debug build wired to ASan+UBSan, clang-tidy + clang-format configs, and CI running all of it from day one (`rules/06`). 4. Prefer the standard library and RAII types over hand-rolled allocation/ownership. Every `new`/`malloc`/`fopen`/`mutex.lock()` should be owned by a destructor (`unique_ptr`, container, `lock_guard`), not a manual matching call you can forget on an early return or exception. 5. Treat warnings as errors. A clean `-Wall -Wextra` build is the floor, not the goal — also run a static analyzer and the sanitizers (`rules/06`). 6. When you must use a sharp tool (raw pointer arithmetic, `reinterpret_cast`, `unsafe` C interop, manual lifetime), leave a `// NOTE(sota):` comment explaining the invariant you're upholding so auditors don't flag it blind.

AUDIT mode

Work through each relevant rules file's audit checklist against the target. Run the listed grep/clang-tidy/sanitizer commands; confirm each hit manually (greps are recall-oriented). Where feasible, build with `-fsanitize=address, undefined` and run the test suite — a sanitizer abort is ground truth.

Severity conventions

| Severity | Meaning | Examples | |---|---|---| | **CRITICAL** | Exploitable memory corruption or guaranteed UB on reachable input | Heap/stack buffer overflow on attacker data, use-after-free, double-free, OOB write, format-string with user-controlled fmt, `system()` with interpolated input, data race on a pointer | | **HIGH** | Likely corruption, crash, or security weakness | Unchecked `malloc`/`new` size from input, integer overflow feeding an allocation or index, missing bounds check, `strcpy`/`sprintf`/`gets`, TOCTOU on a path, missing RAII so a leak/UB occurs on the exception path | | **MEDIUM** | Correctness/maintainability hazard, latent bug | Raw owning pointers, manual `new`/`delete` pairs, C-style casts, narrowing conversions, `memcpy` where a typed copy fits, missing `override`/`= delete`, signed/unsigned comparison | | **LOW** | Idiom/perf debt, works but wrong shape | Pass-by-value of large objects, needless copies instead of `std::move`, `using namespace std` in headers, macros where `constexpr`/`inline` fits | | **INFO** | Style/doc/hygiene | clang-format drift, naming, missing `[[nodiscard]]`, include hygiene |

Finding format

[SEVE
Read more
Ships withsota-skills

Make your AI coding assistant build and audit like your most senior engineer. Your assistant is brilliant — it just doesn't know your standards, and it forgets the ones it does know as the task grows long.

Get the whole plugin

Other skills on sota-skills.