coding-standard-cpp

Enforce C++ naming, header guards, namespaces, and smart pointer standards.

27|7|Updated Dec 6, 2025
One-click install
npx skills add https://github.com/jdubray/puffin --skill coding-standard-cpp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coding-standard-cpp
Source: https://github.com/jdubray/puffin/tree/main/.claude/skills/coding-standard-cpp
Command: npx skills add https://github.com/jdubray/puffin --skill coding-standard-cpp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforce C++ coding standards to prevent style drift, improve readability, and ensure maintainability across large codebases.

Core Features & Use Cases

  • File Naming: Source files use snake_case or PascalCase; header files share the same base name with .h, .hpp, or .hxx extensions; templates use .tpp or .inl.
  • Header Guards / Pragma: Prefer #pragma once or traditional guards using UPPER_SNAKE_CASE with a _HPP suffix.
  • Namespace Naming: Namespaces should be all lowercase or snake_case; nested namespaces may use C++17 syntax when possible.
  • Variable Naming: Local variables use snake_case or camelCase; member variables are prefixed with m_ or suffixed with ; static members prefixed with s; constants use UPPER_SNAKE_CASE or kPascalCase; global variables prefixed with g_.
  • Function/Method Naming: Free functions use snake_case or camelCase; member functions use camelCase or PascalCase; getters/setters follow getName / setName patterns; factory functions use Create, Make, or Build.
  • Class/Type Naming: Classes and structs use PascalCase; interfaces optionally use I- prefix; template parameters are single letters or descriptive PascalCase; enums use PascalCase for type and UPPER_SNAKE_CASE for values; type aliases use PascalCase.
  • Smart Pointers: Prefer std::unique_ptr for single ownership and std::shared_ptr for shared ownership; avoid raw new/delete.
  • Organization: Include guards or pragma once; keep system includes alphabetized, then project includes; use forward declarations; open namespaces; declare classes and inline/template implementations.

Quick Start

Run a code review pass to align file naming, guards, namespaces, and naming conventions across your C++ project.

Frequently Asked Questions about coding-standard-cpp

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

FAQPage Schema
How do I enforce C++ coding standards for naming conventions and header guards?

To enforce C++ coding standards, apply rules for file naming, header guards, namespaces, and variable prefixes across your project. This prevents style drift and ensures uniform naming like snake_case for locals, PascalCase for classes, and UPPER_SNAKE_CASE for header guard suffixes.

What naming conventions should I use for C++ variables, functions, and classes?

C++ naming conventions specify PascalCase for classes, snake_case or camelCase for local variables, m_ prefixes for members, and UPPER_SNAKE_CASE for constants. Functions use camelCase or PascalCase, while getters and setters follow getName and setName patterns for consistency.

Should I use pragma once or traditional header guards in C++?

For C++ header guards, prefer #pragma once or traditional guards using UPPER_SNAKE_CASE with a _HPP suffix. Both methods prevent multiple inclusions, but #pragma once is less error-prone, while traditional guards offer broader compiler compatibility.

How do I organize C++ includes and namespaces for better code maintainability?

Organize C++ code by keeping system includes alphabetized followed by project includes, using forward declarations to reduce dependencies. Open namespaces, declare classes, and use C++17 nested namespace syntax to improve overall project organization and maintainability.

When do I need std::unique_ptr vs std::shared_ptr for smart pointers in C++?

Use std::unique_ptr for single ownership and std::shared_ptr for shared ownership in C++. Avoid raw new and delete operations entirely. This smart pointer convention ensures safe memory management and prevents leaks across large codebases.

Can this coding standard Skill manage C++ template files and inline implementations?

Yes, this C++ coding standard handles template files by specifying .tpp or .inl extensions for template implementations. It ensures inline and template code follows organizational rules for includes, forward declarations, and namespace structures.