cpp-build-systems

cpp-build-systems is a skill for Claude Code, Codex from Redtropig/harness-anchor. It costs 33 tokens per session (1,239 once invoked), scanned A, original, MIT.

Build guidance for C and C++ projects using systems such as CMake, Meson, Make, or Bazel. It also covers generating compile_commands.json, a file that tells code tools how each source file is compiled.

In plain words
What is it for?
Use it to configure builds, diagnose compilation errors, generate compile_commands.json, and choose commands for the project's build system.
Why use it?
Incorrect or missing build information can prevent code checkers, editors, and language tools from understanding the project correctly.

Skill for Claude CodeCodex

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

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-build-systems
Any agent
npx skills add Redtropig/harness-anchor --skill cpp-build-systems
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.

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-build-systems

README.md
[![agentmods](https://agentmods.dev/badge/skills/redtropig/harness-anchor/cpp-build-systems.svg)](https://agentmods.dev/skills/redtropig/harness-anchor/cpp-build-systems)
Your own site
<a href="https://agentmods.dev/skills/redtropig/harness-anchor/cpp-build-systems"><img src="https://agentmods.dev/badge/skills/redtropig/harness-anchor/cpp-build-systems.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,239 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.1 $0.00033 $0.01239
Opus 5 $0.00016 $0.00620
Sonnet 5 $0.00007 $0.00248
Haiku 4.5 $0.00003 $0.00124

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

Security

Grade A, and why

cpp-build-systems 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 5d 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-build-systems/SKILL.md · 127 lines

How it starts

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

C/C++ Build Systems

The build system is the single most important piece of C/C++ tooling — it determines how every other tool (clang-tidy, IWYU, language servers, debuggers) understands your code.

The compile_commands.json invariant

Every C/C++ project must export compile_commands.json.

It's a JSON database of compiler invocations per file. Without it, clang-tidy/IWYU/clangd can't parse your code correctly (they need to know macros, includes, standard, flags). The cpp-static-analysis skill enforces this prerequisite.

Per-build-system commands

CMake

cmake -S . -B .build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build .build -j
  • -DCMAKE_EXPORT_COMPILE_COMMANDS=ON is mandatory unless already in CMakeLists.txt via set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
  • Out-of-source build (.build/) keeps the source tree clean
  • Symlink from project root so tools find it: ln -sf .build/compile_commands.json .

Meson

meson setup builddir
meson compile -C builddir
  • Meson emits compile_commands.json in builddir automatically. Symlink it to root if tooling expects it there.

Make (raw)

Pure Makefile projects don't generate compile_commands.json natively. Use bear:

bear -- make -j

Or compiledb:

compiledb make -j

Bazel

bazel build //...
bazel run @hedron_compile_commands//:refresh_all

Bazel requires the hedron_compile_commands rule. If not configured, suggest the user add it; do NOT try to hand-edit BUILD files.

Build failure triage (you fix common ones, escalate the rest)

  1. CMake "could not find package X" → likely missing find_package(X REQUIRED) cleanup or wrong CMAKE_PREFIX_PATH. Suggest: cmake -L .build to inspect, or pass -DX_DIR=....

  2. Linker "undefined reference" → missing source in target or missing link library. Check target_link_libraries(...) lists everything.

Read the full file on GitHub · 127 lines

Files

What ships with it

3 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. 5d ago First seen · 127 lines · 33 tokens per session scan A 45f17abdd3a5

Subscribe to this mod's changes

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