cpp-rules
SolidC++ coding rules: style, patterns, security, testing. Triggers: .cpp, .cc, .cxx, .hpp, .h, CMakeLists.txt, Makefile, GoogleTest, clang-tidy.
AI & Automation 155 stars
19 forks Updated 2 days ago MIT
Install
Quality Score: 93/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# C++ Rules
These rules come from `app/rules/cpp/` in ai-toolkit. They cover
the project's standards for coding style, frameworks, patterns,
security, and testing in C++. Apply them when writing or
reviewing C++ code.
# C++ Coding Style
## Naming
- PascalCase: classes, structs, enums, type aliases, concepts.
- camelCase or snake_case: functions, methods, variables (be consistent per project).
- UPPER_SNAKE: macros, compile-time constants.
- Prefix member variables with `m_` or suffix with `_` (pick one convention).
- Namespace names: lowercase, short (`namespace io`, `namespace util`).
## Modern C++ (17/20/23)
- Use `auto` for iterator types and complex template deductions.
- Use `std::optional<T>` instead of sentinel values or pointers for optional returns.
- Use `std::variant` over union types. Use `std::visit` for dispatch.
- Use `std::string_view` for non-owning string parameters.
- Use structured bindings: `auto [key, value] = *map.begin();`.
- Use `constexpr` for compile-time evaluation. Prefer over macros.
## Memory Management
- Use RAII exclusively. Every resource acquisition is an initialization.
- Use `std::unique_ptr` for exclusive ownership (default choice).
- Use `std::shared_ptr` only when ownership is genuinely shared.
- Never use raw `new`/`delete`. Use `std::make_unique` / `std::make_shared`.
- Use `std::span<T>` (C++20) for non-owning views over contiguous data.
## Functions
- Pass small types by value. Pass large types by `const&`.
- Use `[[nodiscard]...
Details
- Author
- softspark
- Repository
- softspark/ai-toolkit
- Created
- 2 months ago
- Last Updated
- 2 days ago
- Language
- Python
- License
- MIT
Integrates with
Similar Skills
Semantically similar based on skill content — not just same category
Code & Development Solid
cpp-coding-standards
C++ coding standards based on the C++ Core Guidelines (isocpp.github.io). Use when writing, reviewing, or refactoring C++ code to enforce modern, safe, and idiomatic practices.
213,908 Updated today
affaan-m AI & Automation Solid
csharp-rules
C#/.NET coding rules: style, patterns, security, testing. Triggers: .cs, .csproj, .sln, ASP.NET, ASP.NET Core, EF Core, LINQ, NUnit, xUnit, dotnet.
155 Updated 2 days ago
softspark AI & Automation Featured
cpp-pro
Write idiomatic C++ code with modern features, RAII, smart pointers, and STL algorithms. Handles templates, move semantics, and performance optimization.
40,440 Updated today
sickn33