google-cpp-style
Skill1 starsChanged 5 months agoMITView on GitHub
Enforce Google C++ Style Guide when writing, reviewing, or refactoring C++ code. Covers naming conventions, formatting rules, header file guidelines, scoping, class design, function best practices, modern C++ feature usage, and comment standards. Trigger when writing C++ code, reviewing C++ style, or when Google C++ Style Guide is mentioned.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- ClickHouse/pg_stat_chtheir own version, first seen Oct 9, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- ClickHouse/pg_stat_ch★ 129same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository2 other files it gives its agents.
The file
Show its rules and text
We split this skill into the rules it gives an agent
26 rules. About 0 are common, 9 are distinctive, and 17 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
17
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
When C++ code needs to be written or reviewed, load the full style guide reference:
- Distinctive: line 34
When generating or reviewing C++ code, verify compliance in these areas in order of priority:
- Very specific: line 50
Always use braces for if/for/while (no single-line bodies without braces)
- Very specific: line 56
Use #ifndef/#define/#endif guards with _H_ suffix
- Very specific: line 59
Avoid forward declarations.
- Very specific: line 62
Use explicit on single-argument constructors
- Very specific: line 64
Use struct only for passive data objects (POD)
- Very specific: line 65
Use class for everything else
- Very specific: line 67
Use override for all overridden virtual methods
- Distinctive: line 71
Prefer return values over output parameters
- Very specific: line 72
Use const& for input parameters
- Distinctive: line 73
Keep functions short (~40 lines max)
- Distinctive: line 74
Do not use default arguments in virtual functions
- Very specific: line 77
No exceptions: Use error codes, absl::Status, or StatusOr
- Very specific: line 78
No RTTI: Do not use typeid or dynamic_cast
- Very specific: line 79
Use nullptr, not NULL or 0 for pointers
- Very specific: line 80
Use auto only when type is obvious from context
- Very specific: line 81
Use braced initialization {} (but never auto x{5})
- Very specific: line 82
Use C++ casts: static_cast, const_cast, reinterpret_cast (no C-style)
- Very specific: line 83
Use std::make_unique over new
- Very specific: line 86
Use // for most comments (even multi-line)
- Distinctive: line 87
Every file starts with license boilerplate
- Distinctive: line 88
Document classes and non-obvious functions
- Very specific: line 89
Use TODO(username): for temporary code
- Distinctive: line 109
After writing code, perform a final review checking:
- Distinctive: line 113
No exceptions, no RTTI, no C-style casts
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Google C++ Style Guide
Overview
Enforce the Google C++ Style Guide when writing, reviewing, or refactoring C++ code. This skill ensures all generated C++ code follows Google's conventions, covering naming, formatting, header guards, scoping, class design, modern C++ features, comments, and more.
When to Use This Skill
Trigger this skill whenever the user:
- Asks to write or generate C++ code
- Requests a code review for C++ code
- Asks to refactor C++ code to match a style guide
- Mentions "Google C++ Style", "Google style", "Google coding standard", or similar
How to Apply This Skill
Step 1: Load the Reference
When C++ code needs to be written or reviewed, load the full style guide reference:
references/style-guide.mdThis contains the complete Google C++ Style Guide covering all rules and conventions.
Step 2: Apply Key Rules by Category
When generating or reviewing C++ code, verify compliance in these areas in order of priority:
Naming (Most Visible)
- Files: lowercase with underscores,
.cc/.hextensions - Types (classes, structs, enums, type aliases): PascalCase
- Variables (local, members): snake_case; member variables: trailing
_ - Functions: PascalCase (verb-like)
- Constants:
kprefix + PascalCase (e.g.,kMaxSize) - Namespaces: lowercase with underscores
- Macros: ALL_CAPS with underscores (avoid macros when possible)
- Enumerators:
kEnumNamefor unscoped enums; PascalCase forenum class
Formatting
- 2-space indent, no tabs
- 80 character line limit
- Opening brace on same line as function/class/conditional
- Always use braces for
if/for/while(no single-line bodies without braces) - Pointer/reference:
Type* ptr,const Type& ref(asterisk/ampersand adjacent to type) - Namespace contents not indented
- Access specifiers indented 1 space, members indented 2 spaces
Header Files
- Use
#ifndef/#define/#endifguards with_H_suffix - Headers must be self-contained
- Include what you use; no transitive includes
- Avoid forward declarations; prefer
#include
Classes
- Use
expliciton single-argument constructors - Declare copy/move operations explicitly (or delete them)
- Use
structonly for passive data objects (POD) - Use
classfor everything else - Make data members
privatewith accessors if needed - Use
overridefor all overridden virtual methods - Use
finalsparingly
Functions
- Prefer return values over output parameters
- Use
const&for input parameters - Keep functions short (~40 lines max)
- Do not use default arguments in virtual functions
Modern C++ Features
- No exceptions: Use error codes,
absl::Status, orStatusOr - No RTTI: Do not use
typeidordynamic_cast - Use
nullptr, notNULLor0for pointers - Use
autoonly when type is obvious from context - Use braced initialization
{}(but neverauto x{5}) - Use C++ casts:
static_cast,const_cast,reinterpret_cast(no C-style) - Use
std::make_uniqueovernew
Comments
- Use
//for most comments (even multi-line) - Every file starts with license boilerplate
- Document classes and non-obvious functions
- Use
TODO(username):for temporary code
Class Declaration Order
public:
- types/aliases
- static constants
- factory functions
- constructors / assignment operators
- destructor
- other functions
protected:
- (same order)
private:
- (same order)
- data members lastStep 3: Review Against Complete Checklist
After writing code, perform a final review checking:
- Naming conventions match (types, variables, functions, constants, files)
- Formatting is correct (indentation, braces, line length, whitespace)
- Headers have proper guards and includes
- No exceptions, no RTTI, no C-style casts
- Classes have proper access control and member ordering
- Functions are short, well-named, and properly documented
- Comments are clear and complete
constused where appropriateexpliciton single-argument constructorsoverrideon all virtual overrides
Resources
references/style-guide.md
Complete Google C++ Style Guide reference with all rules, examples, and formatting conventions. Load this when detailed style guidance is needed.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

