mirror of
https://github.com/trailofbits/skills
synced 2026-06-21 14:12:00 +00:00
4c9d5989a4
Modern C++ skill guiding Claude toward modern idioms with a security emphasis. Mirrors modern-python in spirit but focuses on language standards rather than toolchain. Features tiered by practical usability: - Tier 1 (Use Today): C++20/23 features with solid compiler support - Tier 2 (Deploy Now): Compiler hardening, sanitizers, hardened libc++ - Tier 3 (Plan For): C++26 reflection - Tier 4 (Watch): Contracts, std::execution Includes SKILL.md entry point + 6 reference docs: - anti-patterns.md (30+ legacy-to-modern swaps) - cpp20-features.md (concepts, ranges, span, format, coroutines) - cpp23-features.md (expected, print, deducing this, flat_map) - cpp26-features.md (reflection, contracts, memory safety) - compiler-hardening.md (flags, sanitizers, hardened libc++) - safe-idioms.md (security patterns by vulnerability class) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
modern-cpp
Modern C++ best practices plugin for Claude Code, guiding AI-assisted development toward C++20/23/26 idioms with a security emphasis from Trail of Bits.
When to Use
- Writing new C++ code (functions, classes, libraries)
- Modernizing legacy C++ patterns (pre-C++20)
- Working on security-critical C++ code
- Reviewing C++ code for modern idiom adoption
- Choosing between legacy and modern approaches to a problem
What It Covers
Language Features (Tiered by Usability)
| Tier | Standard | What |
|---|---|---|
| Use Today | C++20 | Concepts, ranges, std::span, std::format, coroutines, <=> |
| Use Today | C++23 | std::expected, std::print, deducing this, std::flat_map |
| Deploy Now | Any | Compiler hardening flags, sanitizers, hardened libc++ |
| Plan For | C++26 | Reflection (eliminates serialization boilerplate and code generators) |
| Watch | C++26 | Contracts, std::execution (promising but needs compiler maturity) |
Security
- Compiler hardening flags (GCC + Clang, per OpenSSF guidelines)
- Hardened libc++ modes (bounds-checking with ~0.3% overhead)
- Sanitizer setup (ASan, UBSan, TSan, MSan)
- Safe idioms organized by vulnerability class (memory, type, integer, concurrency)
Anti-Patterns
30+ legacy-to-modern pattern replacements with rationale, covering memory management, type safety, error handling, concurrency, and metaprogramming.
Installation
/plugin marketplace add trailofbits/skills
/plugin install modern-cpp