Cpp Idioms
Cpp Idioms teaches you how to write safe, efficient C++ code using modern language features and proven design patterns. Learn RAII principles, smart pointer ownership models, move semantics, and error handling with std::expected—all grounded in C++17/20/23 standards. The skill covers interfaces, dependency injection, testing strategies, and anti-patterns to avoid, with practical code examples and tooling guidance.
Cpp Idioms teaches modern C++ best practices including RAII, smart pointers, and move semantics for safe, performant code.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-17
Cpp Idioms teaches modern C++ best practices including RAII, smart pointers, and move semantics for safe, performant code. Cpp Idioms teaches you how to write safe, efficient C++ code using modern language features and proven design patterns. Learn RAII principles, smart pointer ownership models, move semantics, and error handling with std::expected—all grounded in C++17/20/23 standards. The skill covers interfaces, dependency injection, testing strategies, and anti-patterns to avoid, with practical code examples and tooling guidance.
Use it when
- Cpp Idioms focuses on writing safe, efficient code using C++17/20/23 features and proven design patterns.
- Cpp Idioms covers structured bindings for elegant tuple unpacking, constexpr for compile-time evaluation.
Verify before relying
Read SKILL.md below before installing (1 file). Open directory: indexed for reading, not audited.
Install
irahardianto/awesome-agv/cpp-idioms · repository language: JavaScript
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What are RAII, smart pointers, unique_ptr, and shared_ptr in Cpp Idioms?
Cpp Idioms teaches RAII (Resource Acquisition Is Initialization) as the cornerstone of C++ memory safety. Smart pointers—unique_ptr and shared_ptr—encode ownership semantics directly in the type system. unique_ptr provides exclusive ownership with zero-cost abstraction; shared_ptr enables shared ownership with reference counting. Together they eliminate manual delete calls and prevent leaks, dangling pointers, and use-after-free bugs. Cpp Idioms shows how to choose the right pointer type for each ownership pattern.
How does Cpp Idioms cover modern C++ idioms and best practices?
Cpp Idioms focuses on writing safe, efficient code using C++17/20/23 features and proven design patterns. It teaches move semantics, value semantics, structured bindings, std::optional, and std::variant for expressive type-safe designs. The skill emphasizes zero-cost abstractions, the rule of five and rule of zero, and how to avoid anti-patterns. Practical code examples ground each concept, helping you apply idioms immediately in real projects.
What C++17, C++20, and C++23 features does Cpp Idioms teach?
Cpp Idioms covers structured bindings for elegant tuple unpacking, constexpr for compile-time evaluation, std::optional and std::variant for safe optional and union types, and string_view for zero-copy parameter passing. C++20 concepts and ranges enable type-safe generic programming with clearer error messages. C++23 additions continue this trend toward safer, more expressive abstractions. Each feature is shown in context with real-world use cases.
How does Cpp Idioms approach error handling with std::expected?
Cpp Idioms teaches std::expected as a modern alternative to exceptions for error handling. It represents either a success value or an error, enabling composable, exception-safe code paths. The skill contrasts std::expected with exceptions, showing when each is appropriate. You'll learn how to write exception-safe code, understand strong and weak guarantees, and use std::expected to encode error states in the type system for compile-time safety.
What testing, formatting, and static analysis tools does Cpp Idioms cover?
Cpp Idioms guides you through setting up a modern C++ project with CMake, Google Test for unit testing, Google Mock for mocking, clang-format for consistent code style, and clang-tidy for static analysis. These tools enforce idioms and catch bugs early. The skill shows how to integrate them into your workflow, configure them for your team's standards, and use them to maintain code quality and catch anti-patterns automatically.
How do move semantics and value semantics fit into Cpp Idioms?
Cpp Idioms teaches move semantics as the mechanism for efficient resource transfer without copying. You'll learn when to use move constructors, move assignment, and std::move, and how they interact with copy operations. Value semantics—treating objects as values rather than pointers—is emphasized for safety and clarity. The skill shows how move semantics enable zero-copy abstractions and how to design types that are both efficient and easy to reason about.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
C++ Idioms and Patterns
Modern C++ (17/20/23) rewards RAII, value semantics, and zero-cost abstractions. Lean into the type system and smart pointers. Idiomatic C++ = safe, deterministic, performant.
> Scope: C++ coding idioms. Test naming: .agents/rules/testing-strategy.md.
Ownership and Memory
- RAII — resources tied to object lifetime. No manual
new/delete. std::unique_ptrfor exclusive ownership,std::shared_ptronly when sharing is necessary.- Move semantics — prefer moving over copying for expensive types.
- Rule of Five/Zero: ```cpp // ✅ Rule of Zero — let compiler-generated defaults work class TaskService { std::unique_ptr<TaskStorage> storage_; std::shared_ptr<Logger> logger_; public: // No destructor, copy/move constructors needed — smart pointers handle it explicit TaskService(std::unique_ptr<TaskStorage> storage, std::shared_ptr<Logger> logger) : storage_(std::move(storage)), logger_(std::move(logger)) {} };
// ✅ Rule of Five — when managing raw resources (rare) class Buffer {
(truncated - see the full file via the links below)
File tree — 1 file
.agents/skills/cpp-idioms/SKILL.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Learn modern C++ idioms and best practices for safe, performant code”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
This skill covers the core patterns that make Swift code safe and maintainable. You'll learn when to use structs over classes, how to handle optionals without crashes, design with protocols instead of inheritance, and leverage Swift's concurrency model. The guide includes practical examples of error handling, property wrappers, actors, and testing strategies—plus anti-patterns to avoid.
This skill delivers comprehensive coding standards rooted in the C++ Core Guidelines, covering modern C++17/20/23 practices. It emphasizes type safety, resource management through RAII, immutability by default, and clear intent in code design. Use it when writing new code, reviewing existing implementations, or making architectural decisions to enforce consistent, safe, and idiomatic C++ across your projects.
cpp-rules provides comprehensive C++ development standards drawn from ai-toolkit's rule library. It covers naming conventions, modern language features, memory management with smart pointers, and framework guidance for CMake, Boost, Qt, and gRPC. The rules emphasize RAII patterns, error handling strategies, concurrency practices, and design patterns to maintain code quality and security across C++ projects.
This skill guides developers through modern C++ best practices rooted in the C++ Core Guidelines, covering type safety, resource management via RAII, immutability, and clear interfaces. Apply it when writing, reviewing, or refactoring C++ code to maintain consistency and prevent common errors across your codebase.
Learn idiomatic C# patterns that leverage type safety, LINQ expressiveness, and async-first design. This skill covers modern features like nullable reference types, records, and pattern matching, plus practical guidance on error handling, dependency injection, and testing with xUnit.
This skill covers contemporary C++ practices from C++11 onward, emphasizing memory safety through smart pointers (unique_ptr, shared_ptr, weak_ptr) and the RAII pattern for automatic resource cleanup. You'll explore move semantics and perfect forwarding to optimize performance, dive into function and class templates with specialization techniques, and learn STL containers and algorithms for efficient data manipulation.
More skills cpp-expert (Apache-2.0) · Kotlin Idioms (MIT) · Cpp (unlicensed) · Java Idioms (MIT) · cpp-pro (MIT)