cpp-review

โดย clickhouse

ตรวจสอบโค้ด C++ ตาม Google C++ Style Guide ใช้เมื่อตรวจสอบโค้ด C++ คำขอดึงข้อมูล หรือเมื่อถูกขอให้ตรวจสอบความสอดคล้องของรูปแบบโค้ด

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.

Skills เพิ่มเติมจาก clickhouse

clickhouse-best-practices
clickhouse
กฎแนวปฏิบัติที่ดีที่สุดของ ClickHouse จำนวน 28 ข้อ จัดตามการออกแบบสคีมา การปรับแต่งคิวรี และกลยุทธ์การนำเข้าข้อมูล ครอบคลุมสามด้านสำคัญ: การเลือกคีย์หลักและชนิดข้อมูล (การตัดสินใจออกแบบที่ไม่สามารถเปลี่ยนแปลงได้), การปรับแต่ง JOIN และคิวรี, และการทำแบทช์อินเสิร์ตพร้อมหลีกเลี่ยงมิวเทชัน รวมถึงกฎ 28 ข้อที่จัดลำดับตามผลกระทบ โดยกฎการออกแบบสคีมาและการปรับแต่งคิวรีถูกทำเครื่องหมายว่าสำคัญมาก (CRITICAL) เนื่องจากกลไกการจัดเก็บแบบคอลัมน์และดัชนีแบบกระจัดกระจายของ ClickHouse มีขั้นตอนการตรวจสอบที่มีโครงสร้างสำหรับ...
official
clickhouse-js-node-coding
clickhouse
Write idiomatic application code with the ClickHouse Node.js client (`@clickhouse/client`). Use this skill whenever a user is *building* against the Node.js…
official
clickhousectl-cloud-deploy
clickhouse
ใช้เมื่อผู้ใช้ต้องการปรับใช้ ClickHouse ไปยังคลาวด์ ไปสู่ระบบผลิต ใช้ ClickHouse Cloud โฮสต์บริการ ClickHouse ที่มีการจัดการ หรือย้ายจากระบบภายในเครื่อง…
official
clickstack-otel-collector
clickhouse
Use when a user wants to wire an OpenTelemetry collector into a Managed ClickStack service on ClickHouse Cloud, either by deploying a new local collector…
official
infra-clickhouse
clickhouse
Sets up and manages ClickHouse using the clickhousectl CLI — installs and runs a local ClickHouse server for development, and creates managed ClickHouse Cloud…
official
infra-postgres
clickhouse
ตั้งค่าและจัดการ Postgres โดยใช้ clickhousectl CLI — รัน Postgres ที่ใช้ Docker ในเครื่องสำหรับการพัฒนา และสร้างและดำเนินการจัดการ ClickHouse ที่มีการจัดการ...
official
clickhouse-best-practices
clickhouse
ต้องใช้เมื่อตรวจสอบสคีมา คิวรี หรือการกำหนดค่าของ ClickHouse ประกอบด้วยกฎ 31 ข้อที่ต้องตรวจสอบก่อนให้คำแนะนำ ควรอ่านเสมอ…
official
setup
clickhouse
แนะนำผู้ใช้ในการตั้งค่าการเชื่อมต่อเซิร์ฟเวอร์ ClickHouse MCP ที่มาพร้อมกับปลั๊กอินนี้ ใช้เมื่อผู้ใช้ติดตั้งปลั๊กอินครั้งแรกหรือพบปัญหา…
official