openharmony-cpp

Enforce OpenHarmony C++ conventions and secure coding practices.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

OpenHarmony C++ projects often suffer from inconsistent style, fragile headers, and avoidable security bugs when code is written without strict project conventions.

Core Features & Use Cases

  • Strict OpenHarmony C++ conventions: Enforces naming/formatting rules such as K&R braces, file/class alignment, and global/member variable prefixes.
  • Safe header management: Requires conventional include guards and discourages #pragma once, forward-declaration hiding, and header pollution.
  • Critical security requirements: Mandates input validation, integer safety rules, and memory-safety practices like nulling pointers after deletion.
  • Class/function design quality: Guides modern C++ usage (e.g., explicit, nullptr, override), constructor/destructor rules, and reasonable function size/parameter limits.
  • Use case: When introducing a new OpenHarmony module or refactoring legacy code, this skill helps ensure the implementation matches platform expectations and reduces security review risk.

Quick Start

Ask the AI to review your OpenHarmony C++ header and source files against naming, header-guard, include, and secure-coding requirements, and report every violation found.

Frequently Asked Questions about openharmony-cpp

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

FAQPage Schema
What secure coding rules should I follow when writing OpenHarmony C++ modules?

Secure coding for OpenHarmony C++ requires mandatory input validation, integer safety, and memory-safety practices like nulling pointers after deletion. It enforces strict rules for file extensions, conventional include guards instead of #pragma once, and specific C++ design constraints to prevent security defects.

How do I review OpenHarmony C++ code for project-specific convention violations?

To review OpenHarmony C++ code, check headers and source files against naming and formatting rules like K&R braces, file alignment, and variable prefixes. You must verify header scope rules, conventional include guards, and secure coding practices to report every violation found during refactoring.

Does OpenHarmony C++ allow using #pragma once for header guards?

OpenHarmony C++ discourages using #pragma once for header guards. The conventions require conventional include guards instead, actively discouraging forward-declaration hiding and header pollution to ensure safe header management across platform modules.

What are the C++ design constraints for OpenHarmony class and function definitions?

C++ design constraints for OpenHarmony guide modern usage including explicit constructors, nullptr, and override specifiers. They enforce constructor and destructor rules alongside reasonable function size and parameter limits to maintain class and function design quality.

Can I use standard C++ memory allocation practices when developing OpenHarmony modules?

Standard C++ memory practices must be tightened for OpenHarmony modules by enforcing memory-safety behaviors. This includes specific actions like nulling pointers after deletion and applying integer safety rules to prevent common robustness defects and security vulnerabilities.

Why does my OpenHarmony C++ code fail security review without strict header management?

OpenHarmony C++ code fails security review without strict header management because fragile headers and header pollution introduce avoidable security bugs. Enforcing conventional include guards and preventing forward-declaration hiding reduces this security review risk significantly.