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.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- maintainers/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- buying-researcherSkill
- cursor-cloud-agents-whenSkill
- debug-anthropicSkill
- debug-pocockSkill
- debugSkill
- discover-the-ideaSkill
- docs-google-styleSkill
- golang-safetySkill
- golang-securitySkill
- golang-testingSkill
- grok-acpSkill
- host-config-pyinfraSkill
- lang-csharpSkill
- lang-cSkill
- lang-dartSkill
- lang-dockerSkill
- lang-goSkill
- lang-javaSkill
- lang-js-tsSkill
- lang-kotlinSkill
- lang-luaSkill
- lang-makefileSkill
- lang-phpSkill
- lang-powershellSkill
- lang-protobufSkill
- lang-pythonSkill
- lang-rubySkill
- lang-rustSkill
- lang-shellSkill
- lang-sqlSkill
- lang-swiftSkill
- lang-terraformSkill
- language-routerSkill
- lang-web-markupSkill
- modern-pythonSkill
- pr-reviewSkill
- sdlc-artifactsSkill
- sdlc-onboardingSkill
- security-hardeningSkill
- shell-safetySkill
- tddSkill
- tracker-sdlcSkill
- ui-craftSkill
- ux-designSkill
- verify-before-doneSkill
- yagniSkill
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
- Distinctive: line 35
Prefer STL algorithms when they are clearer than the loop.
- Distinctive: line 45
Never throw from a destructor.
- Very specific: line 46
Check every I/O. iostream failbit is an error.
- Distinctive: line 51
No shared mutable data without a mutex or atomic with a documented memory order.
- Distinctive: line 53
Do not hold a lock across a callback you do not control.
- Distinctive: line 57
Use the harness already in the tree (GoogleTest, Catch2, doctest).
- Distinctive: line 58
Test ownership: moved-from objects are empty.
≈ “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.
Files
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_ptrdefault.shared_ptronly for real shared ownership.- Const-correct.
enum class.nullptr, notNULLor0. overrideon overrides. No object slicing: pass/return by reference orunique_ptr.- Headers are self-contained. No
using namespacein 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/spanfor 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.
iostreamfailbit 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/spanstored 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_castof untrusted bytes into objects. - Command and path inputs: no
std::systemwith 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_ptras the default pointer in a new module.
Never
- Bare
new/delete. Manual lock/unlock. using namespace stdin 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"
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.

