cpp-pro

Write modern C++ code using RAII, smart pointers, and STL algorithms.

Updated May 28, 2026
One-click install
npx skills add https://github.com/HPI-Jimmy-Chiu/HT904_V899 --skill cpp-pro-hpi-jimmy-chiu
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpp-pro
Source: https://github.com/HPI-Jimmy-Chiu/HT904_V899/tree/main/.agents/skills/cpp-pro
Command: npx skills add https://github.com/HPI-Jimmy-Chiu/HT904_V899 --skill cpp-pro-hpi-jimmy-chiu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing safe, performant C++ requires deep knowledge of modern language features, memory management, and concurrency, and mistakes lead to memory leaks, undefined behavior, and hard-to-debug crashes. ## Core Features & Use Cases - Modern C++ Guidance: Apply C++11/14/17/20/23 features including move semantics, perfect forwarding, concepts, and template metaprogramming. - Memory Safety: Enforce RAII, smart pointers (unique_ptr, shared_ptr), and the Rule of Zero/Three/Five to eliminate manual memory management errors. - Complete Project Output: Generate CMakeLists.txt, header files with include guards, Google Test or Catch2 unit tests, and Google Benchmark performance tests. - Use Case: When refactoring legacy C++ code with raw new/delete calls, use this Skill to convert it to smart pointer-based RAII code with sanitizer-clean output. ## Quick Start Ask the assistant to refactor your C++ class to use smart pointers and RAII following modern C++ best practices.

Frequently Asked Questions about cpp-pro

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor C++ code to use smart pointers?▼

Replace raw new/delete calls with std::unique_ptr for exclusive ownership and std::shared_ptr for shared ownership. Apply RAII so resources are released automatically, and follow the Rule of Zero to avoid writing custom destructors where possible.

What modern C++ features should I use for better performance?▼

Use move semantics and perfect forwarding to avoid unnecessary copies, constexpr for compile-time computation, and STL algorithms instead of raw loops. Profile with tools like perf and VTune, and validate with Google Benchmark.

How do I write thread-safe C++ code with std::thread?▼

Use std::thread with std::atomic for shared state and mutexes for critical sections, ensuring exception safety guarantees. Validate concurrency correctness with ThreadSanitizer to detect data races before deployment.

Does this C++ guidance cover CMake build configuration?▼

Yes, output includes CMakeLists.txt configured with the appropriate C++ standard (C++11 through C++23). Header files use include guards or #pragma once, and test targets integrate Google Test or Catch2.

When should I prefer STL algorithms over raw loops in C++?▼

Prefer STL algorithms like std::transform, std::find_if, and std::accumulate whenever they express the intent directly, since they are less error-prone and often better optimized. Reserve raw loops for cases algorithms cannot express cleanly.