cpp-oop-design

Enforces SOLID principles and design patterns for C++ module design and code review.

6|2|Updated May 6, 2026
One-click install
npx skills add https://github.com/sek788432/Stock-Back-Test-System --skill cpp-oop-design-sek788432
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: cpp-oop-design
Source: https://github.com/sek788432/Stock-Back-Test-System/tree/main/.agents/skills/cpp-oop-design
Command: npx skills add https://github.com/sek788432/Stock-Back-Test-System --skill cpp-oop-design-sek788432

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? C++ codebases drift toward god classes, one-shot helpers, and premature abstractions that become unmaintainable. This Skill gives AI agents and reviewers concrete rules for abstraction, composition, and pattern selection so new modules and refactors stay maintainable. ## Core Features & Use Cases - SOLID and composition guidance: Plain-language rules for single responsibility, narrow public interfaces, and composition over inheritance, with illustrative C++20 snippets. - Design pattern catalog: When-to-apply criteria for Strategy, Factory, Observer, Adapter, Builder, Pimpl, Visitor, Chain of Responsibility, Command, Decorator, and templated policy classes. - Anti-pattern rejection list: Refuses god classes, boolean behavior flags, out-parameters, singleton managers, and premature interfaces (two-strikes/YAGNI rule). - Use Case: When adding a new indicator type to the backtesting engine, use this Skill to decide whether to extend a Strategy seam, add a Factory variant, or keep the code concrete until a second implementation appears. ## Quick Start Ask the agent to review the design of a new C++ class or module using the cpp-oop-design rules before committing.

Frequently Asked Questions about cpp-oop-design

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

FAQPage Schema
How do I decide between composition and inheritance in C++?▼

Default to composition and inherit only to expose polymorphism. If you find yourself adding a third level of inheritance or creating a base class just to share helper code, refactor to composition, free functions, or CRTP mixins instead.

When should I apply a design pattern like Strategy or Factory?▼

Apply Strategy when callers select among algorithm variants at runtime behind a small interface, and Factory when configuration selects among at least two implemented concrete types. Do not introduce a pattern for its own name or for a single implementation.

When should I introduce an interface or abstraction in C++?▼

Follow the two-strikes rule: write the first occurrence concrete, factor it into a function or class the second time the shape appears. Do not pre-abstract for future flexibility; add the interface when the second concrete implementation arrives.

How do I separate interface from implementation in C++ headers?▼

Place pure abstract interfaces, value types, and factory functions in public headers, and keep implementation classes in private headers and .cpp files. Use forward declarations and Pimpl to avoid dragging heavy third-party includes into public headers.

What C++ design anti-patterns should code reviews reject?▼

Reject god classes, inheritance used only for code reuse, switch-on-type-tag behavior dispatch, boolean parameters that change behavior, out-parameters, singleton manager state, and interfaces with a single implementation unlikely to grow.