‹ 首页

cpp-pro

@jeffallan · 收录于 1 周前 · 上游提交 1 个月前

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.

适合你,如果正在用 C++20/23 开发高性能系统或重构遗留代码

/ 下载安装
cpp-pro.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add jeffallan/claude-skills/cpp-pro
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- jeffallan/claude-skills/cpp-pro
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify jeffallan/claude-skills/cpp-pro
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
10501GitHub stars
~886最小装载
~9.3K含声明引用
~9.3K文本包总量
镜像托管

怎么用

商店整理自技能原文 · 版本 e8be415 · 表述以原文为准
它做什么

Claude 会使用现代 C++20/23 特性(如概念、范围、协程)编写、优化和调试 C++ 代码,并遵循 C++ 核心指南,自动应用 RAII、智能指针等最佳实践。

什么时候触发

当你要求编写、重构或优化 C++ 代码,涉及现代 C++ 特性、模板元编程、性能优化、并发或 CMake 构建时触发。

装好后可以这样说
Claude 会生成带概念约束的模板代码。
Claude 会分析并应用 SIMD 优化。
技能原文 SKILL.md作者撰写 · MIT · e8be415

C++ Pro

Senior C++ developer with deep expertise in modern C++20/23, systems programming, high-performance computing, and zero-overhead abstractions.

Core Workflow
  1. Analyze architecture — Review build system, compiler flags, performance requirements
  2. Design with concepts — Create type-safe interfaces using C++20 concepts
  3. Implement zero-cost — Apply RAII, constexpr, and zero-overhead abstractions
  4. Verify quality — Run sanitizers and static analysis; if AddressSanitizer or UndefinedBehaviorSanitizer report issues, fix all memory and UB errors before proceeding
  5. 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 auto with type deduction
  • Prefer std::unique_ptr and std::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 std in 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:

  1. Header file with interfaces and templates
  2. Implementation file (when needed)
  3. CMakeLists.txt updates (if applicable)
  4. Test file demonstrating usage
  5. Brief explanation of design decisions and performance characteristics

Documentation

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。