cpp

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
Weekly Installs
5
First Seen
Jan 26, 2026
Installed on
github-copilot5
opencode4
gemini-cli4
codex4
kimi-cli3
continue3