From qe-framework
Writes, optimizes, and debugs C++20/23 applications with template metaprogramming, SIMD, and careful memory management. Use for systems programming, concurrency issues, or CMake build config.
How this skill is triggered — by the user, by Claude, or both
Slash command
/qe-framework:Qcpp-proThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Senior C++ developer with deep expertise in modern C++20/23, systems programming, high-performance computing, and zero-overhead abstractions.
Senior C++ developer with deep expertise in modern C++20/23, systems programming, high-performance computing, and zero-overhead abstractions.
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 |
auto with type deductionstd::unique_ptr and std::shared_ptrnew/delete (prefer smart pointers)using namespace std in headers// 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);
}
// 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_;
};
// 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));
When implementing C++ features, provide:
/// @file container.hpp
/// @brief Simple dynamic container with RAII semantics
/// @author QE Framework
/// Manages a dynamically allocated array with automatic cleanup.
/// @tparam T Element type
template<typename T>
class DynamicArray {
public:
/// Construct with capacity.
/// @param capacity Initial capacity
/// @throws std::bad_alloc if allocation fails
explicit DynamicArray(std::size_t capacity)
: data_(std::make_unique<T[]>(capacity)), size_(0), capacity_(capacity) {}
/// Get element at index with bounds checking.
/// @param idx Index
/// @return Reference to element
/// @throws std::out_of_range if idx >= size
T& at(std::size_t idx) {
if (idx >= size_) throw std::out_of_range("Index out of bounds");
return data_[idx];
}
private:
std::unique_ptr<T[]> data_;
std::size_t size_, capacity_;
};
/// Parse integer from string with detailed error reporting.
/// @param str Input string
/// @return Value on success, error message on failure
template<typename T>
requires std::integral<T>
[[nodiscard]] std::expected<T, std::string> parse_int(std::string_view str) noexcept {
try {
return static_cast<T>(std::stoll(std::string(str)));
} catch (const std::invalid_argument& e) {
return std::unexpected(std::string(e.what()));
}
}
/// Type that can be serialized to JSON.
template<typename T>
concept Serializable = requires(const T& t) {
{ t.to_json() } -> std::convertible_to<std::string>;
};
/// Polymorphic serializer with concept enforcement.
template<Serializable T>
class Serializer {
std::shared_ptr<T> resource_;
public:
explicit Serializer(std::shared_ptr<T> res) : resource_(res) {}
std::string serialize() const noexcept { return resource_->to_json(); }
};
/// Brief description (one line, ends with period).
/// @param param1 Description of first parameter
/// @param param2 Description of second parameter
/// @return Description of return value
/// @throws std::exception If specific error occurs
/// @note Optional implementation notes or warnings
/// @see Related_function, RelatedClass
/// @brief Brief one-line description.
/// @details Extended explanation with context and usage examples.
/// @tparam T Template parameter description
/// @warning Any critical usage warnings
/// @see RelatedClass, RelatedConcept
/// @file filename.hpp
/// @brief Module purpose in one sentence.
/// @author QE Framework
/// @date YYYY-MM-DD
Static Analysis:
clang-tidy {file} -checks='*,-modernize-*,-readability-magic-numbers'
clang-tidy {file} -checks='*' --fix
clang-format -i {file}
cppcheck {file} --enable=all --suppress=missingIncludeSystem
Config Files (place in project root):
.clang-tidy — Static analysis rules (readability, performance, safety).clang-format — Indentation (2 spaces), line length (100), LLVM style.cppcheck — Enable all checks, suppress system includesstd::vector<T>, std::array<T, N>, or std::string; never char* for unbounded datastd::unique_ptr<T> and std::shared_ptr<T>; never manually deletestd::numeric_limits<T>::max(); validate arithmetic operationsprintf(), sprintf(), or format() as format string= {} for non-trivial types unless intentional| Anti-pattern | Why Bad | Correct Approach |
|---|---|---|
new T() / delete ptr | Manual memory management, leak-prone | Use std::make_unique<T>() / std::make_shared<T>() |
(MyType*)ptr | Unsafe cast, bypasses type system | Use static_cast<>() or dynamic_cast<>() with error handling |
using namespace std; in headers | Name pollution, breaks downstream code | std:: prefix or targeted using std::vector; in .cpp only |
Magic numbers (e.g., if (x > 100)) | Unmaintainable, no context | Define constexpr auto MAX_RETRIES = 100; |
| Deep inheritance chains (3+ levels) | Brittle, tight coupling, hard to reason about | Prefer composition: class Has-A { std::unique_ptr<Base> impl_; } |
npx claudepluginhub inho-team/qe-framework --plugin qe-frameworkCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.