/SKILL.md
ArkTS syntax, migration, and optimization guide for HarmonyOS/OpenHarmony development. Triggers on: .ets files, ArkTS keywords, HarmonyOS/OpenHarmony context, @ohos packages. Help with syntax reference, TypeScript migration, performance optimization, compile errors, state management, component development, and language-specific questions.
npx skillsauth add summerkaze/skill-arkts-syntax-assistant arkts-syntax-assistantInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
中文文档
ArkTS is the default development language for OpenHarmony applications. It builds upon TypeScript with enhanced static typing to improve program stability and performance.
| Scenario | Document | |----------|----------| | Syntax Learning | references/en/introduction-to-arkts.md | | Quick Overview | references/en/arkts-get-started.md | | TS Migration | references/en/typescript-to-arkts-migration-guide.md | | Migration Background | references/en/arkts-migration-background.md | | Performance | references/en/arkts-high-performance-programming.md | | More Cases | references/en/arkts-more-cases.md |
User Question -> Identify Question Type -> Consult Documentation -> Provide Code Example
Common Syntax Questions:
let/const with explicit type or inferenceIdentify TS Code -> Check Incompatible Features -> Consult Migration Rules -> Provide ArkTS Alternative
Key Migration Rules Quick Reference:
| TypeScript | ArkTS Alternative |
|------------|-------------------|
| var x | let x |
| any/unknown | Specific types |
| {n: 42} object literal | Define class/interface first |
| [index: T]: U index signature | Record<T, U> |
| A & B intersection type | interface C extends A, B |
| function(){} function expression | () => {} arrow function |
| <Type>value type assertion | value as Type |
| Destructuring [a, b] = arr | Individual access arr[0], arr[1] |
| for..in | for loop or for..of |
| Constructor parameter properties | Explicit field declaration |
Analyze Code -> Identify Performance Issues -> Consult Optimization Guide -> Provide Solutions
High-Performance Programming Key Points:
const for invariants; avoid mixing integer and floatGet Error Message -> Search Migration Rules -> Find Related Case -> Provide Fix
// Error
let data = JSON.parse(str);
// Correct
let data: Record<string, Object> = JSON.parse(str);
// TypeScript syntax (not supported in ArkTS)
type Person = { name: string, age: number }
// ArkTS syntax
interface Person {
name: string;
age: number;
}
// Using object literal
let p: Person = { name: 'John', age: 25 };
// Error
globalThis.value = 'xxx';
// Use singleton pattern
export class GlobalContext {
private constructor() {}
private static instance: GlobalContext;
private _objects = new Map<string, Object>();
public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.instance;
}
getObject(key: string): Object | undefined {
return this._objects.get(key);
}
setObject(key: string, value: Object): void {
this._objects.set(key, value);
}
}
// Error
try {} catch (e: BusinessError) {}
// Correct
try {} catch (error) {
let e: BusinessError = error as BusinessError;
}
// TypeScript index signature
function foo(data: { [key: string]: string }) {}
// ArkTS Record
function foo(data: Record<string, string>) {}
// Usage example
let map: Record<string, number> = {
'John': 25,
'Mary': 21,
};
// TypeScript constructor signature
type ControllerCtor = {
new (value: string): Controller;
}
// ArkTS factory function
type ControllerFactory = () => Controller;
class Menu {
createController: ControllerFactory = () => {
return new Controller('default');
}
}
The following are prohibited in ArkTS:
eval__proto__, defineProperty, freeze, getPrototypeOf, etc.apply, construct, defineProperty, etc.The scripts directory provides quick compilation scripts for ArkTS projects (including dependency installation):
| Platform | Script | Purpose |
|----------|--------|---------|
| macOS/Linux | scripts/run.sh | Execute ohpm install + hvigorw assembleApp |
| Windows | scripts/run.ps1 | Execute ohpm install + hvigorw assembleApp |
Usage:
# macOS/Linux
bash scripts/run.sh
# Windows PowerShell
.\scripts\run.ps1
Script execution steps:
ohpm install --all)hvigorw assembleApp)CRITICAL: When this skill generates ArkTS code, the following workflow MUST be followed:
Compilation Verification: After generating code, you MUST compile the project using the build scripts:
bash scripts/run.sh.\scripts\run.ps1Retry Strategy: If compilation fails:
User Intervention: After 3 failed compilation attempts, use AskUserQuestion:
Question: Compilation failed after 3 attempts. How would you like to proceed?
Options:
- Continue retrying (attempt another fix)
- Manual intervention (I'll wait for your guidance)
- Skip compilation (proceed without verification)
Error Reporting: Always show the full compilation error output when failures occur.
MIT License - see LICENSE.txt
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.