cpp-sanitizers

cpp-sanitizers is a skill for Claude Code from Redtropig/harness-anchor. It costs 40 tokens per session (1,837 once invoked), scanned A, original, MIT.

Runtime checks for C and C++ programs that detect memory errors, undefined behavior, and problems between threads while tests run. They use specially instrumented builds to report where failures occur.

In plain words
What is it for?
Use them to investigate crashes, hangs, memory leaks, use-after-free errors, undefined behavior, and data races in C or C++ projects.
Why use it?
They find bugs that ordinary tests or code inspection may miss, such as using freed memory, overflowing a buffer, or accessing shared data unsafely.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the harness-anchor plugin — 14 skills, 9 commands, 5 agents, 5 hooks shipped together

Good fit Use them to investigate crashes, hangs, memory leaks, use-after-free errors, undefined behavior, and data races in C or C++ projects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/redtropig/harness-anchor/cpp-sanitizers
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 Redtropig/harness-anchor --skill cpp-sanitizers
Clone the repo
git clone --depth 1 https://github.com/Redtropig/harness-anchor

Made for: Claude Code.

Or install harness-anchor, the plugin that ships this one along with the rest of its 14 skills, 9 commands, 5 agents, 5 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-sanitizers

README.md
[![agentmods](https://agentmods.dev/badge/skills/redtropig/harness-anchor/cpp-sanitizers/github.svg)](https://agentmods.dev/skills/redtropig/harness-anchor/cpp-sanitizers)
Your own site
<a href="https://agentmods.dev/skills/redtropig/harness-anchor/cpp-sanitizers"><img src="https://agentmods.dev/badge/skills/redtropig/harness-anchor/cpp-sanitizers/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-sanitizers

Your own site · 80×15
<a href="https://agentmods.dev/skills/redtropig/harness-anchor/cpp-sanitizers"><img src="https://agentmods.dev/badge/skills/redtropig/harness-anchor/cpp-sanitizers.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,837 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.
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.00040 $0.01837
Opus 5 $0.00020 $0.00919
Sonnet 5 $0.00008 $0.00367
Haiku 4.5 $0.00004 $0.00184

Measured 9d ago against content hash f6c1ca1d9511, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

cpp-sanitizers 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 9d 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.

skills/cpp-sanitizers/SKILL.md · 164 lines

How it starts

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

C/C++ Sanitizers — Runtime Bug Catchers

Sanitizers are compiler-instrumented runtime checks. They catch what static analysis can't (path-sensitive errors, race conditions, memory errors discovered at runtime). They run your normal tests under instrumentation; failures abort with a precise report.

Sanitizer What it catches Slowdown
ASan (Address) Use-after-free, heap/stack overflow, leaks (leaks: Linux only) 2-3x
UBSan (UB) Signed overflow, null deref, misaligned, OOB shift, ... (MSVC: unavailable — see Platform notes) ~1.1x
TSan (Thread) Data races, deadlocks (not available on Windows — see Platform notes) 5-10x
MSan (Memory) Use of uninitialized memory 3x (Linux only, Clang only)

Note: ASan + UBSan are combinable. TSan is mutually exclusive with ASan/MSan.

The /sanitize command

/sanitize automates the ASan+UBSan build+test flow below and reports findings in a fixed structure (Build / Tests / Findings / Verdict / Recommendation) with a .harness-anchor/sanitize-*.log evidence path. Reach for it for a one-shot run; read on to understand what it does, how to read the output, and how to suppress known third-party noise. Run TSan separately — it cannot share a build with ASan.

Prerequisites

  • Clang or recent GCC (-fsanitize= family supported since GCC 4.8 / Clang 3.1+)
  • A separate sanitizer build directory (don't mix configs)
  • Tests that actually exercise the suspect code paths — and that the runner actually runs: a sanitizer build only catches UB on paths its tests execute, so a binary built but never add_test-registered is silently skipped (a false "clean"). Use /test-plan to find such run-scope gaps before trusting a clean result.

Standard build setup

ASan + UBSan (most useful default)

# CMake
cmake -S . -B .build/asan \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_CXX_FLAGS="-fsanitize=address,undefined -fno-omit-frame-pointer -g -O1" \
    -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address,undefined"
cmake --build .build/asan
ctest --test-dir .build/asan --output-on-failure

Read the full file on GitHub · 164 lines

Files

What ships with it

2 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. 9d ago First seen · 164 lines · 40 tokens per session scan A f6c1ca1d9511

Subscribe to this mod's changes

cpp-sanitizers is a skill published in the GitHub repository Redtropig/harness-anchor (13 stars, last pushed 1mo ago), licensed MIT. It adds 40 tokens to every session and 1,837 once invoked, about $0.0002 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-30.

Related

Other skills, from other repositories