/sota-skills:sota-c-cppfrom SOTA Engineering Skills
Applies state-of-the-art C and C++ engineering rules for writing and auditing production code. Covers modern idioms (RAII, C++23), memory safety, undefined behavior, security standards (SEI CERT, MISRA), concurrency, and build tooling (CMake, sanitizers, clang-tidy).
Ships in SOTA Engineering Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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.
Two consumers, one source of truth:
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. The device's
boot chain, debug-port lock, over-the-air update integrity and anti-rollback, and decommissioning
live in sota-security-compliance rules/05 §6
and rules/04 §2. 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.
02, 03, 04; a threaded service
needs 05.-Wall -Wextra -Wpedantic (-Werror in CI, not in distributed sources), the
OpenSSF hardening flags
(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).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.-Wall -Wextra build is the floor, not
the goal — also run a static analyzer and the sanitizers (rules/06).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.Coverage: every rules/ file's Audit checklist applies in AUDIT mode. Mark one not applicable only with its reason in the report — never skip a file because the thing it checks for is absent, since that absence may be the finding.
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 | 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 |
Expands the router's canonical row (file:line | rule | severity | effort | fix, which wins on a
cross-domain roll-up); evidence block and report order: sota rules/03 §2 and §5.
[SEVERITY] file.cpp:LINE — short title
Rule: rules/NN-name.md § section
Evidence: the offending line(s), verbatim
Impact: one sentence — what corrupts/leaks/races, under what input
Fix: concrete replacement code or action
Effort: trivial | small | medium | large
Group findings by severity, CRITICAL first. End with: counts per severity, the three highest-leverage fixes, and which checklists/sanitizers were run.
| File | Read this when... |
|---|---|
rules/01-idioms.md | Writing/reviewing any C++: RAII and the rule of zero/five, ownership with unique_ptr/shared_ptr, value semantics and move, const/constexpr, references vs pointers, casts, enum class, error handling (exceptions vs std::expected vs error codes) and the failures no catch stops (std::terminate, stack overflow; parser depth), in-band sentinels (absence encoded as -1/0/"") incl. EOF in a char — broken only where char is unsigned, C-vs-C++ idiom choices |
rules/02-memory-safety.md | Anything touching pointers, buffers, lifetimes, or allocation: bounds, use-after-free/return, dangling references and views (string_view/span), iterator invalidation, ownership discipline, sanitizers (ASan/MSan), _FORTIFY_SOURCE/_GLIBCXX_ASSERTIONS, Clang Safe Buffers (-Wunsafe-buffer-usage) |
rules/03-undefined-behavior.md | Reasoning about UB and the optimizer: integer overflow, strict aliasing, uninitialized reads, null/misaligned access, signed shifts, data races as UB, unsigned arithmetic, overflow checks the optimiser deletes (-fno-strict-overflow/-fwrapv in production, never instead of a checked ckd_*), C++26 std::saturating_*, C++26 erroneous behaviour and its limits ([[indeterminate]], heap), union = {0} on GCC 15+, UBSan, TypeSanitizer, C++26 contracts are not input validation (evaluation semantics), why "it worked in debug" proves nothing |
rules/04-security.md | Any input crossing a trust boundary: CERT C/C++ + MISRA, banned functions (gets/strcpy/sprintf/system), integer-overflow-to-allocation, format strings, path traversal/TOCTOU, command injection, SSRF through libcurl (connect-time address check, redirects, protocol allowlist), regex as a control (escaping, full-match anchoring, backtracking std::regex/PCRE2 vs linear-time RE2), deserialization/parsers, dynamic code evaluation (embedded Lua/Python interpreters, dlsym by input name), app-set cookie attributes (Drogon, Crow, cpp-httplib), CSPRNG, secret wiping (memset_explicit), the OpenSSF hardening flag set (plus inert flags, -strong vs -all canaries, retpoline thunks), hardening opt-out macros (-U_FORTIFY_SOURCE, _CRT_SECURE_NO_WARNINGS), Windows/MSVC binary hardening (/sdl, /guard:cf, /CETCOMPAT, BinSkim, process mitigations), a shipped debug/sanitizer build refused at compile time, privilege drop in setuid programs and root-started daemons (§7: groups → gid → uid, checked returns, proven permanent) |
rules/05-concurrency.md | Anything with threads, atomics, or shared state: the C++ memory model, data races, std::atomic and memory orders, mutex/lock_guard/scoped_lock, deadlock ordering, condition variables, std::jthread/stop tokens, request-scoped state in thread_local or a logging MDC on reused threads and across co_await, TSan |
rules/06-build-tooling-ci.md | Setting up or auditing builds/CI: CMake hygiene, pinning the C/C++ dialect (GCC 15/16 moved the defaults), -fpermissive as a finding, Debug/Release configurations and the NDEBUG/DEBUG guard, flags that never reach a unit (stale objects, overridden CFLAGS, vendored libraries), warning flags (periodic -Weverything, per-site suppression), clang-tidy/clang-format, static analysis (clang-analyzer, cppcheck, Coverity), sanitizer CI matrix and the trap-mode UBSan subset that may ship, fuzzing (libFuzzer/OSS-Fuzz), bounded model checking with CBMC and its two-pass non-vacuity gate, suppressions that never expire (NOLINT has no unused report), dependencies and supply chain (vcpkg/Conan, pinning, SBOM, selecting a new dependency and overriding its insecure defaults, dependency code that runs at configure/build time). Test strategy lives in sota-testing; this file owns C/C++ build/test mechanics. |
rules/07-performance.md | Latency/throughput/memory work: profiling (perf, VTune, Callgrind), allocation reduction and custom allocators, move/copy elision, cache locality and data-oriented layout, <algorithm> over hand loops, LTO/PGO, micro-benchmarking pitfalls |
new/delete or
malloc/free pairs you have to match by hand; no bare owning pointers.
Use unique_ptr, containers, lock_guard/scoped_lock, RAII wrappers.
A leak or UB on the exception/early-return path is the default failure mode
of manual cleanup. (rules/01, rules/02)std::span/std::string/containers and
.at() or explicit checks, never raw pointer + length you assume. Overflow
on attacker input is CRITICAL. (rules/02)string_view, or span must not outlive its storage. Never return a
reference/view to a local or to a temporary. (rules/02)rules/03)memcpy size are
overflow-checked and the right signedness. Validate ranges before use;
prefer unsigned for sizes, check for wrap. Overflow-to-undersize-alloc is a
classic RCE primitive. (rules/03, rules/04)gets, strcpy/strcat/sprintf
(use bounded forms or std::string/std::format), no system() with
interpolated input (use posix_spawn/exec* with an argv array). (rules/04)-Wall -Wextra (-Werror in CI; OpenSSF: not blanket
in distributed sources) plus the OpenSSF set (-D_FORTIFY_SOURCE=3 -D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection -Wl,-z,relro,-z,now, and
-fcf-protection=full on x86_64 or -mbranch-protection=standard on AArch64). Missing
hardening on a network-facing binary is a HIGH finding. (rules/04,
rules/06)mutex/scoped_lock or use std::atomic with a justified memory
order. A -fsanitize=thread failure is not flaky noise. (rules/05)rules/06)enum class over macros,
constexpr/inline over #define, gsl::span/std::span over pointer+
length, [[nodiscard]] on must-check returns, explicit on single-arg
constructors, override/final. Make misuse fail to compile. (rules/01)rules/01-idioms.md (opens in a new tab)rules/02-memory-safety.md (opens in a new tab)rules/03-undefined-behavior.md (opens in a new tab)rules/04-security.md (opens in a new tab)rules/05-concurrency.md (opens in a new tab)rules/06-build-tooling-ci.md (opens in a new tab)rules/07-performance.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
c, cpp, memory-safety, undefined-behavior, code-audit, embedded-cpp
npx claudepluginhub martinholovsky/sota-skills --plugin sota-skills43 skills in this plugin
/sotaMaster router for the SOTA engineering skills library. Use this skill whenever the user asks to build, design, implement, refactor, harden, optimize, review, or audit an application, service, or codebase and the request spans more than one domain — or when you are unsure which specific sota-* skill applies. Also use when working on a codebase you do not own: reviewing a pull request or diff, responding to code review, evaluating someone else's patch, or preparing an upstream contribution — including mid-session, once you are already reading source, a diff, or CI config. It maps the task (build or audit mode) to the right domain and language skills (Rust, Go, C/C++, JVM, Python, JS/TS, .NET/C#, PHP, Ruby, Swift). Trigger keywords: SOTA, best practices, audit my code, security review, compliance, hardening, prod readiness, code quality, pull request, PR review, review comment, maintainer feedback, patch, diff, upstream, contribute, merge request./sota-api-designState-of-the-art API design and audit guidance (2026) covering REST/HTTP, GraphQL, gRPC, WebSockets/SSE/realtime, webhooks, versioning/evolution, and API security/operations. Use when designing or building any API surface (endpoints, schemas, protos, realtime channels, webhook senders/receivers) AND when auditing/reviewing existing APIs for correctness, evolvability, security, and operational robustness. Not for browser UI, rendering, or client-framework concerns — use sota-web-frameworks or sota-frontend-design. Trigger keywords: API, REST, GraphQL, gRPC, endpoint, websocket, SSE, realtime, WebRTC, webhook, versioning, OpenAPI, pagination, idempotency, rate limit, problem+json, protobuf, deprecation./sota-architectureState-of-the-art software and system architecture rules (2026) for both building and auditing. Use when designing, building, refactoring, or extending system architecture — boundaries, DDD, hexagonal/clean architecture, event-driven design, CQRS, sagas, messaging, caching, sharding, multi-tenancy, resilience, scalability, 12-factor/cloud-native — AND when auditing existing architecture for quality (design review, anti-patterns like distributed monolith or shared database, reliability/scalability assessment). Trigger keywords: architecture, system design, microservices, monolith, serverless, bounded context, DDD, aggregate, hexagonal, clean architecture, event-driven, Kafka, NATS, JetStream, messaging, pub/sub, stream, consumer, queue, saga, outbox, idempotency, CQRS, resilience, circuit breaker, retry, timeout, backpressure, caching, sharding, partitioning, multi-tenant, 12-factor, cloud-native, feature flag, ADR, scalability, anti-pattern, design review, architecture audit./sota-async-concurrencyState-of-the-art rules for writing and auditing asynchronous and concurrent code across runtimes (Python asyncio, JS/Node, Go, Rust, JVM). Use when building anything with async/await, threads, processes, event loops, task groups, channels, or queues — and when auditing existing code for race conditions, deadlocks, leaked tasks, blocked event loops, missing cancellation, or backpressure failures. Not for latency/throughput profiling and optimization — use sota-performance. Trigger keywords: async, await, concurrency, parallelism, threads, race condition, deadlock, event loop, channels, queues, semaphore, mutex, cancellation, timeout, backpressure, task group, goroutine, tokio, asyncio./sota-cli-uxState-of-the-art CLI and developer-tool UX guidance (2026) covering command and flag design, output and interaction (stdout/stderr, --json, TTY detection, exit codes, prompts), runtime behavior and lifecycle (signals, dry-run, idempotency, XDG paths, completions, telemetry), and distribution (packaging, checksums, docs). Use when designing or building any command line tool, subcommand, TUI, or developer tool — in any framework (argparse, click, typer, clap, cobra, oclif, commander) — AND when auditing an existing CLI for usability, scriptability, and compatibility. Not for shell-script correctness or security — use sota-shell-scripting. Trigger keywords: CLI, command line tool, flags, subcommands, terminal output, TUI, developer tool, argparse, clap, cobra, exit code, shell completion, man page, stdin, stdout./sota-cloud-infrastructureState-of-the-art cloud infrastructure architecture (2026). Applies when designing, building, or auditing cloud environments on AWS, GCP, or Azure — account/project structure and landing zones, IAM and workload identity, VPC/network design, DNS/TLS/CDN, compute selection (serverless vs containers vs Kubernetes vs VMs), object storage and backup architecture, cost engineering (FinOps), and disaster recovery. Trigger keywords: cloud, AWS, GCP, Azure, Kubernetes, EKS, GKE, AKS, VPC, subnet, IAM, role, service account, serverless, Lambda, Cloud Run, Fargate, Terraform architecture, DNS, CDN, load balancer, FinOps, cost, rightsizing, disaster recovery, RTO, RPO, multi-region. Use for BOTH greenfield design and auditing existing infrastructure.2 plugins ship this exact skill · first indexed Oct 28, 2026
Other plugins' skills for the same job