cpp-pro
jeffallan/claude-skills
Modern C++20/23 expert for high-performance systems, template metaprogramming, and zero-overhead abstractions.
What is cpp-pro?
Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management—or when addressing performance bottlenecks, concurrency issues, and build system configuration with CMake.
- Designs type-safe interfaces using C++20 concepts and constraints
- Implements zero-cost abstractions with RAII, constexpr, and move semantics
- Optimizes performance with SIMD, cache layout, and profiling-driven techniques
- Debugs memory and undefined behavior issues using AddressSanitizer and UndefinedBehaviorSanitizer
- Configures build systems with CMake, compiler flags, and static analysis tools
- Applies template metaprogramming patterns including variadic templates, SFINAE, and CRTP
How to install cpp-pro
npx skills add https://github.com/jeffallan/claude-skills --skill cpp-pro- C++20 or C++23 compatible compiler (GCC 11+, Clang 13+, MSVC 2019+)
- CMake 3.20 or later for build configuration
- Sanitizer support in your compiler (AddressSanitizer, UndefinedBehaviorSanitizer)
- Familiarity with C++ fundamentals and standard library
How to use cpp-pro
- 1.Review your project's build system and compiler flags to ensure C++20/23 support
- 2.Define concepts for your domain-specific types to enforce type-safe constraints
- 3.Refactor code to use smart pointers (std::unique_ptr, std::shared_ptr) instead of raw new/delete
- 4.Apply RAII patterns to wrap resource handles and ensure automatic cleanup
- 5.Enable all compiler warnings (-Wall -Wextra -Wpedantic) and run sanitizers on your test suite
- 6.Profile with real workloads and apply targeted optimizations (SIMD, move semantics, cache layout) as needed
- 7.Run static analysis tools and address all warnings before deployment
Use cases
- Refactoring legacy C++ code to modern C++20/23 standards with concepts and smart pointers
- Building high-performance systems requiring SIMD optimization and cache-aware data layout
- Designing generic libraries with type-safe template constraints and zero-overhead abstractions
- Debugging memory safety and concurrency issues in multi-threaded applications
- Setting up CMake build configurations with sanitizers and static analysis enabled
- Senior C++ developers building systems software or high-performance applications
- Teams migrating codebases to modern C++ standards
- Performance engineers optimizing bottlenecks in existing C++ systems
- Library authors designing generic, type-safe interfaces
- Embedded systems developers requiring careful memory and resource management
cpp-pro FAQ
Use C++20 concepts for new code—they are more readable, provide better error messages, and are the modern standard. SFINAE is useful for compatibility with older codebases or complex type trait logic that concepts don't yet cover elegantly.
Use std::unique_ptr by default for exclusive ownership with zero overhead. Use std::shared_ptr only when multiple owners genuinely need to share lifetime. Avoid raw pointers for ownership.
Profile first with real workloads to identify bottlenecks. Then apply targeted optimizations: SIMD for compute-heavy loops, cache-aware data layout, move semantics for expensive types, and constexpr for compile-time computation. Re-measure after each change.
Enable AddressSanitizer and UndefinedBehaviorSanitizer in your test suite, use smart pointers instead of raw pointers, apply RAII universally, and write const-correct code. Fix all sanitizer reports before shipping.
Choose one pattern consistently within your codebase. Exceptions are idiomatic modern C++ and work well with RAII. Error codes are useful in performance-critical paths or embedded systems where exceptions are disabled.
Full instructions (SKILL.md)
Source of truth, from jeffallan/claude-skills.
name: cpp-pro description: Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management — or when addressing performance bottlenecks, concurrency issues, and build system configuration with CMake. license: MIT metadata: author: https://github.com/Jeffallan version: "1.1.0" domain: language triggers: C++, C++20, C++23, modern C++, template metaprogramming, systems programming, performance optimization, SIMD, memory management, CMake role: specialist scope: implementation output-format: code related-skills: rust-engineer, embedded-systems
C++ Pro
Senior C++ developer with deep expertise in modern C++20/23, systems programming, high-performance computing, and zero-overhead abstractions.
Core Workflow
- Analyze architecture — Review build system, compiler flags, performance requirements
- Design with concepts — Create type-safe interfaces using C++20 concepts
- Implement zero-cost — Apply RAII, constexpr, and zero-overhead abstractions
- Verify quality — Run sanitizers and static analysis; if AddressSanitizer or UndefinedBehaviorSanitizer report issues, fix all memory and UB errors before proceeding
- Benchmark — Profile with real workloads; if performance targets are not met, apply targeted optimizations (SIMD, cache layout, move semantics) and re-measure
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Modern C++ Features | references/modern-cpp.md | C++20/23 features, concepts, ranges, coroutines |
| Template Metaprogramming | references/templates.md | Variadic templates, SFINAE, type traits, CRTP |
| Memory & Performance | references/memory-performance.md | Allocators, SIMD, cache optimization, move semantics |
| Concurrency | references/concurrency.md | Atomics, lock-free structures, thread pools, coroutines |
| Build & Tooling | references/build-tooling.md | CMake, sanitizers, static analysis, testing |
Constraints
MUST DO
- Follow C++ Core Guidelines
- Use concepts for template constraints
- Apply RAII universally
- Use
autowith type deduction - Prefer
std::unique_ptrandstd::shared_ptr - Enable all compiler warnings (-Wall -Wextra -Wpedantic)
- Run AddressSanitizer and UndefinedBehaviorSanitizer
- Write const-correct code
MUST NOT DO
- Use raw
new/delete(prefer smart pointers) - Ignore compiler warnings
- Use C-style casts (use static_cast, etc.)
- Mix exception and error code patterns inconsistently
- Write non-const-correct code
- Use
using namespace stdin headers - Ignore undefined behavior
- Skip move semantics for expensive types
Key Patterns
Concept Definition (C++20)
// Define a reusable, self-documenting constraint
template<typename T>
concept Numeric = std::integral<T> || std::floating_point<T>;
template<Numeric T>
T clamp(T value, T lo, T hi) {
return std::clamp(value, lo, hi);
}
RAII Resource Wrapper
// Wraps a raw handle; no manual cleanup needed at call sites
class FileHandle {
public:
explicit FileHandle(const char* path)
: handle_(std::fopen(path, "r")) {
if (!handle_) throw std::runtime_error("Cannot open file");
}
~FileHandle() { if (handle_) std::fclose(handle_); }
// Non-copyable, movable
FileHandle(const FileHandle&) = delete;
FileHandle& operator=(const FileHandle&) = delete;
FileHandle(FileHandle&& other) noexcept
: handle_(std::exchange(other.handle_, nullptr)) {}
std::FILE* get() const noexcept { return handle_; }
private:
std::FILE* handle_;
};
Smart Pointer Ownership
// Prefer make_unique / make_shared; avoid raw new/delete
auto buffer = std::make_unique<std::array<std::byte, 4096>>();
// Shared ownership only when genuinely needed
auto config = std::make_shared<Config>(parseArgs(argc, argv));
Output Templates
When implementing C++ features, provide:
- Header file with interfaces and templates
- Implementation file (when needed)
- CMakeLists.txt updates (if applicable)
- Test file demonstrating usage
- Brief explanation of design decisions and performance characteristics
Related skills
More from jeffallan/claude-skills and the wider catalog.

laravel-specialist
Build Laravel 10+ applications with Eloquent models, Sanctum auth, queues, APIs, and Livewire components.

golang-pro
Senior Go developer for concurrent systems, microservices, and production-grade performance optimization.

flutter-expert
Senior Flutter engineer for cross-platform apps with Riverpod, Bloc, GoRouter, and performance optimization.

php-pro
Senior PHP developer for modern PHP 8.3+, Laravel, Symfony with strict typing, PHPStan level 9, and enterprise patterns.

kubernetes-specialist
Deploy and manage Kubernetes workloads with secure manifests, RBAC, networking, and troubleshooting.

devops-engineer
Creates Dockerfiles, CI/CD pipelines, Kubernetes manifests, and infrastructure-as-code templates for deployment automation.