Skip to main content
skill CX Codex

modern-cpp — Claude Code skill: what it does, how to install

Directs C++ development toward C++20/23/26 idioms, replacing dangerous raw pointers, legacy macros, and SFINAE boilerplate with memory-safe patterns.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add trailofbits/skills --skill modern-cpp -a claude-code
Open on GitHub

What modern-cpp does

This skill from Trail of Bits steers assistant suggestions toward safe idioms from C++20, C++23, and C++26. It replaces manual memory management and new/delete calls with smart pointers like std::make_unique. Passing pointers with lengths shifts to std::span, while printf gives way to type-safe std::print and std::format.

The instructions organize modernization into practical tiers. Tier 1 covers well-supported features such as concepts, ranges, and std::expected. Tier 2 applies hardening flags like -D_FORTIFY_SOURCE=3 and hardened libc++ modes without bumping the language standard version.

For pure C codebases, the skill is useless. It targets C++ exclusively. It explicitly steps aside when projects require older standards due to embedded constraints or legacy ABI requirements. Build system setups in CMake or Meson are completely out of scope.

What it helps with

  • Replace owning raw pointers and new/delete calls with smart pointers
  • Refactor complex SFINAE templates using concepts and requires clauses
  • Switch unsafe printf calls to std::print and std::format
  • Apply compiler hardening flags and sanitizers to security-sensitive builds

Example prompts for the agent

  • Review this legacy class and refactor raw buffer pointers to use std::span.
  • Modernize our error handling in this module using std::expected from C++23.
  • Suggest Clang hardening flags and sanitizers for our C++ service.

How to install modern-cpp

1Skills CLI (Vercel)

npx skills add trailofbits/skills --skill modern-cpp -a claude-code

2Manually: put the files in place

~/.claude/skills/modern-cpp/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/modern-cpp/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about modern-cpp

How to install modern-cpp in Claude Code?

Run npx skills add trailofbits/skills --skill modern-cpp -a claude-code in your terminal. This downloads the skill into ~/.claude/skills/modern-cpp/SKILL.md.

What does the modern-cpp skill do?

It guides AI coders to generate modern C++20, C++23, and C++26 code. It focuses on eliminating memory vulnerabilities through smart pointers, bounds-aware containers, and type-safe alternatives.

When should modern-cpp not be used?

It does not handle pure C projects or build tools like CMake and Meson. It also steps aside when a project strictly mandates an older C++ standard for legacy ABI compatibility.

Similar skills

All skills for Programming languages →

From the same set77

trailmark-finding-triage Builds a graph evidence packet for a single security finding: reachability, entrypoint paths, taint and blast radius. Useful before you spend time on a PoC. CX Codex +1 1,300installs slicing-code-context Extracts bounded, graph-informed source code slices via Trailmark and delegates analysis to a smaller subagent. Useful when running focused tasks on local or constrained models. CX Codex +1 1,300installs github-triage This skill reviews a repository’s open GitHub issues and pull requests, links pending fixes to issues, and prepares local priority and change-size estimates. CX Codex +1 1,300installs open-sourcing Walks a repository through the pre-release checklist: secret audit, license, docs, CI and packaging. CX Codex +1 1,300installs writing-lean-proofs Guides Lean 4 proof writing and review using Mathlib conventions. Use it when formalising theorems, restructuring tactic code, or adding project checks. CX Codex +1 1,200installs goal-prompt Generates copy-paste /goal directives for Claude Code and Codex with verified stop conditions and invariant checks. CX Codex +1 1,100installs pr-improver pr-improver runs repeated PR review and fix passes on the current branch until blocking findings are cleared. Use it before opening or updating a pull request. CX Codex +1 995installs post-patch-validation Runs exploits and regression checks against both the vulnerable and patched revisions, so you can see whether a security fix actually holds. CX Codex +1 746installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor