cpp-static-analysis

cpp-static-analysis is a skill for Claude Code, Codex from Redtropig/harness-anchor. It costs 37 tokens per session (2,256 once invoked), scanned A, original, MIT.

A C and C++ code-review aid that runs static analysis tools such as clang-tidy, cppcheck, and Include-What-You-Use without running the program.

In plain words
What is it for?
Use it to inspect changed lines for bugs and include problems after ensuring the project provides its compiler-command database and tool configuration.
Why use it?
These checks can find issues such as leaks, null-pointer errors, unsafe arithmetic, and incorrect or unnecessary includes before runtime.

Skill for Claude CodeCodex

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

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/redtropig/harness-anchor/cpp-static-analysis
Any agent
npx skills add Redtropig/harness-anchor --skill cpp-static-analysis
Clone the repo
git clone --depth 1 https://github.com/Redtropig/harness-anchor

Made for: Claude Code, Codex.

Or install harness-anchor, the plugin that ships this one along with the rest of its 14 skills, 9 commands, 5 agents, 5 hooks.

Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,256 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.00037 $0.02256
Opus 5 $0.00018 $0.01128
Sonnet 5 $0.00007 $0.00451
Haiku 4.5 $0.00004 $0.00226

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

Security

Grade A, and why

cpp-static-analysis 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 3d 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-static-analysis/SKILL.md · 193 lines

How it starts

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

C/C++ Static Analysis

Static analysis catches an enormous class of bugs at zero runtime cost: null derefs, leaks, dangling refs, integer overflow, missing initializers, unused includes, banned APIs.

Three core tools cover most needs:

Tool What it catches Cost
clang-tidy Style + correctness + modernize + bugprone Heavy (uses full AST)
cppcheck Quick correctness, leaks, off-by-one Light (own parser)
IWYU Missing/superfluous #include Heavy (compile-driven)

Prerequisites (hard)

  • compile_commands.json exists at project root or symlinked
  • A .clang-tidy config exists at project root (use template if not)
  • The tool is actually reachable — resolve this with the discovery script, not with command -v:
bash ${CLAUDE_PLUGIN_ROOT}/scripts/cpp-tool-discovery.sh clang-tidy cppcheck include-what-you-use

FOUND lines carry the absolute path — use it directly (the tool need not be on PATH to be usable). Only a NOT_FOUND line licenses you to call a tool unavailable.

An empty command -v / where proves nothing. On Windows the VS-bundled LLVM only joins PATH after vcvars64.bat; on macOS Homebrew's llvm is keg-only. Report absence as "searched PATH + <listed locations>, not found (as of <YYYY-MM-DD>)" — never "not installed" / "on this machine". The first is a falsifiable claim about your search; the second is an unfalsifiable claim about the world, and it tends to get written into AGENTS.md where it silently disables this skill for every later session. The date carries the other half: a scope-less negative is wrong about where you looked, a date-less one is wrong about when. Both turn one observation into a standing fact — and AGENTS.md is exactly where standing facts go unchallenged.

If any prerequisite is missing, say so explicitly instead of pretending to analyze:

"Cannot run clang-tidy because compile_commands.json is missing. Generate it via cmake -S . -B .build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON then symlink to root."

Read the full file on GitHub · 193 lines

Files

What ships with it

1 file 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. 3d ago First seen · 193 lines · 37 tokens per session scan A 18bf7449460b

Subscribe to this mod's changes

cpp-static-analysis is a skill published in the GitHub repository Redtropig/harness-anchor (13 stars, last pushed 1mo ago), licensed MIT. It adds 37 tokens to every session and 2,256 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

cpp-systems

Modern C++ patterns: RAII and ownership, rule of zero/five, exceptions and error handling, API and ABI boundaries, templates, and CMake tooling. Use when writing, reviewing, refactoring, or debugging C++, working with smart pointers, move semantics, memory leaks, template errors, or gtest. For plain C, see…

iliaal/ai-skills · 78 tokens

arduino-code-generator

Generate Arduino and embedded C++ snippets for sensors, actuators, buses, state machines, timing, data logging, and hardware abstraction. Use when a user requests implementation code and provide the exact board, framework, toolchain, pins, voltage, memory, and library versions first. Bundled templates target UNO…

wedsamuel1230/arduino-skills · 86 tokens

library-selection

Use when selecting, replacing, pinning, or auditing an Arduino, ESP32, RP2040, C++, or vendor-framework library. Compare architecture support, framework and version compatibility, API behavior, footprint, maintenance, provenance, security, and hardware assumptions before installation.

wedsamuel1230/arduino-skills · 57 tokens

zephyr-json

JSON serialization and deserialization in Zephyr RTOS using the descriptor-based JSON library. Use when encoding C structs to JSON strings, parsing JSON into C structs, working with nested objects or arrays, handling cloud/IoT protocols (MQTT, HTTP, CoAP payloads), or implementing REST APIs on embedded devices.

ksachdeva/zephyr-rtos-ai · 68 tokens

unreal-cpp

写 Unreal C++/蓝图时使用。UObject/GC、反射宏、Tick 性能、蓝图边界。.

Wade-DevCode/awesome-coding-skills-cn · 33 tokens

gdb

Debug and trace C/C++/Rust programs with the GNU Debugger (GDB) without blocking the agent. Use when you need to set tracepoints, inspect variables, or monitor a running process while staying responsive to the user.

betab0t/skills · 50 tokens