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.
npx agentmods add skills/redtropig/harness-anchor/cpp-formattingnpx skills add Redtropig/harness-anchor --skill cpp-formattinggit clone --depth 1 https://github.com/Redtropig/harness-anchorWrote 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.
[](https://agentmods.dev/skills/redtropig/harness-anchor/cpp-formatting)<a href="https://agentmods.dev/skills/redtropig/harness-anchor/cpp-formatting"><img src="https://agentmods.dev/badge/skills/redtropig/harness-anchor/cpp-formatting.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00035 | $0.00855 |
| Opus 5 | $0.00017 | $0.00428 |
| Sonnet 5 | $0.00007 | $0.00171 |
| Haiku 4.5 | $0.00003 | $0.00085 |
Grade A, and why
cpp-formatting 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.
How it starts
The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.
C/C++ Formatting (clang-format)
clang-format is the de-facto C/C++ formatter. Like Prettier or rustfmt, it's deterministic and removes formatting debates.
Prerequisites
clang-formatreachable — see "Is clang-format actually here?" below before concluding it's missing; only thenbrew install clang-format/apt install clang-format..clang-formatconfig at project root (usetemplates/cpp/.clang-format.tplif not present —/cpp-initdrops it for you)
Format changed lines only (preferred)
git diff -U0 --no-color HEAD | clang-format-diff -p1 -i
Or, for staged changes:
git clang-format
This formats only changed lines — does not touch unrelated code. Critical for keeping diffs clean.
Is clang-format actually here?
Before concluding clang-format is unavailable, resolve it properly:
bash ${CLAUDE_PLUGIN_ROOT}/scripts/cpp-tool-discovery.sh clang-format
A FOUND line gives you an absolute path — invoke it directly; the binary does
not need to be on PATH. Only NOT_FOUND licenses "unavailable", and then the
honest phrasing is "searched PATH + <listed locations>, not found (as of <YYYY-MM-DD>)",
never "not installed" / "on this machine" (an empty command -v only tells you about PATH —
the VS-bundled LLVM on Windows and keg-only Homebrew llvm on macOS both sit off it).
The date matters as much as the scope: a scope-less negative is wrong about where
you looked, a date-less one is wrong about when.
Format a whole file
clang-format -i path/to/file.cpp
Only use this on files you OWN this session, or when starting fresh. Reformatting an unchanged file in the middle of a feature pollutes the diff and obscures review.
Verify (CI-friendly)
clang-format --dry-run --Werror path/to/file.cpp
Returns non-zero if anything would change. Useful in pre-commit / CI.
Common .clang-format settings
The template uses LLVM as the base with a few popular tweaks:
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 100
AllowShortIfStatementsOnASingleLine: Never
AllowShortFunctionsOnASingleLine: Empty
SortIncludes: true
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.
- 3d ago First seen · 100 lines · 35 tokens per session scan A bf4b2e33c86c
cpp-formatting is a skill published in the GitHub repository Redtropig/harness-anchor (13 stars, last pushed 1mo ago), licensed MIT. It adds 35 tokens to every session and 855 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.
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…
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…
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.
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.
unreal-cpp
写 Unreal C++/蓝图时使用。UObject/GC、反射宏、Tick 性能、蓝图边界。.
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.