meyers_skill

This skill helps you write robust C++ code by applying Meyers Effective C++ guidelines for safer, clearer, and more maintainable interfaces.
  • Python

3

GitHub Stars

2

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill copyleftdev/sk1llz --skill meyers

  • references.md2.2 KB
  • SKILL.md6.0 KB

Overview

This skill encodes Scott Meyers' Effective C++ principles into practical, actionable guidance for writing robust C++ code. It emphasizes designing interfaces that are easy to use correctly, minimizing surprises from implicit language behavior, and favoring compile-time safety. Use it to produce code that is correct, maintainable, and efficient in production settings.

How this skill works

The skill inspects C++ design and implementation choices and suggests concrete patterns: safer constructors, assignment idioms, initialization rules, dependency minimization, and preferred use of non-member functions. It highlights common gotchas (implicit special members, self-assignment, virtual behavior) and recommends idiomatic fixes (explicit single-argument constructors, copy-and-swap, pImpl, value semantics). Advice is paired with short rationale so users understand the underlying C++ mechanics.

When to use it

  • Designing public APIs or library interfaces
  • Refactoring code to improve safety and maintainability
  • Implementing resource-managing types (RAII) and assignment/ctor behavior
  • Reducing header dependencies and speeding builds
  • Preparing code for code review or production release

Best practices

  • Make interfaces easy to use correctly and hard to misuse
  • Prefer compile-time checks over runtime behavior; use type system and explicit constructors
  • Always initialize members in declaration order; prefer initialization over assignment
  • Declare destructors virtual in polymorphic bases and never let exceptions escape destructors
  • Implement operator= safely (handle self-assignment) using copy-and-swap or strong exception-safe patterns
  • Minimize header coupling (pImpl, forward declarations) and prefer non-member non-friend functions for algorithms

Example use cases

  • Convert error-prone constructors to type-safe parameter types (e.g., Month/Day/Year)
  • Replace unsafe assignment operators with copy-and-swap to handle self-assignment and exceptions
  • Introduce pImpl to reduce compilation dependencies and hide implementation details
  • Refactor utility algorithms into non-member functions to keep class interfaces small
  • Audit a class for implicitly-generated special members and explicitly declare/define where needed

FAQ

Make single-argument constructors explicit to avoid unintended implicit conversions. If implicit conversion is desired, document it and provide a converting function instead.

Why prefer non-member non-friend functions?

They preserve encapsulation by keeping the class interface minimal, enable ADL lookup, and avoid inflating class responsibilities; use them when the operation can be expressed via the public interface.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational