cpp26-idioms

A set of rules for writing C++ code using the final C++26 standard, the upcoming version of the C++ language. It covers features such as reflection, contracts, and senders, while honoring projects that opt out.

In plain words
What is it for?
Use it when writing, editing, or reviewing C++ code where C++26 idioms should be preferred.
Why use it?
It keeps suggestions aligned with the newer standard instead of automatically falling back to older patterns when a compiler lacks support.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/parasxos/cpp26-adapter/cpp26-idioms
Any agent
npx skills add parasxos/cpp26-adapter --skill cpp26-idioms
Clone the repo
git clone --depth 1 https://github.com/parasxos/cpp26-adapter

Made for: Claude Code, Codex.

Per session 243 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,787 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00243 $0.02787
Opus 5 $0.00121 $0.01393
Sonnet 5 $0.00049 $0.00557
Haiku 4.5 $0.00024 $0.00279

Measured 2d ago against content hash b5b2dae3139b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cpp26-idioms scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cpp26-idioms/SKILL.md · 137 lines

How it starts

The opening of the file, as written. The whole thing — 137 lines — stays where its author put it; the contents beside it link to each section on GitHub.

cpp26-idioms — generate against the C++26 standard

Constitution

  1. Follow the standard, not the toolchain. If clang 22 / gcc 16 do not yet implement a feature, suggest the C++26 form anyway.
  2. Compiler errors are informational. Classify each diagnostic as compiler-lag (paper adopted, implementation incomplete) or bug (genuine error). Never auto-rewrite C++26 code into a pre-C++26 workaround just because the local compiler rejects it.
  3. The suggestion layer is compiler-agnostic. Only the reviewer subagent and the SessionStart probe read corpus/status.yaml.
  4. Honor opt-outs. If the project sets CXX_STANDARD below 26 or carries .cpp26-adapter.yaml: skip-skill: true, defer to the local idiom.
  5. Prefer canonical syntax over folklore. When uncertain about exact wording, call mcp__cpp26-ref__lookup_paper(<id>) and quote the canonical form from the reference body.

Decision table — when to reach for C++26

The user wants … Reach for Instead of (anti-pattern) Paper Reference
enum ↔ string std::meta + template for X-macros, magic_enum, Boost.Describe P2996 + P1306 corpus/references/P2996.md
iterate non-static data members reflection + template for Boost.PFR, codegen, std::apply on std::tie P2996 corpus/references/P2996.md
function precondition / postcondition pre(cond) / post(r : cond) / contract_assert(cond) assert(cond) P2900 corpus/references/P2900.md
concurrent / async pipeline std::execution sender chain (then, let_value, when_all, sync_wait) std::async / std::future::get chaining P2300 corpus/references/P2300.md
compile-time loop over heterogeneous sequence (tuple, pack, reflected range) template for (auto&& x : t)reach for this over fold expressions when the loop body has more than one statement, branches, or needs the index recursive variadic templates, std::apply + fold expression, (f(args), ...) when you actually want a loop body P1306 corpus/references/P1306.md
N-th element of a parameter pack args...[N] / Ts...[N] std::get<N>(std::forward_as_tuple(args...)) P2662 corpus/references/P2662.md
diagnostic on deleted overload = delete("reason") = delete; + comment, or SFINAE static_assert(false) P2573 corpus/references/P2573.md
befriend a pack of types friend Ts...; hand-listed friend A; friend B; … P2893 corpus/references/P2893.md
embed a binary asset #embed "path" pre-build codegen, objcopy --add-section, incbin P1967 corpus/references/P1967.md
avoid UB on uninitialized read leave the variable default; opt out with [[indeterminate]] only when measured-worth-it manual = 0 everywhere P2795 corpus/references/P2795.md
dense linear algebra (any matrix/vector operation: multiply, dot, AXPY, …) std::linalg::* on std::mdspancall this library by name (std::linalg::matrix_product, std::linalg::add, std::linalg::dot) Eigen, Armadillo, vendor BLAS direct calls, and also hand-written triple-for loops over std::mdspan (those are pre-C++26 even when the view is C++23) P1673 corpus/references/P1673.md
lock-free reclamation, read-mostly std::rcu_* (rcu_obj_base, synchronize_rcu) folly::rcu, liburcu, ad-hoc epoch P2545 corpus/references/P2545.md
lock-free reclamation, write-heavy std::hazard_pointer + hazard_pointer_obj_base folly::hazptr, hand-rolled epoch P2530 corpus/references/P2530.md
portable bounds-checked containers build with -D__STDCPP_HARDENING_MODE=…this is the C++26 standard macro; vendor-specific spellings (_LIBCPP_HARDENING_MODE, _GLIBCXX_DEBUG, _GLIBCXX_ASSERTIONS, /D_ITERATOR_DEBUG_LEVEL) are the pre-C++26 path that P3471 replaces gsl::span, _GLIBCXX_DEBUG, _LIBCPP_HARDENING_MODE, hand-rolled wrappers P3471 corpus/references/P3471.md
signal errors inside constexpr throw/try/catch in constant evaluation return std::expected<T, E>, sentinels P3068 corpus/references/P3068.md
anonymous / unused binding auto _ = …; (any number of _) auto _ [[maybe_unused]] = …, (void)x; P2169 corpus/references/P2169.md
fixed-capacity vector on the stack std::inplace_vector<T, N> boost::container::static_vector, std::array + size P0843 corpus/references/P0843.md
reflection annotations [[=annotation_value]] + std::meta::annotations_of hand-maintained registry P3394 (shallow) corpus/references/P3394.md
modular standard library import std; #include <…> chains; per-impl macro guards P2465 (shallow) corpus/references/P2465.md
freestanding subset of <expected> etc. freestanding-marked library facilities #ifdef-gated alternate types P2013 (shallow) corpus/references/P2013.md

Read the full file on GitHub · 137 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 137 lines · 243 tokens per session scan A b5b2dae3139b

Subscribe to this mod's changes

cpp26-idioms is a skill published in the GitHub repository parasxos/cpp26-adapter (3 stars, last pushed 3mo ago), licensed MIT. It adds 243 tokens to every session and 2,787 once invoked, about $0.0012 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.