format

Format changed C++ lines in graphic_2d using clang-format-diff.py.

31|6|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill format-openharmonyinsight
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: format
Source: https://github.com/openharmonyinsight/openharmony-skills/tree/main/skills/graphic-2d-format
Command: npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill format-openharmonyinsight

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you apply consistent C++ formatting without rewriting entire files, which reduces diff noise and makes reviews easier.

Core Features & Use Cases

  • Changed-lines-only formatting: Uses clang-format-diff.py to format only lines affected by your current git diff.
  • Scoped to OpenHarmony graphic_2d C++ headers/sources: Targets graphic_2d//*.cpp and graphic_2d//*.h.
  • Toolchain-aligned formatting: Runs the repo-provided clang-format binary and diff helper for consistent style matching.

Quick Start

Run the formatting command from the OpenHarmony repo root to apply clang-format fixes only to the changed graphic_2d C++ lines.

Frequently Asked Questions about format

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I apply clang-format to only changed lines in a C++ git diff?

To apply clang-format to only changed lines in a C++ git diff, pipe the filtered git diff output into clang-format-diff.py using the -p1 and -i flags to edit files in place.

Why does formatting entire C++ files create unnecessary diff noise during code reviews?

Formatting entire C++ files creates unnecessary diff noise during code reviews by rewriting unchanged lines. Incremental styling formats only reported git diff lines against HEAD to keep reviews focused on actual changes.

Can I use clang-format-diff.py for incremental styling in OpenHarmony graphic_2d repositories?

Yes, you can use clang-format-diff.py for incremental styling in OpenHarmony graphic_2d repositories by targeting graphic_2d/**/*.cpp and graphic_2d/**/*.h files with the repo-provided clang-format binary.

What is the best way to format C++ headers and sources without rewriting whole files?

The best way to format C++ headers and sources without rewriting whole files is using clang-format-diff.py to isolate and format only the specific lines reported by your current git diff against HEAD.

Do I need to run incremental formatting commands from the OpenHarmony repo root?

Yes, you need to run incremental formatting commands from the OpenHarmony repo root to correctly execute the prebuilts clang-format binary and apply changes to your graphic_2d C++ files.

Does this incremental formatting approach work for all C++ files or just graphic_2d?

This incremental formatting approach is scoped specifically to graphic_2d/**/*.cpp and graphic_2d/**/*.h files within OpenHarmony repositories, targeting incremental formatting workflows during code reviews.