cpp-include-sorter
OfficialKeep C/C++ includes tidy and safe
Software Engineering#c++#conditional compilation#codebase hygiene#include sorting#cpp review#header organization
Authoropenharmonyinsight
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill fixes messy and inconsistent C/C++ #include ordering that makes code reviews harder and can break builds when conditional compilation blocks are not handled carefully.
Core Features & Use Cases
- Intelligent include grouping: Places the corresponding header first, then system headers (<...>), then local headers ("..."), separated by blank lines.
- Conditional compilation aware sorting: Sorts #ifdef/#ifndef/#if defined blocks as units, supports #elif/#else, and preserves block structure.
- Safety checks and stability: Preserves preceding/inline comments, avoids losing headers, and validates correctness after reordering.
- Use case: When preparing a PR, use it to standardize include blocks across many .cpp/.h files so reviewers can focus on logic changes rather than formatting noise.
Quick Start
Run include sorting on your target directory of .cpp files in dry-run mode to preview changes before committing.
Dependency Matrix
Required Modules
argparseresyspathlib
Components
scripts
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: cpp-include-sorter Download link: https://github.com/openharmonyinsight/openharmony-skills/archive/main.zip#cpp-include-sorter Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.