skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
openharmonyinsight/openharmony-skills75 installs

format

Run clang-format on the current git changes. Only keep the formatting fix on the changed lines.

How do I install this agent skill?

npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill format
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill is a developer utility designed to format C++ code in the OpenHarmony graphic_2d repository using local prebuilt clang tools.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

  • Runlayerwarn

    1/1 file flagged

What does this agent skill do?

Tool Locations

  • clang-format: ../../../prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang-format
  • clang-format-diff.py: ../../../prebuilts/clang/ohos/linux-x86_64/llvm/share/clang/clang-format-diff.py

Approach

Use clang-format-diff.py which is designed specifically for this use case - it reads a diff from stdin and only applies formatting to lines that were changed.

Working Command

# Navigate to repo root and run:
git diff HEAD -- 'graphic_2d/**/*.cpp' 'graphic_2d/**/*.h' 2>/dev/null | \
  python3 prebuilts/clang/ohos/linux-x86_64/llvm/share/clang/clang-format-diff.py \
  -p1 -binary prebuilts/clang/ohos/linux-x86_64/llvm/bin/clang-format -i

Why This Works

  1. git diff HEAD - Shows all unstaged changes relative to HEAD
  2. -- 'graphic_2d/**/*.cpp' 'graphic_2d/**/*.h' - Filters to C++ source files
  3. clang-format-diff.py - Reads the diff and only formats changed lines
  4. -p1 - Strips one path component (graphic_2d/) from diff paths
  5. -binary ... - Specifies the clang-format executable to use
  6. -i - Applies edits directly to files

Important Notes

  • Must run from repo root of OpenHarmony so file paths in the diff match actual file locations
  • The tool only applies formatting if changed lines violate style rules
  • If changed lines are already properly formatted, no changes are made
  • This avoids the problem of formatting thousands of unchanged lines in a file

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/openharmonyinsight/openharmony-skills/format">View format on skillZs</a>