cpp-modern-style

Enforces modern C++20 style rules when writing or reviewing repository C++ code.

6|2|Updated May 6, 2026
One-click install
npx skills add https://github.com/sek788432/Stock-Back-Test-System --skill cpp-modern-style-sek788432
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpp-modern-style
Source: https://github.com/sek788432/Stock-Back-Test-System/tree/main/.agents/skills/cpp-modern-style
Command: npx skills add https://github.com/sek788432/Stock-Back-Test-System --skill cpp-modern-style-sek788432

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? C++ codebases drift toward inconsistent legacy idioms over time, mixing raw pointers, C-style casts, and unscoped enums with modern code. This Skill gives AI agents and reviewers a single authoritative rulebook so every new or edited .h/.cpp file in this repository follows uniform C++20 conventions. ## Core Features & Use Cases - Banned-idiom enforcement: Replaces raw new/delete, C arrays, NULL, typedef, plain enum, sprintf, output parameters, and C-style casts with modern equivalents like std::unique_ptr, std::array, nullptr, using, enum class, and static_cast. - Naming and layout conventions: Defines lowerCamelCase identifiers, UpperCamelCase types and files, UnitTest_<Thing>.cpp test naming, #pragma once headers, include ordering, and the bte::<module> namespace structure. - Modern feature guidance: Prescribes std::span, std::string_view, std::optional, std::variant, std::ranges, concepts, structured bindings, constexpr, and the repository's bte::core::Result<T> error-handling contract with no exceptions across module boundaries. - Use Case: When asked to add a new OrderBook class to the trading engine, the agent writes UpperCamelCase files, uses enum class for OrderSide, returns Result<T> from public APIs, and runs clang-format and clang-tidy before finishing. ## Quick Start Apply the cpp-modern-style rules to write or refactor the C++ file I am working on and verify it contains no banned C-style idioms.

Frequently Asked Questions about cpp-modern-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I modernize legacy C++ code to C++20 style?▼

Replace raw new/delete with std::make_unique and std::make_shared, C arrays with std::array or std::vector, NULL with nullptr, typedef with using, and plain enums with enum class. Fix violations in lines you touch, then run clang-format and clang-tidy on the changed files.

What naming convention should C++ variables and classes use in this repo?▼

Variables, methods, and namespaces use lowerCamelCase like barIndex, while types use UpperCamelCase like OrderType. Private members take a trailing underscore, scoped enum values are lowerCamelCase, and new files use UpperCamelCase stems such as Bar.h and Bar.cpp.

Does this C++ project allow exceptions for error handling?▼

No exceptions cross module boundaries. Public APIs return bte::core::Result<T> marked [[nodiscard]], internal helpers may throw, and the boundary catches and wraps errors. Never expose errno or use output parameters for error reporting.

When should I use std::optional versus std::variant in C++?▼

Use std::optional<T> when a value may be absent, avoiding sentinel values like -1. Use std::variant<A, B> for sum types instead of tagged unions or inheritance hierarchies for two-state values.

Why is raw new banned in modern C++ code reviews?▼

Raw new/delete risks leaks and double-frees, so ownership is expressed with std::unique_ptr for sole owners and std::shared_ptr for rare shared cases. Non-owning access uses raw T* or T& references, and views use std::span or std::string_view.