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 — 113 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 113 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.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.svg" alt="Measured on agentmods" 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 $0.00026 $0.01635
Sonnet 5 $0.00010 $0.00654
Haiku 4.5 $0.00005 $0.00327

Measured 4d ago against content hash c6b5dc2ae2d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 4d 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. 4d 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 (170 stars, last pushed yesterday), licensed Apache-2.0. It adds 51 tokens to every session and 3,269 once invoked, about $0.0003 per session on Opus 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

unreal-cpp-gameplay

Write Unreal Engine 5 C++ gameplay code: the UCLASS/UPROPERTY/UFUNCTION reflection macros, the Gameplay Framework (GameMode, Pawn, Character, PlayerController, Actor components), and the module Build.cs. Use when writing or debugging UE C++, deriving from AActor/ACharacter/ AGameModeBase, exposing properties to the…

gamedev-skills/awesome-gamedev-agent-skills · 105 tokens

implementing-jsc-classes-cpp

Implements JavaScript classes in C++ using JavaScriptCore. Use when creating new JS classes with C++ bindings, prototypes, or constructors.

twaldin/hone · 38 tokens

go-dependency-audit

Go dependency audit specialist for CVE scanning (govulncheck), license risk triage, outdated dependency detection, upgrade impact analysis, and supply chain security. ALWAYS use when auditing go.mod dependencies, running govulncheck, checking license compatibility, planning dependency upgrades, or investigating supply…

johnqtcg/awesome-skills · 102 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

unit-test

A Go testing workflow for writing unit tests: small tests that check individual functions or components. It supports table-driven cases, where many inputs and expected results are organised in one test, and subtests.

johnqtcg/awesome-skills · 100 tokens

go-benchmark

Go performance benchmarking and pprof profiling specialist. ALWAYS use when writing benchmark functions (testing.B), generating or reading pprof profiles, interpreting flame graphs, finding memory allocation hotspots, comparing implementations with benchstat, or measuring ns/op / B/op / allocs/op. In Go code contexts…

johnqtcg/awesome-skills · 90 tokens