cpp-development

Guides writing, reviewing, and refactoring modern C++17/20 code with patterns and checklists.

Updated May 22, 2026
One-click install
npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill cpp-development-viniciuscs84
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cpp-development
Source: https://github.com/viniciuscs84/sdd-toolkit/tree/main/skills/cpp-development
Command: npx skills add https://github.com/viniciuscs84/sdd-toolkit --skill cpp-development-viniciuscs84

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing safe, idiomatic modern C++ is error-prone: raw memory management, undefined behavior, and outdated patterns slip into codebases without a structured workflow. This Skill provides a consistent process and concrete rules for producing correct C++17/20 code. ## Core Features & Use Cases - Structured Workflow: A five-step process covering analysis of build flags, concept-based design, zero-cost implementation, sanitizer-driven verification, and profile-guided optimization. - Essential Patterns: Ready-to-apply guidance on Rule of Zero/Five, parameter passing, smart pointers, RAII, const correctness, C++20 concepts, and scoped enums. - Pre-Commit Checklist & Pitfalls: A ten-point checklist plus documented traps like unnamed lock_guards, virtual calls in constructors, and catching exceptions by value. - Use Case: When refactoring a legacy class that manages a raw buffer, apply the Rule of Five example to convert it to unique_ptr-based ownership, then run AddressSanitizer and UBSan to verify correctness before committing. ## Quick Start Ask the assistant to review your C++ file using the cpp-development skill and apply its pre-commit checklist.

Frequently Asked Questions about cpp-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write modern C++ code following best practices?

Follow a five-step workflow: analyze build flags and standard version, design interfaces with C++20 concepts, implement with RAII and smart pointers, verify with AddressSanitizer and UBSan, then optimize only after profiling with perf or callgrind.

How to choose between unique_ptr and shared_ptr in C++?

Use std::make_unique for default single ownership and std::make_shared only when shared ownership is genuinely required. Raw pointers should appear solely as non-owning observers in function parameters.

What is the difference between Rule of Zero and Rule of Five?

Rule of Zero means composing from resource-managing types so the compiler generates all special members. Rule of Five applies when a class owns a raw resource directly, requiring you to define or delete the destructor, copy, and move operations.

Does C++20 concepts improve template error messages?

Yes, constraining templates with concepts like std::integral or custom requires-expressions produces clear diagnostics at the call site instead of deep instantiation errors. For pre-C++20 code, static_assert serves as the fallback.

Why is my lock_guard not preventing race conditions?

An unnamed lock_guard like std::lock_guard<std::mutex>(m) creates a temporary destroyed immediately, releasing the lock. Always name the variable, e.g. std::lock_guard<std::mutex> lk{m}, so it lives until scope exit.

Can volatile be used for thread synchronization in C++?

No, volatile only prevents compiler reordering and provides no CPU memory-ordering guarantees. Use std::atomic<T> or mutexes with RAII locks for correct inter-thread synchronization.