Token导航 LogoToken导航TokenDH.com
待分类只读github未标认证来源可访问许可证需确认审计通过

cpp-include-sortercpp 包括排序器

Agent Skill

cpp-include-sorter 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,102

周安装

45

GitHub Stars

18

下载量

356
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cpp-include-sorter(cpp 包括排序器)
来源仓库:https://github.com/openharmonyinsight/openharmony-skills
仓库路径:skills/cpp-include-sorter
安装命令:
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill cpp-include-sorter
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill cpp-include-sorter

简介

cpp-include-sorter 自动排序 C/C++ 源文件的 #include 语句,按类别分组并保持一致性。

  • 适用于大型项目代码整理,支持系统头、本地头和条件编译块的智能处理。
  • 可按目录批量处理,支持 dry-run 预览变更,避免意外修改重要文件。
  • 建议集成到 pre-commit hook 中,确保每次提交保持头文件有序,提升可读性。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

C/C++ Include Sorter

Automatically sorts #include statements in C/C++ source files with intelligent handling of conditional compilation blocks.

Quick Start

Sort all .cpp files in a directory:

python scripts/sort_includes.py <directory-path>

Preview changes without modifying files:

python scripts/sort_includes.py <directory-path> --dry-run

Sorting Rules

Includes are organized into 3 categories with blank lines between each group:

  1. Corresponding header - For file.cpp, file.h is placed first (prefers longest path if duplicates exist)
  2. System headers - Headers with angle brackets <> (sorted alphabetically)
  3. Local headers - Headers with double quotes "" (sorted alphabetically)

Conditional Compilation Blocks

#ifdef/#ifndef/#if defined blocks are treated as units:

  • Blocks participate in global sorting based on their first include
  • Headers inside each block are also sorted (system headers first, then local headers)
  • Block structure (#ifdef...#endif) is preserved
  • #elif and #else blocks are supported

Example

Before:

#include "common/rs_log.h"
#include "rs_trace.h"
#include <memory>
#ifdef RS_ENABLE_GPU
#include "feature/uifirst/rs_sub_thread_manager.h"
#include "feature/capture/rs_ui_capture_task_parallel.h"
#endif
#include "platform/common/rs_system_properties.h"

After:

#include "rs_trace.h"        // 1. Corresponding header (longest path preferred)

#include <memory>             // 2. System headers (alphabetical)

#include "common/rs_log.h"    // 3. Local headers (alphabetical)
#ifdef RS_ENABLE_GPU
#include "feature/capture/rs_ui_capture_task_parallel.h"
#include "feature/uifirst/rs_sub_thread_manager.h"
#endif
#include "platform/common/rs_system_properties.h"

Features

  • Duplicate include handling: When multiple includes with same filename but different paths exist (e.g., "file.h" and "path/to/file.h"), the longest path is used as the corresponding header and placed first
  • Comment preservation: Inline comments (// comment) and preceding comments are preserved
  • Nested conditional blocks: Handles #elif and #else within #ifdef blocks
  • Validation: Verifies no headers are lost during sorting

Script Reference

See scripts/sort_includes.py for implementation details.

Key functions:

  • extract_includes_with_ifdef() - Parses includes and conditional blocks
  • sort_includes_with_ifdef() - Sorts with 3-category rule
  • format_ifdef_block() - Formats conditional blocks with sorted includes

Verification

After sorting, verify:

  1. All #ifdef blocks contain same number of headers as before
  2. Corresponding header has complete path (not shortened)
  3. Total include count unchanged
  4. Comments preserved

Use git diff to compare before/after:

git diff <file.cpp> | grep "^[-+]" | grep "include"

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.54%
按下载量换算130

Claude

29.46%
按下载量换算105

Cursor

20.82%
按下载量换算74

Gemini CLI

10.32%
按下载量换算37

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills