ohos-react-native-performance
OpenHarmony React Native performance static checks and optimization.
Setup & Installation
Install command
clawhub install code-sunbo/ohos-react-native-performanceIf the CLI is not installed:
Install command
npx clawhub@latest install code-sunbo/ohos-react-native-performanceOr install with OpenClaw CLI:
Install command
openclaw skills install code-sunbo/ohos-react-native-performanceor paste the repo link into your assistant's chat
Install command
https://github.com/openclaw/skills/tree/main/skills/code-sunbo/ohos-react-native-performanceWhat This Skill Does
Static-check rules for React Native on OpenHarmony (RNOH), derived from the official ohos_react_native performance-optimization documentation. Covers render optimization, bundle configuration, RNAbility lifecycle, TurboModule threading, and list performance. Rules are categorized by priority from critical render issues to medium-impact list handling.
General React Native performance guides don't cover OpenHarmony-specific concerns like bundle-harmony, HBC compilation, BiSheng compiler options, or RNAbility lifecycle, so this skill fills that gap without requiring manual doc lookup.
When to Use It
- Reviewing RNOH code for unnecessary re-renders before a release
- Configuring Hermes bytecode and Release builds for a production bundle
- Auditing TurboModule implementations to ensure heavy work runs on worker threads
- Checking RNAbility lifecycle hooks are wired to onPageShow/onPageHide correctly
- Enforcing stable list keys across a team codebase via code review rules
View original SKILL.md file
# OpenHarmony React Native Performance Static Check Skills Static-check rules and config for React Native for OpenHarmony, from the official [performance-optimization](https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/en/performance-optimization.md) doc. This skill is English-only to reduce token usage; Chinese content is available via links below. ## When to Apply Use this skill when: - Writing or reviewing **React Native for OpenHarmony** (RNOH) application code or OpenHarmony project configuration - Optimizing React Native page rendering, setState, or list performance - Configuring **bundle-harmony** build, Hermes bytecode, or Release build - Integrating or reviewing **RNAbility** lifecycle (onForeground/onBackground) - Designing or implementing **TurboModule** (main vs worker thread) - Preparing for performance analysis with Trace, React Marker, FCP, etc. ## Rule Categories by Priority | Priority | Category | Impact | Prefix | | -------- | ------------------- | -------- | ------------------------- | | 1 | Render optimization | CRITICAL | `rnoh-render-` | | 2 | Bundle & native | HIGH | `rnoh-bundle-`, `rnoh-native-` | | 3 | Lifecycle & monitor | HIGH | `rnoh-lifecycle-` | | 4 | TurboModule | MEDIUM | `rnoh-turbo-` | | 5 | List & key | MEDIUM | `rnoh-list-` | ## Quick Reference ### 1. Render optimization (CRITICAL) - `rnoh-render-avoid-same-state` — Avoid setState when state unchanged to prevent extra renders - `rnoh-render-pure-memo` — Use PureComponent or React.memo to avoid unnecessary re-renders - `rnoh-render-props-once` — Create callbacks/prop objects once (constructor or outside component) - `rnoh-render-split-child` — Split independent UI into child components - `rnoh-render-merge-setstate` — Merge setState to avoid multiple commits and renders - `rnoh-render-state-not-mutate` — Use new objects in setState; do not mutate existing state - `rnoh-render-batching` — Keep React 18 Automatic Batching enabled (RNOH default concurrentRoot: true) ### 2. Bundle & native config (HIGH) - `rnoh-bundle-release` — Use `--dev=false --minify=true` for performance/production bundle - `rnoh-bundle-hbc` — Prefer Hermes bytecode (hermesc) for production - `rnoh-native-release` — Use Release build on native side; lower LOG_VERBOSITY_LEVEL when appropriate - `rnoh-native-bisheng` — Optionally use BiSheng compiler (buildOption.nativeCompiler: "BiSheng") ### 3. Lifecycle & monitoring (HIGH) - `rnoh-lifecycle-foreground-background` — Call onForeground/onBackground in onPageShow/onPageHide or onShown/onHidden - `rnoh-lifecycle-fcp` — First-frame monitoring: use mount event or root onLayout to report FCP ### 4. TurboModule (MEDIUM) - `rnoh-turbo-worker` — Run heavy TurboModules (JSON, crypto, image, network, I/O) on worker thread; avoid ImageLoader on worker ### 5. List & key (MEDIUM) - `rnoh-list-key` — Provide stable keys for list items; avoid using index as key ## How to Use - **Static checks:** Apply the rules above in code review or scripts (JS/TS and config). - **Details and examples:** See the corresponding rule files under `rules/` (e.g. `rules/rnoh-render-pure-memo.md`). - **Full doc:** [Performance optimization (en)](https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/en/performance-optimization.md). ## Relation to general React Native skills - This skill focuses on **OpenHarmony**-specific React Native performance (RNAbility, bundle-harmony, HBC, TurboModule worker, Trace/React Marker). - It complements **vercel-react-native-skills** and **react-native-best-practices**: list virtualization (FlashList), Pressable, expo-image, StyleSheet, etc. still apply; this skill adds OpenHarmony-side config and render-optimization details.
Example Workflow
Here's how your AI assistant might use this skill in practice.
User asks: Reviewing RNOH code for unnecessary re-renders before a release
- 1Reviewing RNOH code for unnecessary re-renders before a release
- 2Configuring Hermes bytecode and Release builds for a production bundle
- 3Auditing TurboModule implementations to ensure heavy work runs on worker threads
- 4Checking RNAbility lifecycle hooks are wired to onPageShow/onPageHide correctly
- 5Enforcing stable list keys across a team codebase via code review rules
OpenHarmony React Native performance static checks and optimization.
Security Audits
These signals reflect official OpenClaw status values. A Suspicious status means the skill should be used with extra caution.