agentic-actions-audito…
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI,…
Guides C++ code toward modern idioms (C++20/23/26). Use when writing new C++ code, modernizing legacy patterns, or working on security-critical C++. Replaces raw pointers with smart pointers, SFINAE with concepts, printf with std::print, error codes with std::expected.
Claude Code
$ npx -y skills add trailofbits/skills --skill modern-cpp --agent claude-code
Codex
$ npx skills add trailofbits/skills --skill modern-cpp -a codex -y
Cursor
$ npx skills add trailofbits/skills --skill modern-cpp -a cursor -y
Gemini CLI
$ npx skills add trailofbits/skills --skill modern-cpp -a gemini-cli -y
GitHub Copilot
$ npx skills add trailofbits/skills --skill modern-cpp -a github-copilot -y
OpenCode
$ npx skills add trailofbits/skills --skill modern-cpp -a opencode -y
Windsurf
$ npx skills add trailofbits/skills --skill modern-cpp -a windsurf -y
name: modern-cpp description: Guides C++ code toward modern idioms (C++20/23/26). Use when writing new C++ code, modernizing legacy patterns, or working on security-critical C++. Replaces raw pointers with smart pointers, SFINAE with concepts, printf with std::print, error codes with std::expected.
Guide for writing modern C++ using C++20, C++23, and C++26 idioms. Focuses on patterns that eliminate vulnerability classes and reduce boilerplate, with a security emphasis from Trail of Bits.
| Avoid | Use Instead | Why | |-------|-------------|-----| | `new`/`delete` | `std::make_unique`, `std::make_shared` | Eliminates leaks, double-free | | Raw owning pointers | `std::unique_ptr`, `std::shared_ptr` | RAII ownership semantics | | C arrays (`int arr[N]`) | `std::array<int, N>` | Bounds-aware, value semantics | | Pointer + length params | `std::span<T>` | Non-owning, bounds-checkable | | `printf` / `sprintf` | `std::format`, `std::print` | Type-safe, no buffer overflow | | C-style casts `(int)x` | `static_cast<int>(x)` | Explicit intent, auditable | | `#define` constants | `constexpr` variables | Scoped, typed, debuggable | | SFINAE / `enable_if` | Concepts + `requires` | Readable constraints and errors | | Error codes + out params | `std::expected<T, E>` | Composable, type-safe errors | | `union` | `std::variant` | Type-safe, no silent UB | | Raw `mutex.lock()/unlock()` | `std::scoped_lock` | Exception-safe, no deadlocks | | `std::thread` | `std::jthread` | Auto-join, stop token support | | `assert()` macro | `contract_assert` (C++26) | Visible to tooling, configurable | | Manual CRTP | Deducing `this` (C++23) | Simpler, no template boilerplate | | Macro code generation | Reflection (C++26) | Zero-overhead, composable |
See [anti-patterns.md](./references/anti-patterns.md) for the full table (30+ patterns).
What are you doing?
|
+-- Writing new C++ code?
| +-- Use modern idioms by default (C++20/23)
| +-- Choose the newest standard your compiler supports
| +-- See Feature Tiers below
|
+-- Modernizing existing code?
| +-- Start with Tier 1 (C++20/23) replacements
| +-- Prioritize by security impact (memory > types > style)
| +-- See anti-patterns.md for the migration table
|
+-- Security-critical code?
| +-- Enable compiler hardening flags (see below)
| +-- Enable hardened libc++ mode
| +-- Run sanitizers in CI
| +-- See safe-idioms.md and compiler-hardening.md
|
+-- Using C++26 features?
+-- Reflection: YES, plan for it (GCC 16+)
+-- Contracts: cautiously, for new API boundaries
+-- std::execution: wait for ecosystem maturity
+-- See cpp26-features.mdFeatures are ranked by **practical usability today**, not by standard version.
| Feature | Replaces | Standard | |---------|----------|----------| | Concepts + `requires` | SFINAE, `enable_if` | C++20 | | Ranges + views | Raw iterator loops | C++20 | | `std::span<T>` | Pointer + length | C++20 | | `std::format` | `sprintf`, iostream chains | C++20 | | Three-way comparison `<=>` | Manual comparison operators | C++20 | | `std::jthread` | `std::thread` + manual join | C++20 | | Designated initializers | Positional struct init | C++20 | | `std::expected<T,E>` | Error codes, exceptions at boundaries | C++23 | | `std::print` / `std::println` | `printf`, `std::cout <<` | C++23 | | Deducing `this` | CRTP, const/non-const duplication | C++23 | | `std::flat_map` | `std::map` for read-heavy use | C++23 | | Monadic `std::optional` | Nested if-checks on optionals | C++23 |
See [cpp20-features.md](./references/cpp20-features.md) and [cpp23-features.md](./references/cpp23-features.md).
These improve safety without changing your C++ standard version:
See [compiler-hardening.md](./references/compiler-hardening.md).
**Reflection** is the single most transformative C++26 feature. It eliminates:
GCC 16 (April 2026) has reflection merged. Plan new code to benefit from it.
See [cpp26-features.md](./references/cpp26-features.md).
-Wall -Wextra -Wpedantic -Werror -D_FORTIFY_SOURCE=3 -fstack-protector-strong -fstack-clash-protection -ftrivial-auto-var-init=zero -fPIE -pie -Wl,-z,relro,
Trail of Bits skills and plugins for AI-assisted security analysis, testing, and development. Install this marketplace in Claude Code or Codex, or import it into your ChatGPT workspace marketplace.
Audits GitHub Actions workflows for security vulnerabilities in AI agent integrations including Claude Code Action, Gemini CLI,…
Understand a codebase before looking for bugs in it - what each function assumes, what it guarantees, and what it depends on…
Scans Algorand smart contracts for 11 common vulnerabilities including rekeying attacks, unchecked transaction fees, missing…
Prepares codebases for security review using Trail of Bits' checklist. Helps set review goals, runs static analysis tools,…
Scans Cairo/StarkNet smart contracts for 6 critical vulnerabilities including felt252 arithmetic overflow, L1-L2 messaging…
Systematic code maturity assessment using Trail of Bits' 9-category framework. Analyzes codebase for arithmetic safety, auditing…
Use for authorized security assessment of REST, GraphQL, WebSocket, or SOAP APIs, including discovery, authentication,…
Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys)…
Clean and finalize authorized natural-language text intended for readers by auditing suspicious invisible Unicode and rewriting…