cpp — скилл для Claude Code: что делает и как установить
Набор инструкций по современному C++17 и C++20. Помогает ассистенту писать безопасный код без сырых указателей, утечек памяти и архаичных C-конструкций.
npx skills add Mindrally/skills --skill cpp -a claude-codeЧто делает cpp
Скилл задаёт правила разработки на стандартах C++17 и C++20. Он требует использовать RAII, умные указатели std::unique_ptr и стандартные контейнеры вместо ручного выделения памяти через new и delete. В коде закрепляются именование с префиксом m_ для полей, std::string_view и std::span для невладеющих ссылок, а также концепты и диапазоны из C++20.
В инструкции заложены конкретные инструменты: сборка через CMake с пакетами vcpkg или Conan, документация Doxygen и юнит-тесты на Google Test либо Catch2 с проверкой через санитайзеры ASan, UBSan и TSan.
Эти правила требуют обработки ошибок исключительно через исключения. Если в проекте исключения отключены флагом -fno-exceptions, генерируемый код придётся переделывать вручную.
Какие задачи решает
- Перевести генерацию кода на стандарты C++17 и C++20
- Избавиться от утечек памяти с помощью RAII и умных указателей
- Настроить безопасную передачу буферов через
std::spanиstd::string_view - Добавить юнит-тесты на Google Test или Catch2 с санитайзерами
Примеры запросов агенту
- Напиши потокобезопасную очередь задач на C++20 с использованием
std::jthreadиstd::mutex - Отрефактори этот класс с сырыми указателями под умные указатели и идиому RAII
- Сделай парсер конфига с возвратом
std::optionalи валидацией черезstd::string_view
Как установить cpp
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill cpp -a claude-code2Вручную: положить файлы
~/.claude/skills/cpp/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/cpp/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill cpp -a codex2Вручную: положить файлы
.agents/skills/cpp/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill cpp -a cursor2Вручную: положить файлы
.cursor/skills/cpp/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills cpp2Вручную: положить файлы
.github/skills/cpp/SKILL.md1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill cpp -a gemini-cli2Командой платформы
gemini skills install https://github.com/Mindrally/skills --path cppВручную: положить файлы
.devin/skills/cpp/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill cpp -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о cpp
Как установить cpp в Claude Code?
Выполните команду npx skills add Mindrally/skills --skill cpp -a claude-code. Также можно вручную сохранить файл скилла по пути ~/.claude/skills/cpp/SKILL.md.
Какие стандарты языка продвигает скилл cpp?
Скилл ориентирован на C++17 и C++20. Он предписывает использовать концепты, диапазоны, корутины, std::span, std::optional и if constexpr.
Какие библиотеки тестирования и сборки требуются по правилам?
В качестве системы сборки задан CMake с пакетными менеджерами vcpkg или Conan. Для тестирования правила предписывают Google Test или Catch2 вместе с санитайзерами ASan, UBSan и TSan.
Исходный текст
SKILL.md · Apache-2.0
--- name: cpp description: Guidelines for modern C++ development with C++17/20 standards, memory safety, and performance optimization metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # C++ Development Guidelines You are an expert in modern C++ development with deep knowledge of C++17/20 standards, memory management, and high-performance programming. ## Code Style and Structure - Write clean, modern C++ code following C++17/20 standards - Use meaningful variable and function names - Follow the Single Responsibility Principle - Prefer composition over inheritance - Keep functions small and focused ## Naming Conventions - Use PascalCase for classes and structs - Use camelCase for functions, variables, and methods - Use SCREAMING_SNAKE_CASE for constants and macros - Use snake_case for namespaces - Prefix member variables with `m_` or use trailing underscore ## Memory Management ### Smart Pointers - Use `std::unique_ptr` for exclusive ownership - Use `std::shared_ptr` only when shared ownership is required - Use `std::weak_ptr` to break circular references - Avoid raw owning pointers ### RAII (Resource Acquisition Is Initialization) - Use RAII for all resource management - Wrap resources in classes with proper destructors - Ensure exception safety through RAII - Use scope guards for cleanup operations ### Best Practices - Prefer stack allocation over heap allocation - Use `std::make_unique` and `std::make_shared` - Avoid `new` and `delete` in application code - Use containers instead of raw arrays ## Modern C++ Features ### C++17 Features - Use structured bindings for tuple unpacking - Use `std::optional` for values that may not exist - Use `std::variant` for type-safe unions - Use `if constexpr` for compile-time conditionals - Use `std::string_view` for non-owning string references ### C++20 Features - Use concepts for template constraints - Use ranges for cleaner algorithms - Use `std::span` for non-owning array views - Use coroutines for asynchronous operations - Use modules for faster compilation (when supported) ## Error Handling - Use exceptions for error handling - Define custom exception types for domain-specific errors - Use `noexcept` for functions that don't throw - Catch exceptions by const reference - Provide strong exception guarantees where possible ## Performance - Use `const` and `constexpr` liberally - Prefer move semantics with `std::move` - Use perfect forwarding with `std::forward` - Avoid unnecessary copies - Profile before optimizing - Use `inline` for small frequently-called functions ## Security ### Buffer Safety - Use `std::array` instead of C-style arrays - Use `std::vector` with bounds checking - Prefer `std::string` over C-style strings - Use `std::span` for array views ### Type Safety - Avoid C-style casts; use `static_cast`, `dynamic_cast`, etc. - Use `enum class` instead of plain enums - Use `nullptr` instead of `NULL` - Enable compiler warnings and treat them as errors ## Concurrency - Use `std::thread` and `std::jthread` for threading - Use `std::mutex` and `std::lock_guard` for synchronization - Use `std::atomic` for lock-free operations - Prefer `std::async` for simple async operations - Use condition variables for thread coordination ## Testing - Write unit tests with Google Test or Catch2 - Use mocking frameworks like Google Mock - Test edge cases and error conditions - Use sanitizers (ASan, UBSan, TSan) during testing - Implement continuous integration testing ## Documentation - Use Doxygen-style comments for documentation - Document public APIs thoroughly - Include usage examples in documentation - Keep documentation up to date with code changes - Document thread safety requirements ## Build System - Use CMake for cross-platform builds - Organize code into logical modules - Use package managers (vcpkg, Conan) for dependencies - Enable compiler warnings and static analysis - Configure proper debug and release builds
© Mindrally · Apache-2.0 · Mindrally/skills