cpp
Installation
SKILL.md
Critical Patterns
Smart Pointers (REQUIRED)
// ✅ ALWAYS: Use smart pointers
auto user = std::make_unique<User>("John");
auto shared = std::make_shared<Config>();
// ❌ NEVER: Raw new/delete
User* user = new User("John");
delete user;
RAII (REQUIRED)
// ✅ ALWAYS: Resource management through constructors/destructors
class FileHandle {
std::fstream file_;
public:
FileHandle(const std::string& path) : file_(path) {}
~FileHandle() { if (file_.is_open()) file_.close(); }
};
Modern Patterns (REQUIRED)
// ✅ Use auto for type deduction
auto items = std::vector<int>{1, 2, 3};
// ✅ Use range-based for loops
for (const auto& item : items) {
process(item);
}
// ✅ Use structured bindings
auto [name, age] = getPerson();
Decision Tree
Need unique ownership? → std::unique_ptr
Need shared ownership? → std::shared_ptr
Need optional value? → std::optional
Need multiple types? → std::variant
Need string views? → std::string_view
Commands
g++ -std=c++20 -Wall -Wextra main.cpp -o app
clang++ -std=c++20 main.cpp -o app
cmake -B build && cmake --build build
Related skills
More from poletron/custom-rules
lancedb
>
17clean-code
Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments
10vulnerability-scanner
Advanced vulnerability analysis principles. OWASP 2025, Supply Chain Security, attack surface mapping, risk prioritization.
8trpc
>
8web-performance-optimization
Optimize website and web application performance including loading speed, Core Web Vitals, bundle size, caching strategies, and runtime performance
7javascript-mastery
Comprehensive JavaScript reference covering 33+ essential concepts every developer should know. From fundamentals like primitives and closures to advanced patterns like async/await and functional programming. Use when explaining JS concepts, debugging JavaScript issues, or teaching JavaScript fundamentals.
7