From harness-anchor
Use in C/C++ projects for build configure/errors, compile_commands.json generation, or selecting CMake/Meson/Make/Bazel commands.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-anchor:cpp-build-systemsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
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 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.
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.
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).build/) keeps the source tree cleanln -sf .build/compile_commands.json .meson setup builddir
meson compile -C builddir
compile_commands.json in builddir automatically. Symlink it to root if tooling expects it there.Pure Makefile projects don't generate compile_commands.json natively. Use bear:
bear -- make -j
Or compiledb:
compiledb make -j
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.
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=....
Linker "undefined reference" → missing source in target or missing link library. Check target_link_libraries(...) lists everything.
"No such file: <header.h>" → missing target_include_directories or system header missing. For system headers, suggest installing the dev package.
Configure step fails on macOS → often missing Command Line Tools: xcode-select --install.
Anything cryptic → escalate: dispatch the cpp-build-doctor subagent with the full error log.
Keep separate build dirs:
.build/debug
.build/release
.build/asan
This is critical for cpp-sanitizers skill — the sanitizer build is a separate config, not a flag toggle on the same build.
Don't pick one for them. Ask:
bear for compile_commands.jsonRun bash ${CLAUDE_PLUGIN_ROOT}/scripts/cpp-detect.sh --target . to get a JSON summary of what's present. Used by the SessionStart hook to gate C/C++ skills.
cmake-reference.md for CMake idioms used in this codebase / project conventions.meson-reference.md for Meson equivalents.compile-commands-guide.md for the deep-dive on compile_commands.json semantics.If you propose a build fix you haven't verified by running the build:
"I believe the fix is
<change>. Please runcmake -S . -B .build && cmake --build .buildand share the output before we mark this resolved."
Unfamiliar CMake/Meson/Bazel error or missing-package message? Don't guess — invoke the docs-lookup skill, which encodes the canonical Context7 → WebSearch → calibrated-uncertainty fallback chain (with explicit "Context7 is unavailable" detection so you don't silently degrade to guessing).
Typical entry queries: cmake find_package, meson dependency, bazel cc_binary, exact error string in quotes.
npx claudepluginhub redtropig/harness-anchor --plugin harness-anchorCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.