| name | cpp-coding-standards |
| description | Use when writing, refactoring, reviewing, building, configuring, benchmarking, optimizing, or documenting C++ code in the hdfs-learning workspace, especially for CMake/vcpkg, compiler selection, clang-format hooks, detailed Chinese comments, Google naming, Rust-style primitive aliases, static polymorphism, low-latency/high-throughput systems, hot paths, or human-review readability. |
C++ Coding Standards
Overview
Apply the hdfs-learning C++ engineering standard as a skill instead of relying on long AGENTS.md context. The standard prioritizes human reviewability, explicit build/toolchain choices, detailed synchronized Chinese comments, and high-performance C++ designs that avoid avoidable dynamic dispatch and hot-path waste.
Required First Step
For any C++ edit, review, build configuration, or benchmark task in /home/tyx/hdfs-learning, load:
Then load the task-specific reference files below.
Task Map
- Build system, dependencies, compilers, binary distribution,
vcpkg, CMake presets, hooks, or system g++ 11.4.0 compatibility: load references/build-toolchain-hooks.md.
- New or modified C++ source/header code: load references/naming-and-types.md, plus references/commenting.md.
- Template polymorphism,
concept, std::variant, std::visit, or pressure to introduce virtual: load references/static-polymorphism.md.
- Inheritance, external-interface adapter layers, custom exception types, throw-heavy modules, or exception-driven orchestration/restart flow: load references/inheritance-and-exceptions.md, plus references/commenting.md.
- Performance-sensitive code, benchmarks, hot paths, repeated computation, repeated allocation, or ABI-sensitive builds: load references/performance.md, plus build/toolchain rules.
- Low-latency/high-throughput system design, p95/p99 analysis, queueing, batching, caching, async, zero-copy, I/O model, capacity, or performance reports: load references/latency-throughput-design.md.
- Documentation-heavy comment enhancement, comment density changes, or
#详注 / #简注 instructions: load references/commenting.md.
- Skill maintenance or audit against the original AGENTS/doc tree: load references/corrections-for-review.md to see deliberate corrections and polish points.
Operating Rules
Respect existing repository patterns unless the existing structure conflicts with these standards or has already become hard to review. Do not preserve a bad abstraction merely to minimize the diff.
Use system compiler by default. Switch to the conda cpp_dev compiler only when the user explicitly requests it or the task needs capabilities unavailable in system g++ 11.4.0.
For formal C++ code committed to a repository, keep code, comments, build rules, and local checks synchronized. Temporary probes may be faster and lighter, but repository code must follow the full standard.
Before claiming completion, run the relevant verification commands. If verification cannot be run, state that clearly.