cpp-review

Review C++ code against Google C++ Style Guide. Use when reviewing C++ code, pull requests, or when asked to check code style compliance.

npx skills add https://github.com/clickhouse/pg_stat_ch --skill cpp-review

C++ Code Review (Google Style)

Review C++ code for compliance with the Google C++ Style Guide.

Review Checklist

Naming

  • Types use PascalCase
  • Functions use PascalCase (accessors use snake_case)
  • Variables use snake_case
  • Class members have trailing underscore: member_
  • Constants use kPascalCase
  • Macros use UPPER_CASE with project prefix

Headers

  • Has #define guard: PROJECT_PATH_FILE_H_
  • Self-contained (includes all dependencies)
  • Includes ordered: related header, C system, C++ stdlib, other libs, project
  • No forward declarations unless necessary

Classes

  • Single-argument constructors are explicit
  • Data members are private
  • Copy/move semantics explicit (= default, = delete)
  • No virtual calls in constructors
  • Uses composition over inheritance when appropriate

Functions

  • Returns values instead of output parameters when possible
  • Parameters ordered: inputs before outputs
  • Functions are ≤40 lines (prefer smaller)
  • Uses override/final for virtual overrides

Modern C++

  • Uses nullptr (not NULL or 0)
  • Uses C++ casts (not C-style)
  • Uses range-based for loops where appropriate
  • Uses auto appropriately (not excessively)
  • Smart pointers for ownership (unique_ptr, shared_ptr)

Formatting

  • 80 character line limit
  • 2-space indent
  • Braces on same line as control structures
  • Spaces around binary operators

Feedback Format

Use severity levels:

  • 🔴 MUST FIX: Style violations or bugs that must be fixed
  • 🟡 SHOULD FIX: Strong recommendations for improvement
  • 🟢 CONSIDER: Optional enhancements or suggestions

Example Review Comment

🔴 **MUST FIX**: Missing `explicit` on single-argument constructor
Line 45: `Foo(int value)` should be `explicit Foo(int value)` to prevent
implicit conversions.

🟡 **SHOULD FIX**: Function too long
Lines 78-145: `ProcessData()` is 67 lines. Consider breaking into smaller
functions for readability and testability.

🟢 **CONSIDER**: Use structured bindings
Line 23: `auto [iter, success] = map.insert({key, value});` would be clearer
than separate `.first` and `.second` access.

More skills from clickhouse

edit-changelog
clickhouse
Edit an auto-generated ClickHouse release changelog into the form that gets committed to CHANGELOG.md. Use when the user has the output of…
official
code-review
clickhouse
Review changes in clickhouse-java for correctness, compatibility, API stability, and missing tests. Use when reviewing pull requests, commits, diffs, patches,…
official
fix-release-pr
clickhouse
Fix CI failures and address code-review comments on a pull request that targets the protected `release` branch of `ClickHouse/clickhouse-js`. Release PRs are…
official
release
clickhouse
Drive a package release of `ClickHouse/clickhouse-js` end to end: bump the version, sync the protected `release` branch from `main`, watch the npm publish…
official
setup
clickhouse
Use this skill before running any of the npm run test:* , npm run lint , npm run typecheck , or npm run build scripts in a fresh checkout (or after pulling changes that touch package.json files).
official
typescript-lsp
clickhouse
Use the TypeScript language server (`typescript-language-server`) for precise code intelligence in the `clickhouse-js` repository: go-to-definition, find…
official
clickhousectl-cloud-deploy
clickhouse
Use when a user wants to deploy ClickHouse to the cloud, go to production, use ClickHouse Cloud, host a managed ClickHouse service, or migrate from a local…
official
chdb-datastore
clickhouse
DataStore is a lazy, ClickHouse-backed pandas replacement . Your existing pandas code works unchanged — but operations compile to optimized SQL and execute only when results are needed (e.g., print() , len() , iteration).
official