cpp-pro

Writes, optimizes, and debugs C++ code using C++20/23 features, templates, and CMake tooling.

Updated Mar 4, 2026
One-click install
npx skills add https://github.com/chisuhua/home --skill cpp-pro-chisuhua
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpp-pro
Source: https://github.com/chisuhua/home/tree/main/.agents/skills.disabled/cpp-pro
Command: npx skills add https://github.com/chisuhua/home --skill cpp-pro-chisuhua

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct, high-performance modern C++ is difficult: developers must juggle concepts, ranges, coroutines, memory safety, concurrency, and build configuration while avoiding undefined behavior and performance regressions. This Skill provides structured guidance and reference material for implementing, optimizing, and debugging C++ code with modern standards. ## Core Features & Use Cases - Modern C++ Implementation: Apply C++20/23 features such as concepts, ranges, coroutines, modules, and the spaceship operator with type-safe, const-correct code. - Performance & Memory Optimization: Use SIMD intrinsics, cache-friendly layouts, custom allocators, move semantics, and memory pools to eliminate bottlenecks. - Concurrency & Build Tooling: Design lock-free structures, thread pools, and parallel STL workflows, plus configure CMake, sanitizers, clang-tidy, and Catch2/GoogleTest testing. - Use Case: When refactoring a latency-critical service, load the memory-performance reference to convert hot loops to SIMD and SoA layouts, then verify correctness with AddressSanitizer and benchmark the improvement. ## Quick Start Ask the assistant to implement a thread-safe C++20 component with concepts and RAII, then have it verified with sanitizers and benchmarks.

Frequently Asked Questions about cpp-pro

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

FAQPage Schema
How do I use C++20 concepts to constrain templates?▼

Define a concept with the concept keyword, such as template<typename T> concept Numeric = std::integral<T> || std::floating_point<T>, then use it as a constraint on template parameters. This produces clearer error messages than SFINAE and documents interface requirements directly in the signature.

How to optimize C++ code with SIMD intrinsics?▼

Use AVX2 intrinsics from immintrin.h to process eight floats per instruction with functions like _mm256_loadu_ps and _mm256_fmadd_ps. Combine SIMD with cache-friendly Structure of Arrays layouts and benchmark with Google Benchmark to verify speedups.

What sanitizers should I run on C++ code?▼

Run AddressSanitizer for memory errors, UndefinedBehaviorSanitizer for UB, ThreadSanitizer for data races, and MemorySanitizer for uninitialized reads. Enable them via CMake build types with flags like -fsanitize=address and fix all reported issues before proceeding.

Should I use Catch2 or GoogleTest for C++ testing?▼

Catch2 offers a lightweight header-style API with TEST_CASE and SECTION macros plus built-in benchmarking, while GoogleTest provides fixtures, parameterized tests, and mocking via gMock. Both integrate with CMake and CTest; choose based on whether you need mocking support.

When should I avoid lock-free data structures in C++?▼

Avoid lock-free structures when contention is low or correctness matters more than throughput, since they carry risks like the ABA problem and complex memory ordering requirements. A std::mutex or std::shared_mutex with RAII locks is simpler and often fast enough.