effective-cpp

A reference guide for writing, reviewing, refactoring, and debugging C++ code, including advice on classes, memory ownership, inheritance, templates, and modern C++ features.

In plain words
What is it for?
Use it during C++ implementation and code review, especially for resource management, class design, move operations, templates, concurrency, performance, and exception handling.
Why use it?
It helps identify code that may leak memory, crash, behave incorrectly, or be harder to maintain. The guidance is organized by the seriousness of the risk.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/catiicode/claude-code-awesome-skills/effective-cpp
Any agent
npx skills add catiicode/claude-code-awesome-skills --skill effective-cpp
Clone the repo
git clone --depth 1 https://github.com/catiicode/claude-code-awesome-skills

Made for: Claude Code, Codex.

Per session 205 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,546 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00205 $0.03546
Opus 5 $0.00102 $0.01773
Sonnet 5 $0.00041 $0.00709
Haiku 4.5 $0.00020 $0.00355

Measured 2d ago against content hash 74287b167e48, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

effective-cpp 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 2d 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.

effective-cpp/SKILL.md · 206 lines

How it starts

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

Effective C++ Development Guide

Best practices from Scott Meyers' three books, organized by priority for practical C++ development.

Sources: [EC] Effective C++ (55 Items) | [MEC] More Effective C++ (35 Items) | [EMC] Effective Modern C++ (42 Items)

Priority: IRON RULE (UB/crash/leak) > STRONG (correctness/maintainability) > GOOD (quality improvement)

C++ Baseline: C++11

Deep-dive references — read when working on a specific topic:


Iron Rules — Violating These Causes UB, Crashes, or Leaks

# Rule Key Point
1 RAII [EC-13, MEC-9, MEC-10] Every resource owned by an object whose destructor releases it. No manual cleanup. Smart pointer members in constructors prevent partial-construction leaks.
2 Match new/delete forms [EC-16] newdelete, new[]delete[]. Mismatch = UB. Prefer containers over raw arrays.
3 Virtual destructor for polymorphic bases [EC-7] Deleting derived via base pointer with non-virtual dtor = UB. Has virtual functions → needs virtual dtor.
4 No exceptions from destructors [EC-8, MEC-11] Second exception during stack unwinding → std::terminate(). Wrap throws in try/catch. Provide separate close() for error handling.
5 No virtual calls in ctors/dtors [EC-9] During base construction, dynamic type IS the base. Virtual calls resolve to base version, never derived. Pass info via ctor args.
6 No redefining non-virtual functions or default params [EC-36, EC-37] Both are statically bound. Redefining creates confusing behavior depending on pointer type. Use NVI for defaults.
7 No polymorphic arrays [MEC-3] sizeof(Base)sizeof(Derived) breaks pointer arithmetic. Use vector<unique_ptr<Base>>.
8 Smart pointer ownership [EMC-18–21] unique_ptr (default) / shared_ptr (truly shared) / weak_ptr (observer). Never two shared_ptr from same raw pointer. Use make_unique/make_shared. Store new-ed objects in smart pointers immediately [EC-17].
9 Correct copying [EC-11, EC-12, EMC-17] Self-assignment safety (copy-and-swap). Copy ALL parts (members + base). Rule of Five: declare any special member → declare all five.
10 std::move/forward correctness [EMC-23, EMC-25] move = unconditional rvalue cast. forward = conditional (universal refs). Apply on LAST use only. Never move const (silently copies). Never move return values (inhibits RVO).
11 atomic ≠ volatile [EMC-40] std::atomic = thread safety. volatile = no optimization (hardware I/O). volatile provides ZERO thread safety in C++.
12 Exception safety basics [EC-29, MEC-13] Catch by reference (never by value — slicing). Catch derived before base (first-fit matching). Every function: at least basic guarantee.

Read the full file on GitHub · 206 lines

Files

What ships with it

9 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 2d ago First seen · 206 lines · 205 tokens per session scan A 74287b167e48

Subscribe to this mod's changes

effective-cpp is a skill published in the GitHub repository catiicode/claude-code-awesome-skills (1 stars, last pushed 5mo ago), licensed MIT. It adds 205 tokens to every session and 3,546 once invoked, about $0.0010 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-08-31.

Related

Other skills, from other repositories

spanify-buffers

Find and fix unsafe buffer operations in a C++ file by removing UNSAFETODO markers and replacing unsafe raw pointers/C-style functions with base::span and standard safe containers. Use when the user asks to fix unsafe buffer warnings or -Wunsafe-buffer-usage errors. Don't use for other types of memory safety bugs like…

chromium/chromium · 86 tokens

jni-type-conversion

How to use @JniType annotations for ergonomic JNI. Relevant for Java files that use @NativeMethods or @CalledByNative.

chromium/chromium · 32 tokens

platform-port

Guide porting FastLED to new MCU platforms, including int.h types, clockless drivers, SPI implementations, and platform detection. Use when adding support for a new microcontroller family or board.

FastLED/FastLED · 42 tokens

qt-cpp-review

Invoke when the user asks to review, check, audit, or look over Qt6 C++ code — or suggest before committing. Runs deterministic linting (60+ rules) then six parallel deep- analysis agents covering model contracts, ownership, threading, API correctness, error handling, and performance. Reports only high-confidence…

mavlink/qgroundcontrol · 86 tokens

cpp-pro

Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management — or when addressing performance…

Jeffallan/claude-skills · 79 tokens

qt-cpp-docs

Generates standalone Markdown reference documentation for any Qt/C++ source files — Qt Widgets classes, Qt Quick backends, Qt/C++ modules, plain C++ utilities, structs, free-function headers, and entry points like main.cpp. Use this skill to document any .h or .cpp file: Qt classes, plain C++ code, utility helpers, or…

mavlink/qgroundcontrol · 155 tokens