
Cpp
- 8 installs
- 8 repo stars
- Updated February 25, 2026
- testdino-hq/google-styleguides-skills
Helps with ai & agent building tasks during AI-assisted development.
About
cpp is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- cpp
- AI & Agent Building
- AI-coding skill
Cpp by the numbers
- 8 all-time installs (skills.sh)
- +1 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #12,339 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/testdino-hq/google-styleguides-skills --skill cppAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 8 |
|---|---|
| repo stars | ★ 8 |
| Last updated | February 25, 2026 |
| Repository | testdino-hq/google-styleguides-skills ↗ |
What it does
Helps with ai & agent building tasks during AI-assisted development.
Files
Google C++ Style Guide
Official Google C++ coding standards for consistent, maintainable code.
Golden Rules
1. Target C++20 — avoid non-standard extensions 2. 80-character line limit — for readability 3. 2-space indentation — no tabs 4. Use `const` liberally — for correctness and thread safety 5. Avoid exceptions — Google code doesn't use C++ exceptions 6. Smart pointers for ownership — std::unique_ptr and std::shared_ptr 7. Header guards — use PROJECT_PATH_FILE_H_ format
Quick Reference
Naming Conventions
| Element | Convention | Example |
|---|---|---|
| Files | snake_case | url_table.cc, url_table.h |
| Classes/Structs | UpperCamelCase | UserService |
| Functions | UpperCamelCase | GetUserById |
| Variables | snake_case | user_count |
| Constants | kUpperCamelCase | kMaxRetries |
| Class members | snake_case_ | user_name_ (trailing _) |
| Macros | UPPER_SNAKE_CASE | MAX_BUFFER_SIZE |
Headers
// ✓ CORRECT - self-contained header with guard
#ifndef FOO_BAR_BAZ_H_
#define FOO_BAR_BAZ_H_
#include <string>
#include "base/basictypes.h"
class Baz {
public:
void DoSomething();
};
#endif // FOO_BAR_BAZ_H_Include order: related header → C system → C++ stdlib → other libs → your headers.
Classes
// ✓ CORRECT
class MyClass {
public:
explicit MyClass(int value); // explicit for single-arg ctors
~MyClass();
void DoSomething();
int GetValue() const { return value_; }
private:
int value_;
std::string name_;
};Smart Pointers
// ✓ CORRECT - unique_ptr for exclusive ownership
std::unique_ptr<Foo> FooFactory();
void FooConsumer(std::unique_ptr<Foo> ptr);
// ✓ CORRECT - shared_ptr for shared ownership
std::shared_ptr<const Foo> immutable_foo;
// ✗ INCORRECT - avoid raw new/delete
Foo* foo = new Foo(); // avoid
delete foo; // avoidModern C++ Features
// ✓ CORRECT - use auto for complex types
auto it = my_map.find(key);
auto widget = std::make_unique<Widget>(arg1, arg2);
// ✓ CORRECT - range-based for loops
for (const auto& item : container) {
Process(item);
}
// ✓ CORRECT - nullptr, not NULL
Foo* ptr = nullptr;
// ✓ CORRECT - constexpr for compile-time constants
constexpr int kArraySize = 100;Functions
// ✓ CORRECT - return type on same line
ReturnType ClassName::FunctionName(Type par_name1, Type par_name2) {
DoSomething();
return result;
}
// ✓ CORRECT - wrap long parameter lists (4-space indent)
ReturnType LongClassName::ReallyLongFunctionName(
Type par_name1,
Type par_name2,
Type par_name3) {
DoSomething();
}Formatting
// ✓ CORRECT - braces and spacing
if (condition) {
DoSomething();
} else {
DoSomethingElse();
}
// ✓ CORRECT - pointer/reference alignment (attached to type)
char* c;
const std::string& str;Common Mistakes
| Mistake | Correct Approach |
|---|---|
| Using exceptions | Use error codes or absl::Status |
Bare new/delete | Use smart pointers (unique_ptr) |
NULL or 0 for null | Use nullptr |
| C-style casts | Use C++ casts (static_cast, etc.) |
using namespace std | Never in headers; avoid in .cc |
| Mutable global variables | Use singletons or dependency injection |
Missing explicit | Mark single-arg constructors explicit |
When to Use This Guide
- Writing new C++ code
- Refactoring existing C++
- Code reviews
- Setting up clang-format rules
- Onboarding new team members
Install
npx skills add testdino-hq/google-styleguides-skills/cppFull Guide
See cpp.md for complete details, examples, and edge cases.
Google C++ Style Guide
Source: https://google.github.io/styleguide/cppguide.html
Golden Rules
1. Target C++20 — avoid non-standard extensions 2. 80-character line limit — for readability 3. 2-space indentation — no tabs 4. Use `const` liberally — for correctness and thread safety 5. Avoid exceptions — Google code doesn't use C++ exceptions 6. Smart pointers for ownership — std::unique_ptr and std::shared_ptr 7. Header guards — use PROJECT_PATH_FILE_H_ format
---
1. Headers
// CORRECT - self-contained header with guard
#ifndef FOO_BAR_BAZ_H_
#define FOO_BAR_BAZ_H_
#include <string>
#include "base/basictypes.h"
class Baz {
public:
void DoSomething();
};
#endif // FOO_BAR_BAZ_H_Include Order
1. Related header 2. C system headers 3. C++ standard library headers 4. Other libraries' headers 5. Your project's headers
---
2. Naming
| Element | Convention | Example |
|---|---|---|
| Files | snake_case | url_table.cc |
| Types | UpperCamelCase | UrlTable |
| Variables | snake_case | table_name |
| Functions | UpperCamelCase | AddTableEntry() |
| Constants | kConstantName | kDaysInAWeek |
| Macros | UPPER_SNAKE_CASE | MY_MACRO |
| Class members | snake_case_ | table_name_ (trailing underscore) |
---
3. Classes
// CORRECT
class MyClass {
public:
MyClass(); // Constructor
~MyClass(); // Destructor
void DoSomething();
int GetValue() const { return value_; }
private:
int value_;
std::string name_;
};Key Rules
- Declare data members
private(except in structs) - Use trailing underscore for private data members
- Mark single-argument constructors
explicit - Use
= deletefor uncopyable classes - Prefer composition over inheritance
---
4. Functions
// CORRECT - return type on same line
ReturnType ClassName::FunctionName(Type par_name1, Type par_name2) {
DoSomething();
return result;
}
// CORRECT - wrap long parameter lists
ReturnType LongClassName::ReallyLongFunctionName(
Type par_name1, // 4 space indent
Type par_name2,
Type par_name3) {
DoSomething();
}---
5. Smart Pointers
// CORRECT - use unique_ptr for exclusive ownership
std::unique_ptr<Foo> FooFactory();
void FooConsumer(std::unique_ptr<Foo> ptr);
// CORRECT - use shared_ptr sparingly
std::shared_ptr<const Foo> immutable_foo;
// AVOID - never use auto_ptr
std::auto_ptr<Foo> foo; // AVOID---
6. Modern C++ Features
// CORRECT - use auto for complex types
auto it = my_map.find(key);
auto widget = std::make_unique<Widget>(arg1, arg2);
// CORRECT - use range-based for loops
for (const auto& item : container) {
Process(item);
}
// CORRECT - use nullptr, not NULL
Foo* ptr = nullptr;
// CORRECT - use constexpr for compile-time constants
constexpr int kArraySize = 100;---
7. Avoid These Features
| Feature | Why Avoid |
|---|---|
| Exceptions | Not used at Google; use error codes |
RTTI (dynamic_cast) | Use sparingly; prefer virtual methods |
| Multiple inheritance | Complex; use sparingly |
| Operator overloading | Use judiciously; must be obvious |
| Default arguments | Can be confusing; prefer overloads |
---
8. Formatting
// CORRECT - braces and spacing
if (condition) {
DoSomething();
} else {
DoSomethingElse();
}
// CORRECT - pointer/reference alignment
char* c;
const std::string& str;
// CORRECT - function calls
DoSomething(argument1, argument2, argument3);
// CORRECT - wrap long calls
DoSomething(
argument1, argument2, // 4 space indent
argument3, argument4);---
Common Mistakes
| Mistake | Correct Approach |
|---|---|
| Using exceptions | Use error codes or absl::Status |
Bare new/delete | Use smart pointers |
NULL | Use nullptr |
| C-style casts | Use C++ casts (static_cast, etc.) |
using namespace std | Never in headers; avoid in .cc files |
| Mutable globals | Use singletons or dependency injection |