lang-cpp
Skill0 starsChanged 7 days agoMITView on GitHub
Use when writing, reviewing, testing or setting up C++ backend code in a loops run (the cpp language pack) - toolchain, layout, race policy, coverage, idioms and footguns.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- alexderz/agentic-toolboxtheir own version, first seen Oct 17, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- alexderz/agentic-toolbox★ 5same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository35 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- skills/work/platforms/claude.mdCLAUDE.md
- llms.txtllms.txt
- clarifySkill
- consistencySkill
- debuggingSkill
- documentationSkill
- featureSkill
- hexagonalSkill
- initSkill
- jobs-and-state-machinesSkill
- lang-clojureSkill
- lang-csharpSkill
- lang-elixirSkill
- lang-erlangSkill
- lang-goSkill
- lang-javaSkill
- lang-kotlinSkill
- lang-phpSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-scalaSkill
- lang-swiftSkill
- lang-typescriptSkill
- memorySkill
- parallel-workSkill
- performanceSkill
- qualitySkill
- reportSkill
- review-integrationSkill
- statusSkill
- testingSkill
- workSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 0 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 38
every test target runs under the tsan preset, so tests, libraries and dependencies are all instrumented (a tsan vcpkg triplet or Conan …
- Very specific: line 41
never ship a flaky test as green: no sleep for sync, no retries.
- Very specific: line 42
If TSan cannot run on the host (32-bit, unsupported libc, a sandbox without ptrace/ASLR control) the gate fails with "race policy …
- Very specific: line 52
test executables named *_test and registered with add_test or gtest_discover_tests (so ctest --no-tests=error finds them).
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
lang-cpp
The C++ language pack: specs/languages/cpp/pack.json (what the gate runs) and specs/languages/cpp/RULES.md (the rule book, IDs CPP-<SEC>-NN). Universal rules are not repeated here: layering is specs/ARCHITECTURE.md, SOLID is specs/SOLID.md, gates and the race rule are WORKFLOW §6.
When it applies
loops lang detect reports cpp (a CMakeLists.txt or CMakePresets.json at the root). loops lang show cpp prints the resolved pack: the clang variant is picked when CMakePresets.json contains fprofile-instr-generate (Clang source-based coverage); otherwise the GCC/gcovr path applies. Bazel and Meson projects are not auto-detected: their test commands are recognised by the guard, but the checks assume CMake presets.
Project rules first
Follow the project's own config over this pack: CMakePresets.json (its real preset names), .clang-format, .clang-tidy, .clangd, vcpkg.json, conanfile.*, .editorconfig, its style guide (Google, LLVM, Core Guidelines) and its exception policy, and the framework already in use (Boost.Asio/Beast, gRPC, userver, Drogon). Read them first (config_files in the pack). Every time you follow a project rule over a pack rule, run loops run override --rule "<pack rule>" --project "<project rule, file:line>" --note "<what you did>". If the project's presets are not named dev, tsan and asan-ubsan, override the check argv in .loops/config.json and log it.
Toolchain the gate runs
Agents run loops gate, or single checks while iterating (loops gate --only build,test-tsan). The checks, in order:
| Check | Command | Required |
| configure | cmake --preset dev | yes |
| build | cmake --build --preset dev (warnings as errors, RULES TOOL-04) | yes |
| clang-format | git ls-files … | xargs clang-format --dry-run -Werror | yes when .clang-format is committed, else skipped |
| clang-tidy | run-clang-tidy -p build/dev -quiet | no (runs when .clang-tidy exists) |
| arch | loops arch (#include scan, include-path resolver) | no |
| test-tsan | cmake --preset tsan && cmake --build --preset tsan && ctest --preset tsan --output-on-failure --no-tests=error | yes (the race policy and the coverage run) |
| test-asan-ubsan | the same chain with the asan-ubsan preset | yes |
| coverage | new-code coverage from the lcov file, at least 70% | yes |
| cppcheck, osv-scanner | see pack | off by default (--vuln enables OSV when conan.lock exists) |
Cap parallelism: CMAKE_BUILD_PARALLEL_LEVEL=2 CTEST_PARALLEL_LEVEL=2. After each edit the post-edit hook runs clang-format -i <file> on that one file only; never run clang-format -i over the tree (it rewrites files other agents own, specs/PARALLEL_WORK.md). Never run cmake in the source tree: every build goes in a preset binaryDir under build/ (CPP-REPO-04).
Caches: loops scopes only CCACHE_TEMPDIR per run. CCACHE_DIR, VCPKG_DEFAULT_BINARY_CACHE (the directory must exist), VCPKG_DOWNLOADS and CONAN_HOME are shared (CPP-OPS-05); never set them yourself. Enable ccache with -DCMAKE_CXX_COMPILER_LAUNCHER=ccache in the preset.
Required tools: cmake, ninja (or the preset's generator), a compiler, ctest, clang-format, and gcovr (pipx install gcovr) for GCC or llvm-profdata and llvm-cov for Clang. A missing coverage tool fails the gate. A missing required tool fails; only clang-tidy, cppcheck and osv-scanner skip with an install hint.
Race policy
C++ uses race.mode = build (WORKFLOW §6, CPP-CONC-04): ThreadSanitizer needs its own instrumented build and cannot share a binary with ASan. The full gate runs the required test-tsan check; a gate that skipped it is not green. To satisfy it:
- every test target runs under the
tsanpreset, so tests, libraries and dependencies are all instrumented (atsanvcpkg triplet or Conan profile for dependencies, CPP-CONC-03); - the
tsantest preset setsTSAN_OPTIONS="halt_on_error=1 second_deadlock_stack=1"; suppressions go through the project's own file, never inline (D3); test-asan-ubsanis a separate required build (-fsanitize=address,undefined -fno-sanitize-recover=all); do not combine the two (CPP-CONC-06);- never ship a flaky test as green: no
sleepfor sync, no retries; repeat withctest --repeat until-fail:Nwhile debugging (CPP-TEST-09). If TSan cannot run on the host (32-bit, unsupported libc, a sandbox without ptrace/ASLR control) the gate fails with "race policy unavailable"; fix the host or run in the CI image, never skip. The race-guard hook does not denyctestruns. Details in concurrency.md.
Coverage recipe
Coverage is measured from the tsan build (TSan and coverage combine, verified on GCC 16.2 and Clang 22), so there is no third build. Write lcov to {coverage}:
- GCC (default): the
tsanpreset adds--coverage -fprofile-update=atomic; after the tests the pack runsgcovr --root . --object-directory build/tsan --lcov {coverage} --filter src/. - Clang (
clangvariant): thetsanpreset adds-fprofile-instr-generate -fcoverage-mapping, and its test preset setsLLVM_PROFILE_FILE=${sourceDir}/build/tsan/profraw/%p-%m.profraw; the pack merges the raw profiles withllvm-profdata merge -sparseand exports lcov withllvm-cov export, over the executables named*_testunderbuild/tsan.build/,third_party/,external/,vcpkg_installed/, the composition root (src/app/**,main.cpp) and generated protobuf code are not judged. If coverage looks short at-O1, build thetsanpreset at-O0. Prerequisites the architect orcpp-engineeradds in wave 0 (an override when the project lacks them, D13): CMakePresets.jsonwith configure, build and test presetsdev,tsan,asan-ubsan(distinctbinaryDirs underbuild/),CMAKE_EXPORT_COMPILE_COMMANDS=ONindev, and the sanitizer and coverage flags above;.clang-formatand.clang-tidy(WarningsAsErrorsset), a warnings module (cmake/Warnings.cmake) andCMAKE_COMPILE_WARNING_AS_ERROR ONin the dev preset;- test executables named
*_testand registered withadd_testorgtest_discover_tests(soctest --no-tests=errorfinds them); vcpkg.jsonwithbuiltin-baseline, orconanfile.txtplus a committedconan.lock;.gitignorewithbuild/,CMakeUserPresets.json,vcpkg_installed/,*.gcda,*.gcno,*.profraw.
Layers on C++
src/
domain/ CMake target <p>_domain (STATIC): std + value types; no I/O, clocks, threads
application/ target <p>_application: ports (abstract classes or concepts) + use cases; links domain
adapters/
inbound_http/ target <p>_http: Beast/Drogon/gRPC handlers, DTOs, error mapping; links application
outbound_pg/ target <p>_pg: libpqxx repositories implementing ports; links application
app/main.cpp composition root: config, wiring, signal_set, shutdown (links everything)
tests/{unit,integration}/ one executable per layer target, named *_testNamespace per layer (orders::domain, orders::app). The target link graph is the first line of defence; loops arch scans #include lines (forbidden_in_domain, impure_calls) for the rest, and target cycles (legal in CMake for STATIC libraries) are a review item (CPP-ARCH-04). See architecture.md.
Top 10 footguns
- Dangling
string_view,spanor reference to a temporary: own the data, return by value, run ASan. - Async callbacks capturing raw
this:shared_from_this()or coroutines that own their state. - Mixed or uninstrumented sanitizer builds: one
tsanpreset, a separateasan-ubsanpreset. - An unsynchronised
boolflag across threads (UB):std::atomic,std::stop_token,std::scoped_lock. - An exception escaping a thread,
noexceptfunction or destructor: catch at the task entry. - Raw
new/delete:std::make_unique, rule of zero. - Unchecked
operator[]and signed overflow: hardened libstdc++/libc++,std::span,.at()at boundaries, UBSan. - Uninitialised locals and members: brace-init, in-class initialisers.
using namespacein headers, non-self-contained headers: qualified names, include what you use.- Blocking an I/O thread (sync DB call,
future.get()) or calls without deadlines: async drivers, deadlines on every call.
Load on demand
- repo.md: layout, CMake presets, dependency manifests and locks, toolchain pin, CI shape, releases.
- architecture.md: targets as layers, ports (virtual vs concepts), domain purity list,
loops archlimits. - idioms.md: error strategy, RAII and ownership, UB, rule of zero, views, casts, naming, time.
- testing.md: GoogleTest and CTest, doubles, integration, coverage, fuzzing, flakiness.
- concurrency.md: the TSan build mode, sanitizer rules, locks, Asio, shutdown.
- security.md: memory safety, hardening flags, injection, parsing, crypto, supply chain.
- data-api.md: SQL layers, migrations, gRPC and HTTP, resilience, logging, metrics, tracing, config, images.
- frameworks.md: Asio/Beast, gRPC, userver, Drogon conventions and framework footguns.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

