Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Cpp Core Guidelines

ASecurity

Use when setting up or reviewing test/coverage/sanitizer tooling for modern C++ (C++17/20/23) projects — GoogleTest/CTest wiring, llvm-profdata/gcov coverage, and ASan/UBSan/TSan flags. Also covers a short list of C++ Core Guidelines rules whose correct answer contradicts a plausible guess.

2 stars
0 votes
0 copies
0 views
Added 9/19/2026
ai-agentsgoc++bashexpresstestinggit

Security Analysis

A100/100

Scanned 9/19/2026

Install to Claude Code

$npx -y skills add Mixard/fable-pack --skill cpp-core-guidelines --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cpp Core Guidelines?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Cpp Core Guidelines
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mixard-cpp-core-guidelines/badge)](https://www.skillsdirectory.com/skills/mixard-cpp-core-guidelines)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: cpp-core-guidelines
description: Use when setting up or reviewing test/coverage/sanitizer tooling for modern C++ (C++17/20/23) projects — GoogleTest/CTest wiring, llvm-profdata/gcov coverage, and ASan/UBSan/TSan flags. Also covers a short list of C++ Core Guidelines rules whose correct answer contradicts a plausible guess.
---

# C++ Core Guidelines

Rule IDs reference the [C++ Core Guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines). Most rules (RAII, immutability, rule of zero/five, prefer `unique_ptr`, avoid raw `new`/`delete`, etc.) are standard knowledge and omitted here — this file covers only the rules where a plausible guess is wrong, plus the testing/tooling setup.

## Counterintuitive rules

| Rule | Plausible wrong guess | Actual behavior |
|------|------------------------|------------------|
| F.49 | Returning `const T` looks safer | It suppresses move construction on the return value — a pessimization, not a safety win |
| CP.44 | `std::lock_guard<std::mutex>(m);` locks for the statement | The unnamed temporary destructs immediately at the end of the full expression — no lock is held while the next line runs |
| CP.8 | `volatile` makes a variable thread-safe | `volatile` only affects compiler reordering/caching for hardware I/O; it gives no atomicity or memory-ordering guarantee across threads |
| SL.io.50 | `std::endl` is just a newline | `endl` forces a stream flush on every call; use `'\n'` and flush explicitly when needed |
| R.13 | Passing two `new`-expressions as arguments to the same call is fine | If one allocation succeeds and the sibling argument's allocation throws, the first leaks — evaluation order between arguments is unsequenced |
| T.144 | You can specialize a function template like a class template | Function template "specializations" don't participate in overload resolution the way overloads do and can't be partial — prefer plain overloads |
| F.53 | Capturing a local by reference in a lambda is safe if the lambda is short-lived | If that lambda is handed to another thread or stored for later (e.g. as a callback), the reference dangles once the enclosing scope returns |
| C.12 | `const` or reference data members just add safety | They also delete the compiler-generated copy assignment and both move operations |

## Testing infrastructure

### GoogleTest via CMake/CTest

```cmake
cmake_minimum_required(VERSION 3.20)
project(example LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(FetchContent)
set(GTEST_VERSION v1.17.0)   # pin per project policy
FetchContent_Declare(
  googletest
  URL https://github.com/google/googletest/archive/refs/tags/${GTEST_VERSION}.zip
)
FetchContent_MakeAvailable(googletest)

add_executable(example_tests tests/calculator_test.cpp src/calculator.cpp)
target_link_libraries(example_tests GTest::gtest GTest::gmock GTest::gtest_main)

enable_testing()
include(GoogleTest)
gtest_discover_tests(example_tests)
```

```bash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build -j
ctest --test-dir build --output-on-failure
ctest --test-dir build -R "UserStoreTest.*" --output-on-failure
./build/example_tests --gtest_filter=UserStoreTest.FindsExistingUser
```

### Coverage

Target-level flags, not global:

```cmake
option(ENABLE_COVERAGE "Enable coverage flags" OFF)
if(ENABLE_COVERAGE)
  if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
    target_compile_options(example_tests PRIVATE --coverage)
    target_link_options(example_tests PRIVATE --coverage)
  elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    target_compile_options(example_tests PRIVATE -fprofile-instr-generate -fcoverage-mapping)
    target_link_options(example_tests PRIVATE -fprofile-instr-generate)
  endif()
endif()
```

GCC + gcov + lcov:

```bash
cmake -S . -B build-cov -DENABLE_COVERAGE=ON
cmake --build build-cov -j
ctest --test-dir build-cov
lcov --capture --directory build-cov --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
genhtml coverage.info --output-directory coverage
```

Clang + llvm-cov:

```bash
cmake -S . -B build-llvm -DENABLE_COVERAGE=ON -DCMAKE_CXX_COMPILER=clang++
cmake --build build-llvm -j
LLVM_PROFILE_FILE="build-llvm/default.profraw" ctest --test-dir build-llvm
llvm-profdata merge -sparse build-llvm/default.profraw -o build-llvm/default.profdata
llvm-cov report build-llvm/example_tests -instr-profile=build-llvm/default.profdata
```

### Sanitizers

```cmake
option(ENABLE_ASAN "Enable AddressSanitizer" OFF)
option(ENABLE_UBSAN "Enable UndefinedBehaviorSanitizer" OFF)
option(ENABLE_TSAN "Enable ThreadSanitizer" OFF)

if(ENABLE_ASAN)
  add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
  add_link_options(-fsanitize=address)
endif()
if(ENABLE_UBSAN)
  add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer)
  add_link_options(-fsanitize=undefined)
endif()
if(ENABLE_TSAN)
  add_compile_options(-fsanitize=thread)
  add_link_options(-fsanitize=thread)
endif()
```

Attribution

MixardMixard
View sourceMore from Mixard →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

1023331 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

686011 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3331 votes

catchup

Recovers prior coding-agent session context by running `catchup <agent> --since-compact`, which extracts a clean summary of a previous Codex, Claude Code, Antigravity, OpenCode, or Pi Agent session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", or asks to recover/summarize a previous session before continuing. Do NOT use for the current conversation, git history, or any non-agent log.

611 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →