cpp-rules

cpp-rules is a skill for Claude Code from softspark/ai-toolkit. It costs 51 tokens per session (3,269 once invoked), scanned A, original, Apache-2.0.

A set of coding and review guidelines for C++ projects, covering naming, modern C++ features, resource management, security, and testing.

In plain words
What is it for?
Use it when writing or reviewing C++ files, CMake files, Makefiles, or GoogleTest code.
Why use it?
It gives the agent consistent project rules to follow instead of relying on mixed or outdated C++ habits.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the ai-toolkit plugin — 115 skills, 44 agents, 14 hooks shipped together

Good fit Use it when writing or reviewing C++ files, CMake files, Makefiles, or GoogleTest code.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/softspark/ai-toolkit/cpp-rules
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add softspark/ai-toolkit --skill cpp-rules
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 115 skills, 44 agents, 14 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cpp-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/softspark/ai-toolkit/cpp-rules/github.svg)](https://agentmods.dev/skills/softspark/ai-toolkit/cpp-rules)
Your own site
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/cpp-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/cpp-rules/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cpp-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/cpp-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/cpp-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,269 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00051 $0.03269
Opus 5.5 $0.00020 $0.01308
Sonnet 5.5 $0.00010 $0.00654
Haiku 4.5 $0.00005 $0.00327

Measured 1mo ago against content hash c6b5dc2ae2d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cpp-rules scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

app/skills/cpp-rules/SKILL.md · 276 lines

How it starts

The opening of the file, as written. The whole thing — 276 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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]] on functions whose return value must not be ignored.
  • Use noexcept on functions that do not throw (move constructors, destructors).
  • Limit function parameters to 4. Use structs for configuration objects.
  • Use trailing return types for complex template return deductions.

Includes and Dependencies

  • Use #pragma once or include guards. Prefer #pragma once for simplicity.
  • Order: corresponding header, C++ stdlib, third-party, project headers.
  • Forward-declare in headers when possible to reduce compile times.
  • Minimize header dependencies. Use the Pimpl idiom for ABI stability.

Read the full file on GitHub · 276 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 276 lines · 51 tokens per session scan A c6b5dc2ae2d6

Subscribe to this mod's changes

cpp-rules is a skill published in the GitHub repository softspark/ai-toolkit (181 stars, last pushed 11d ago), licensed Apache-2.0. It adds 51 tokens to every session and 3,269 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

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.

affaan-m/ECC · 48 tokens

embedded-stm32

Best practices for embedded C/C++ development on STM32 microcontrollers using the HAL, covering peripherals, DMA, interrupts, memory constraints, and hardware-focused testing. Use when writing STM32 HAL code, configuring peripherals generated by STM32CubeMX, working with interrupts or DMA, debugging with SWD/JTAG…

Mindrally/skills · 87 tokens

cpp

Guidelines for modern C++ development with C++17/20 standards, memory safety, and performance optimization.

Mindrally/skills · 23 tokens

backend-development

Guidelines for backend development in C++ and Elixir/Phoenix, covering modern language features, best practices, and production-ready patterns.

Mindrally/skills · 31 tokens

agent-cpp-expert

Specialist subagent: C and C++ development, modern C++ (C++17/20/23), CMake, systems programming, and memory management specialist. Use when writing C/C++ code, debugging memory issues, or building systems-level software. Trigger phrases: C++, C language, CMake, modern C++, systems programming, memory management…

travisjneuman/.claude · 88 tokens

cpp-expert

Expert-level C++ development with modern C++20/23, STL, memory management, and performance. Use when the user mentions C++, C++20, C++23, the STL, templates, or performance, or when the task involves Modern C++ Features, Memory Management, Ranges and Views, or Coroutines.

personamanagmentlayer/pcl · 70 tokens