agentleFS
UMU618UMU618/skills/google-cpp-style/SKILL.md

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

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    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
  1. Distinctive:

    When C++ code needs to be written or reviewed, load the full style guide reference:

    line 24
  2. Distinctive:

    When generating or reviewing C++ code, verify compliance in these areas in order of priority:

    line 34
  3. Very specific:

    Always use braces for if/for/while (no single-line bodies without braces)

    line 50
  4. Very specific:

    Use #ifndef/#define/#endif guards with _H_ suffix

    line 56
  5. Very specific:

    Avoid forward declarations.

    line 59
  6. Very specific:

    Use explicit on single-argument constructors

    line 62
  7. Very specific:

    Use struct only for passive data objects (POD)

    line 64
  8. Very specific:

    Use class for everything else

    line 65
  9. Very specific:

    Use override for all overridden virtual methods

    line 67
  10. Distinctive:

    Prefer return values over output parameters

    line 71
  11. Very specific:

    Use const& for input parameters

    line 72
  12. Distinctive:

    Keep functions short (~40 lines max)

    line 73
  13. Distinctive:

    Do not use default arguments in virtual functions

    line 74
  14. Very specific:

    No exceptions: Use error codes, absl::Status, or StatusOr

    line 77
  15. Very specific:

    No RTTI: Do not use typeid or dynamic_cast

    line 78
  16. Very specific:

    Use nullptr, not NULL or 0 for pointers

    line 79
  17. Very specific:

    Use auto only when type is obvious from context

    line 80
  18. Very specific:

    Use braced initialization {} (but never auto x{5})

    line 81
  19. Very specific:

    Use C++ casts: static_cast, const_cast, reinterpret_cast (no C-style)

    line 82
  20. Very specific:

    Use std::make_unique over new

    line 83
  21. Very specific:

    Use // for most comments (even multi-line)

    line 86
  22. Distinctive:

    Every file starts with license boilerplate

    line 87
  23. Distinctive:

    Document classes and non-obvious functions

    line 88
  24. Very specific:

    Use TODO(username): for temporary code

    line 89
  25. Distinctive:

    After writing code, perform a final review checking:

    line 109
  26. Distinctive:

    No exceptions, no RTTI, no C-style casts

    line 113

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.md

This 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 / .h extensions
  • Types (classes, structs, enums, type aliases): PascalCase
  • Variables (local, members): snake_case; member variables: trailing _
  • Functions: PascalCase (verb-like)
  • Constants: k prefix + PascalCase (e.g., kMaxSize)
  • Namespaces: lowercase with underscores
  • Macros: ALL_CAPS with underscores (avoid macros when possible)
  • Enumerators: kEnumName for unscoped enums; PascalCase for enum 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/#endif guards with _H_ suffix
  • Headers must be self-contained
  • Include what you use; no transitive includes
  • Avoid forward declarations; prefer #include

Classes

  • Use explicit on single-argument constructors
  • Declare copy/move operations explicitly (or delete them)
  • Use struct only for passive data objects (POD)
  • Use class for everything else
  • Make data members private with accessors if needed
  • Use override for all overridden virtual methods
  • Use final sparingly

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, or StatusOr
  • No RTTI: Do not use typeid or dynamic_cast
  • Use nullptr, not NULL or 0 for pointers
  • Use auto only when type is obvious from context
  • Use braced initialization {} (but never auto x{5})
  • Use C++ casts: static_cast, const_cast, reinterpret_cast (no C-style)
  • Use std::make_unique over new

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 last

Step 3: Review Against Complete Checklist

After writing code, perform a final review checking:

  1. Naming conventions match (types, variables, functions, constants, files)
  2. Formatting is correct (indentation, braces, line length, whitespace)
  3. Headers have proper guards and includes
  4. No exceptions, no RTTI, no C-style casts
  5. Classes have proper access control and member ordering
  6. Functions are short, well-named, and properly documented
  7. Comments are clear and complete
  8. const used where appropriate
  9. explicit on single-argument constructors
  10. override on 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.