Skip to content
Back to skills

Cpp

ASecurity

Write safe C++ avoiding memory leaks, dangling pointers, undefined behavior, and ownership confusion.

  • 17 stars
  • 0 votes
  • 1 copy
  • 5 views
  • Added September 6, 2026
devopsgoc++

Security analysis

A100/100

Pro scans all 10 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add clawic/skills --skill cpp --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cpp?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cpp
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/clawic-cpp/badge)](https://www.skillsdirectory.com/skills/clawic-cpp)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: C++
slug: cpp
version: 1.0.1
description: Write safe C++ avoiding memory leaks, dangling pointers, undefined behavior, and ownership confusion.
homepage: https://clawic.com/skills/cpp
metadata:
  clawdbot:
    emoji: ⚡
    requires:
      bins:
      - g++
    os:
    - linux
    - darwin
    - win32
    displayName: C++
---

## Quick Reference

| Topic | File |
|-------|------|
| RAII, smart pointers, new/delete | `memory.md` |
| Raw pointers, references, nullptr | `pointers.md` |
| Rule of 3/5/0, inheritance, virtual | `classes.md` |
| Containers, iterators, algorithms | `stl.md` |
| Templates, SFINAE, concepts | `templates.md` |
| Threads, mutex, atomics | `concurrency.md` |
| C++11/14/17/20, move semantics | `modern.md` |
| Undefined behavior traps | `ub.md` |

## Critical Rules

- Raw `new` without `delete` leaks — use `std::unique_ptr` or `std::make_unique`
- Returning reference to local — undefined behavior, object destroyed on return
- `==` for C-strings compares pointers — use `std::string` or `strcmp()`
- Signed integer overflow is UB — not wrap-around like unsigned
- Virtual destructor required in base class — otherwise derived destructor skipped
- `std::move` doesn't move — it casts to rvalue, enabling move semantics
- Moved-from object valid but unspecified — don't use without reassigning
- Data race on non-atomic is UB — use `std::mutex` or `std::atomic`
- `vector<bool>` is not a real container — returns proxy, use `deque<bool>`
- `map[key]` inserts default if missing — use `find()` or `contains()` to check
- Braced init `{}` prevents narrowing — `int x{3.5}` errors, `int x(3.5)` truncates
- Iterator invalidation on `push_back` — vector may relocate, invalidating iterators
- `string_view` doesn't own data — underlying string must outlive the view

Files in this skill

  • SKILL.md1.8 KB
  • _meta.json234 B
  • classes.md616 B
  • concurrency.md544 B
  • memory.md551 B
  • modern.md600 B
  • pointers.md558 B
  • stl.md574 B
  • templates.md571 B
  • ub.md487 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…