mcpField
O
openharmony-cpp

openharmony-cpp

github.com/openharmonyinsightDevelopment35146 installsUpdated 11w ago
Repository

About openharmony-cpp

openharmony-cpp is a skill for writing, refactoring, and reviewing C++ code under OpenHarmony conventions. It brings together platform-specific naming, formatting, header, and secure-coding rules.

Key features

  1. 01OpenHarmony naming and formatting rules
  2. 02Header and include guidance
  3. 03Input validation requirements
  4. 04Memory and bitwise safety rules

Use cases

  1. 01Generate classes or modules to OpenHarmony conventions
  2. 02Clean up legacy C++ code
  3. 03Review code against the conventions

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill openharmony-cpp

After installing, type/openharmony-cppin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
class_function_design.md
headers_scopes.md
naming_formatting.md
secure_coding.md

Details

From the project README

OpenHarmony C++ Coding Skills

Core Mandates (Common Pitfalls)

These rules are strictly enforced in OpenHarmony and often differ from general C++ projects.

1. Strict Naming & Formatting
  • Extensions: Always use .cpp and .h.
  • Files: Filenames must match class names (Unix-like, e.g., my_class.cpp).
  • Variables: Global vars must start with g_ (e.g., g_config). Class members must end with _ (e.g., value_).
  • Braces: K&R Style is mandatory (opening brace on the same line).
  • Details: See naming_formatting.md.
2. Header Management
  • Guards: Use #ifndef guards. #pragma once is FORBIDDEN.
  • Includes: Prefer #include over forward declarations to prevent hidden dependencies.
  • Details: See headers_scopes.md.
3. Critical Security Requirements
  • Input Validation: All external data must be validated before use (indices, sizes, loops).
  • Memory Safety: Pointers must be set to nullptr immediately after deletion.
  • Bitwise: Only on unsigned types.
  • Details: See secure_coding.md.

Usage Guide

When to use
  • New Code: Generating new classes or modules.
  • Refactoring: Cleaning up legacy code.
  • Review: Checking code against OpenHarmony standards.
Reference Map

Comments

Markdown supported