agentleFS
alexderzalexderz/agentic-toolbox/skills/lang-cpp/SKILL.md

lang-cpp

Skill5 starsChanged 46 days agoMITView on GitHub

use this when writing, reviewing, or testing C++ — *.cpp, *.cc, *.cxx, *.hpp. do not use for C-only changes (load lang-c) or Rust. do not paste the C++ Core Guidelines.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Prefer STL algorithms when they are clearer than the loop.

    line 35
  2. Distinctive:

    Never throw from a destructor.

    line 45
  3. Very specific:

    Check every I/O. iostream failbit is an error.

    line 46
  4. Distinctive:

    No shared mutable data without a mutex or atomic with a documented memory order.

    line 51
  5. Distinctive:

    Do not hold a lock across a callback you do not control.

    line 53
  6. Distinctive:

    Use the harness already in the tree (GoogleTest, Catch2, doctest).

    line 57
  7. Distinctive:

    Test ownership: moved-from objects are empty.

    line 58

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

C++

RAII and ownership, not a Core Guidelines dump. No scripts/. Process skills that may load with this one, and which skill loads for C and C++ files: language-router Load-with list, Map.

Iron law

RAII owns every resource. Rule of Zero by default. No bare new/delete.

Tooling / verify

Build the touched target with the project's system. Then:

# names vary
ctest --output-on-failure
# sanitizers when the project already has a sanitizer target

-Wall -Wextra stay on. Do not weaken flags to green the build.

Idioms a linter misses

  • unique_ptr default. shared_ptr only for real shared ownership.
  • Const-correct. enum class. nullptr, not NULL or 0.
  • override on overrides. No object slicing: pass/return by reference or unique_ptr.
  • Headers are self-contained. No using namespace in a header.
  • Prefer STL algorithms when they are clearer than the loop. Do not invent clever iterator puzzles.
  • Return local values; do not return std::move(local) (elision).
  • string_view / span for non-owning views. Views must not outlive the owner.

Errors

  • Pick the file's policy: exceptions or error codes. Do not mix in one module.
  • Never throw from a destructor.
  • Check every I/O. iostream failbit is an error.

Concurrency

  • std::lock_guard / unique_lock. No manual lock/unlock.
  • No shared mutable data without a mutex or atomic with a documented memory order.
  • Do not hold a lock across a callback you do not control.

Testing

  • Use the harness already in the tree (GoogleTest, Catch2, doctest).
  • Test ownership: moved-from objects are empty; views do not dangle.
  • Sanitizer-clean on the new tests.

PR review

  • New special members: if you write one, you owe Rule of Five — or delete the rest. Prefer Rule of Zero.
  • New shared_ptr: justify why unique ownership failed.
  • string_view / span stored on a struct is a lifetime bug until proven otherwise.
  • Include-what-you-use. No namespace pollution in headers.
  • ABI / public headers: no using namespace std.

Security

  • Bounds on every C-string API that remains. Prefer std::string.
  • Integer overflow on sizes same as C.
  • No reinterpret_cast of untrusted bytes into objects.
  • Command and path inputs: no std::system with concat.

Always

  • RAII for files, locks, sockets, allocations.
  • Const and override.
  • Tests under sanitizers when available.

Ask first

  • Introducing exceptions into a no-exception tree, or the reverse.
  • A custom special member.
  • shared_ptr as the default pointer in a new module.

Never

  • Bare new/delete. Manual lock/unlock.
  • using namespace std in a header.
  • Unchecked C-style casts.
  • Treating C++ as "C with classes".

Red flags

  • "unique_ptr is too noisy"
  • "I'll delete it in the caller"
  • "C++ is just C with classes"
  • "shared_ptr fixes lifetime"

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.