SOC 직업 분류 기준
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/miles990/claude-software-skills --skill cpp명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SKILL.md 표시 중
Enterprise-grade repository analysis with arc42/C4 architecture documentation, technical debt quantification, security assessment, and multi-stakeholder reporting
Claude Code Plugin 開發、發布、安裝、更新與 Marketplace 管理完整指南
Flame Engine core fundamentals - components, input, collision, camera, animation, scenes
| name | cpp |
| description | Modern C++ programming patterns and idioms |
| domain | programming-languages |
| version | 1.0.0 |
| tags | ["cpp","c++","stl","raii","templates","memory"] |
| triggers | {"keywords":{"primary":["cpp","c++","cmake","stl","template","raii"],"secondary":["smart pointer","move","constexpr","lambda","boost","qt"]},"context_boost":["systems","performance","embedded","game","graphics"],"context_penalty":["python","javascript","java","web"],"priority":"high"} |
Modern C++ (C++11 and beyond) patterns including RAII, smart pointers, templates, and STL.
#include <memory>
#include <iostream>
// unique_ptr - exclusive ownership
class Resource {
public:
Resource() { std::cout << "Resource acquired\n"; }
~Resource() { std::cout << "Resource released\n"; }
void use() { std::cout << "Resource used\n"; }
};
void unique_ptr_example() {
// Create unique_ptr
auto ptr = std::make_unique<Resource>();
ptr->use();
// Transfer ownership
auto ptr2 = std::move(ptr);
// ptr is now nullptr
// Array support
auto arr = std::make_unique<int[]>(10);
}
// shared_ptr - shared ownership
void shared_ptr_example() {
auto shared1 = std::make_shared<Resource>();
{
auto shared2 = shared1; // Reference count = 2
shared2->use();
} // shared2 destroyed, count = 1
std::cout << "Use count: " << shared1.use_count() << "\n";
} // shared1 destroyed, resource released
// weak_ptr - non-owning reference
class Node {
public:
std::shared_ptr<Node> next;
std::weak_ptr<Node> prev; // Avoid circular reference
~Node() { std::cout << "Node destroyed\n"; }
};
void weak_ptr_example() {
auto node1 = std::make_shared<Node>();
auto node2 = std::make_shared<Node>();
node1->next = node2;
node2->prev = node1; // weak_ptr, no ownership
if (auto locked = node2->prev.lock()) {
// Use locked (shared_ptr)
}
}
#include <fstream>
#include <mutex>
// File wrapper with RAII
class File {
std::fstream file_;
public:
explicit File(const std::string& filename)
: file_(filename, std::ios::in | std::ios::out) {
if (!file_.is_open()) {
throw std::runtime_error("Failed to open file");
}
}
~File() {
if (file_.is_open()) {
file_.close();
}
}
// Delete copy operations
File(const File&) = delete;
File& operator=(const File&) = delete;
// Allow move operations
File(File&& other) noexcept : file_(std::move(other.file_)) {}
File& operator=(File&& other) noexcept {
file_ = std::move(other.file_);
return *this;
}
void write(const std::string& data) {
file_ << data;
}
};
// Lock guard (RAII for mutex)
class ThreadSafeCounter {
std::mutex mutex_;
count_ = ;
:
{
;
++count_;
}
{
;
count_;
}
};
< F>
{
F cleanup_;
active_ = ;
:
}
~() {
(active_) ();
}
{ active_ = ; }
( ScopeGuard&) = ;
ScopeGuard& =( ScopeGuard&) = ;
};
{
resource = ();
;
guard.();
}
#include <vector>
#include <string>
#include <utility>
class Buffer {
std::unique_ptr<char[]> data_;
size_t size_;
public:
// Constructor
explicit Buffer(size_t size) : data_(new char[size]), size_(size) {}
// Copy constructor
Buffer(const Buffer& other) : data_(new char[other.size_]), size_(other.size_) {
std::copy(other.data_.get(), other.data_.get() + size_, data_.get());
}
// Move constructor
Buffer(Buffer&& other) noexcept
: data_(std::move(other.data_)), size_(other.size_) {
other.size_ = 0;
}
// Copy assignment
Buffer& operator=(const Buffer& other) {
if (this != &other) {
data_.reset(new char[other.size_]);
size_ = other.size_;
std::copy(other.data_.get(), other.data_.get() + size_, data_.get());
}
*;
}
Buffer& =(Buffer&& other) {
( != &other) {
data_ = std::(other.data_);
size_ = other.size_;
other.size_ = ;
}
*;
}
{ size_; }
};
{
std::<T>( (std::forward<Args>(args)...));
}
#include <type_traits>
#include <concepts>
// Basic template
template<typename T>
T max(T a, T b) {
return (a > b) ? a : b;
}
// Template specialization
template<>
const char* max<const char*>(const char* a, const char* b) {
return (strcmp(a, b) > 0) ? a : b;
}
// SFINAE (Substitution Failure Is Not An Error)
template<typename T>
typename std::enable_if<std::is_integral<T>::value, T>::type
double_value(T value) {
return value * 2;
}
// C++20 Concepts
template<typename T>
concept Numeric = std::is_arithmetic_v<T>;
template<Numeric T>
T add(T a, T b) {
return a + b;
}
// Requires clause
template<typename T>
requires std::is_default_constructible_v<T>
T create_default() {
return T{};
}
{
(std::cout << ... << args) << ;
}
{
(args + ...);
}
// Generic container
template<typename T, size_t N>
class Array {
T data_[N];
public:
constexpr size_t size() const { return N; }
T& operator[](size_t index) {
if (index >= N) throw std::out_of_range("Index out of range");
return data_[index];
}
const T& operator[](size_t index) const {
if (index >= N) throw std::out_of_range("Index out of range");
return data_[index];
}
T* begin() { return data_; }
T* end() { return data_ + N; }
const T* begin() const { return data_; }
const T* end() const { return data_ + N; }
};
// Template with default arguments
template<typename T, typename Allocator = std::allocator<T>>
Vector {
};
< T>
<T*> {
};
< Derived>
{
count_ = ;
:
() { ++count_; }
~() { --count_; }
{ count_; }
};
: Counter<Widget> {
};
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <numeric>
void container_examples() {
// vector
std::vector<int> vec{1, 2, 3, 4, 5};
vec.push_back(6);
vec.emplace_back(7); // Construct in place
// map
std::map<std::string, int> ordered_map;
ordered_map["one"] = 1;
ordered_map.insert({"two", 2});
ordered_map.try_emplace("three", 3);
// unordered_map
std::unordered_map<std::string, int> hash_map;
hash_map["one"] = 1;
// set
std::set<int> ordered_set{3, 1, 4, 1, 5};
auto [iter, inserted] = ordered_set.();
}
{
std::vector<> vec{, , , , , };
std::(vec.(), vec.());
std::(vec.(), vec.(), std::<>());
it = std::(vec.(), vec.(), );
it2 = std::(vec.(), vec.(), []( n) { n > ; });
;
std::(vec.(), vec.(), doubled.(), []( n) { n * ; });
sum = std::(vec.(), vec.(), );
vec.(std::(vec.(), vec.(), []( n) { n < ; }), vec.());
}
#include <thread>
#include <future>
#include <mutex>
#include <condition_variable>
#include <atomic>
// Basic threading
void thread_example() {
std::thread t([]() {
std::cout << "Hello from thread\n";
});
t.join();
}
// async/future
std::future<int> async_example() {
return std::async(std::launch::async, []() {
std::this_thread::sleep_for(std::chrono::seconds(1));
return 42;
});
}
// promise/future
void promise_example() {
std::promise<int> promise;
std::future<int> future = promise.get_future();
std::thread producer([&promise]() {
promise.set_value(42);
});
int result = future.get();
producer.join();
}
// Thread-safe queue
template< T>
{
std::queue<T> queue_;
std::mutex mutex_;
std::condition_variable cond_;
:
{
;
queue_.(std::(value));
cond_.();
}
{
;
cond_.(lock, []() { !queue_.(); });
T value = std::(queue_.());
queue_.();
value;
}
{
;
(queue_.()) ;
value = std::(queue_.());
queue_.();
;
}
};
{
std::atomic<> count_{};
:
{ count_.(, std::memory_order_relaxed); }
{ count_.(std::memory_order_relaxed); }
};
#include <functional>
void lambda_examples() {
// Basic lambda
auto add = [](int a, int b) { return a + b; };
// Capture by value
int x = 10;
auto by_value = [x]() { return x; };
// Capture by reference
auto by_ref = [&x]() { x++; };
// Capture all by value
auto all_value = [=]() { return x; };
// Capture all by reference
auto all_ref = [&]() { x++; };
// Mutable lambda (modify captured values)
auto mutable_lambda = [x]() mutable { return ++x; };
// Generic lambda (C++14)
auto generic = [](auto a, auto b) { return a + b; };
// Init capture (C++14)
auto ptr = std::make_unique<int>(42);
auto capture_move = [p = std::move(ptr)]() { return *p; };
// Template lambda (C++20)
auto template_lambda = []<typename T>(std::vector<T>& vec) {
return vec.size();
};
// Constexpr lambda (C++17)
constexpr square = []( n) { n * n; };
(() == );
}
{
std::function<()> handler_;
:
{
handler_ = std::(handler);
}
{
(handler_) (value);
}
};
#include <stdexcept>
#include <optional>
#include <variant>
#include <expected> // C++23
// Custom exception
class DatabaseError : public std::runtime_error {
int error_code_;
public:
DatabaseError(const std::string& message, int code)
: std::runtime_error(message), error_code_(code) {}
int error_code() const { return error_code_; }
};
// std::optional for nullable values
std::optional<int> find_value(const std::string& key) {
if (key == "answer") return 42;
return std::nullopt;
}
void optional_usage() {
auto result = find_value("answer");
if (result) {
std::cout << "Found: " << *result << "\n";
}
int value = result.value_or();
}
Result = std::variant<, std::string>;
{
(success) ;
std::();
}
{
Result r = ();
std::([](&& arg) {
T = std::<(arg)>;
(std::is_same_v<T, >) {
std::cout << << arg << ;
} {
std::cout << << arg << ;
}
}, r);
}