ericrisco/rsc-harness / skills/cpp
cpp
VerifiedUse when writing, reviewing, modernizing, building, or debugging C++ - RAII and resource lifetime, smart-pointer ownership, move semantics and the Rule of Zero/Five, target-based CMake with FetchContent, and killing undefined behavior with ASan/UBSan/TSan plus clang-tidy. NOT borrow-checker / Result-Option / cargo memory safety (that is rust).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 15.5 KB |
| evals/README.md | markdown | 1.1 KB |
| evals/cases.yaml | config | 3.9 KB |
| references/cmake.md | markdown | 5.2 KB |
| references/move-and-templates.md | markdown | 5.2 KB |
| references/undefined-behavior.md | markdown | 5.5 KB |
| scripts/verify.shexecutable | script | 5.8 KB |
evals/cases.yaml
View on GitHubskill: cpp
should_trigger:
- prompt: "Modernize this C++ — it's full of new/delete and raw owning pointers, manual for loops, and C-style casts."
why: "Modernizing legacy C++ (RAII, smart pointers, ranges, static_cast) is the skill's core use case."
- prompt: "Who should own this object — a unique_ptr, a shared_ptr, or just a value? It gets passed around a lot."
why: "Ownership design via the smart-pointer/value decision table is explicitly owned here."
- prompt: "I'm getting a use-after-free and an occasional segfault under load. Find it."
why: "Non-obvious, symptom-only trigger: the user never says 'smart pointer' or 'C++ idiom', but this routes here via the ASan + lifetime workflow."
- prompt: "Write a CMakeLists.txt that pulls in Catch2 with FetchContent and turns on AddressSanitizer."
why: "Target-based CMake with FetchContent + sanitizer build is a named trigger."
- prompt: "Revisa este código C++ y dime si tengo una fuga de memoria."
why: "Spanish review + memory-leak trigger; the description carries the Spanish phrasing 'fuga de memoria'."
- prompt: "Should this move constructor be noexcept, and is my Rule of Five correct here?"
why: "Move semantics / Rule of Five / noexcept-move is a core decision this skill makes."
- prompt: "My program is fine in Debug but crashes in Release — is this undefined behavior, and how do I prove it with sanitizers?"
why: "Non-obvious UB symptom ('works in Debug, breaks in Release'); routes here for the ASan/UBSan workflow, not a generic debugger."
should_not_trigger:
- prompt: "Fix this borrow-checker error and return a Result instead of panicking."
route_to: "rust"
why: "Borrow checker + Result/Option is Rust's compiler-enforced ownership, a different mechanism than C++ RAII discipline."
- prompt: "Do a threat model and authz review of my service's permission boundaries and OWASP exposure."
route_to: "security-audit"
why: "Language-agnostic threat modeling and authz/abuse review is delegated to security-audit; only C++-specific memory/UB controls stay here."
- prompt: "Write a multi-stage Dockerfile and GitHub Actions CI to build and ship my compiled binary."
route_to: "deployment"
why: "Containerizing and shipping the binary is delegated to deployment; this skill stops at the CMake build plus a sanitizer-CI note."
- prompt: "Record our team's chosen C++ compiler flags and conventions in the project wiki and index them from CLAUDE.md."
route_to: "harness"
why: "Authoring/indexing the 02-DOCS workspace wiki is the harness skill's job; this skill only writes its own stack article when that layer already exists."
- prompt: "Build a Go HTTP service with graceful shutdown and table-driven tests."
route_to: "go"
why: "A different sibling systems language; Go service work has no overlap with C++ mechanics."
capability:
- scenario: "Modernize a C++ class that owns a heap buffer via new[]/delete[] and a raw FILE*, and give it a sane CMake build."
must_include:
- "Replaces the owning raw buffer with std::unique_ptr or std::vector under Rule of Zero, OR keeps a hand-managed resource only via a correct Rule of Five with noexcept move operations"
- "Wraps the FILE* in an RAII type whose destructor closes it (or uses std::fstream / unique_ptr with a custom deleter), so it closes on every exit path"
- "Contains no new/delete and no owning raw pointers that escape; uses std::make_unique where heap is needed"
- "CMake is target-based (target_compile_features(... cxx_std_23), target_link_libraries), not directory-level include_directories/link_libraries, and sets warnings-as-errors (-Werror / /WX)"
- "Mentions building and testing under ASan+UBSan (-fsanitize=address,undefined) to prove no UB on covered paths"
- "Uses const / value semantics and standard containers and algorithms over manual index loops where natural"
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |