Claude-skill-registry coding-standard-cpp
Enforce C++ coding standards including camelCase or snake_case variables, PascalCase classes, and consistent file naming.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/coding-standard-cpp" ~/.claude/skills/majiayu000-claude-skill-registry-coding-standard-cpp && rm -rf "$T"
manifest:
skills/data/coding-standard-cpp/SKILL.mdsource content
C++ Coding Standards
When reviewing or generating C++ code, follow these rules:
File Naming
- Source files: snake_case or PascalCase with
extension (e.g.,.cpp
oruser_service.cpp
)UserService.cpp - Header files: Same base name with
,.h
, or.hpp
extension.hxx - Template files:
or.tpp
for template implementations.inl - Be consistent within a project
Header Guards / Pragma
- Prefer
for modern compilers#pragma once - Or use traditional guards: UPPER_SNAKE_CASE with
suffix_HPP
#pragma once // or #ifndef USER_SERVICE_HPP #define USER_SERVICE_HPP #endif
Namespace Naming
- Namespaces: all_lowercase or snake_case (e.g.,
,myproject
)data_processing - Nested namespaces: Use C++17 syntax when possible (e.g.,
)namespace project::utils {} - Avoid
in headersusing namespace
Variable Naming
- Local variables: snake_case or camelCase (e.g.,
oruser_count
)userCount - Member variables: Prefix with
or suffix withm_
(e.g.,_
orm_data
)data_ - Static members: Prefix with
(e.g.,s_
)s_instance - Constants: UPPER_SNAKE_CASE or kPascalCase (e.g.,
orMAX_SIZE
)kMaxSize - Global variables: Prefix with
(e.g.,g_
)g_config
Function/Method Naming
- Free functions: snake_case or camelCase (e.g.,
orcalculate_total()
)calculateTotal() - Member functions: camelCase or PascalCase (e.g.,
orgetUserId()
)GetUserId() - Getters/Setters:
/get
prefix or just property name (e.g.,set
orgetName()
)name() - Factory functions:
,Create
, orMake
prefix (e.g.,Build
)CreateUser()
Class/Type Naming
- Classes: PascalCase (e.g.,
,UserService
)DataProcessor - Structs: PascalCase (e.g.,
,Point
)Rectangle - Interfaces: PascalCase with
prefix optional (e.g.,I
orISerializable
)Serializable - Template parameters: Single letter or PascalCase (e.g.,
,T
,Container
)KeyType - Enums: PascalCase for type, UPPER_SNAKE_CASE or PascalCase for values
- Type aliases: PascalCase (e.g.,
)using StringList = std::vector<std::string>;
Smart Pointers
- Use
for single ownershipstd::unique_ptr - Use
for shared ownershipstd::shared_ptr - Avoid raw
/newdelete
Organization
- Include guards / pragma once
- System includes (alphabetical)
- Project includes (alphabetical)
- Forward declarations
- Namespace opening
- Class declarations
- Inline/template implementations