If you're building apps for HarmonyOS, this covers the ArkTS language and ArkUI framework end to end. You get state management with both the traditional decorators and the newer V2 system (recommended for API 12+), navigation patterns, network calls, and local storage. The skill includes command line tools you'll actually use: hvigorw for builds, codelinter for catching ArkTS-specific rule violations, and hstack for parsing obfuscated crash logs back to source. ArkTS is stricter than TypeScript, so the migration guide and constraint table are legitimately helpful if you're coming from web development. The examples are copy-paste ready, which matters when you're just trying to get a List rendering or figure out the right decorator for parent-child communication.
npx -y skills add fadinglight9291117/arkts_skills --skill arkts-development --agent claude-codeInstalls into .claude/skills of the current project.
Build HarmonyOS applications using ArkTS and the ArkUI declarative UI framework.
Create a basic component:
@Entry
@Component
struct HelloWorld {
@State message: string = 'Hello, ArkTS!';
build() {
Column() {
Text(this.message)
.fontSize(30)
.fontWeight(FontWeight.Bold)
Button('Click Me')
.onClick(() => { this.message = 'Button Clicked!'; })
}
.width('100%')
.height('100%')
.justifyContent(FlexAlign.Center)
}
}
| Decorator | Usage | Description |
|---|---|---|
@State | @State count: number = 0 | Component internal state |
@Prop | @Prop title: string | Parent → Child (one-way) |
@Link | @Link value: number | Parent ↔ Child (two-way, use $varName) |
@Provide/@Consume | Cross-level | Ancestor → Descendant |
@Observed/@ObjectLink | Nested objects | Deep object observation |
| Decorator | Usage | Description |
|---|---|---|
@ComponentV2 | @ComponentV2 struct MyComp | Enable V2 state management |
@Local | @Local count: number = 0 | Internal state (no external init) |
@Param | @Param title: string = "" | Parent → Child (one-way, efficient) |
@Event | @Event onChange: () => void | Child → Parent (callback) |
@ObservedV2 | @ObservedV2 class Data | Class observation |
@Trace | @Trace name: string | Property-level tracking |
@Computed | @Computed get value() | Cached computed properties |
@Monitor | @Monitor('prop') onFn() | Watch changes with before/after |
@Provider/@Consumer | Cross-level | Two-way sync across tree |
See references/state-management-v2.md for complete V2 guide.
// Vertical
Column({ space: 10 }) { Text('A'); Text('B'); }
.alignItems(HorizontalAlign.Center)
// Horizontal
Row({ space: 10 }) { Text('A'); Text('B'); }
.justifyContent(FlexAlign.SpaceBetween)
// Stack (overlay)
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.bg'))
Text('Overlay')
}
// List with ForEach
List({ space: 10 }) {
ForEach(this.items, (item: string) => {
ListItem() { Text(item) }
}, (item: string) => item)
}
@Entry
@Component
struct Page {
aboutToAppear() { /* Init data */ }
onPageShow() { /* Page visible */ }
onPageHide() { /* Page hidden */ }
aboutToDisappear() { /* Cleanup */ }
build() { Column() { Text('Page') } }
}
import { router } from '@kit.ArkUI';
// Push
router.pushUrl({ url: 'pages/Detail', params: { id: 123 } });
// Replace
router.replaceUrl({ url: 'pages/New' });
// Back
router.back();
// Get params
interface RouteParams {
id: number;
title?: string;
}
const params = router.getParams() as RouteParams;
import { http } from '@kit.NetworkKit';
const req = http.createHttp();
const res = await req.request('https://api.example.com/data', {
method: http.RequestMethod.GET,
header: { 'Content-Type': 'application/json' }
});
if (res.responseCode === 200) {
const data = JSON.parse(res.result as string);
}
req.destroy();
import { preferences } from '@kit.ArkData';
const prefs = await preferences.getPreferences(this.context, 'store');
await prefs.put('key', 'value');
await prefs.flush();
const val = await prefs.get('key', 'default');
ArkTS enforces stricter rules than TypeScript for performance and safety:
| Prohibited | Use Instead |
|---|---|
any, unknown | Explicit types, interfaces |
var | let, const |
Dynamic property access obj['key'] | Fixed object structure |
for...in, delete, with | for...of, array methods |
#privateField | private keyword |
| Structural typing | Explicit implements/extends |
See references/migration-guide.md for complete TypeScript → ArkTS migration details.
Build, clean, packaging, and device installation are covered by the harmonyos-build-deploy skill — use it for those workflows. The complete hvigorw flag reference is in references/hvigor-commandline.md.
Test commands:
# Run all tests for a module
hvigorw onDeviceTest -p module=entry -p coverage=true --no-daemon # On-device
hvigorw test -p module=entry --no-daemon # Local (host-side)
# Run a single test suite or single test (on-device)
hvigorw onDeviceTest -p module=entry -p testParam="{\"unittest\":\"TestClassName\"}" --no-daemon
hvigorw onDeviceTest -p module=entry -p testParam="{\"unittest\":\"TestClassName#testMethodName\"}" --no-daemon
codelinter is the code checking and fixing tool for ArkTS/TS files.
# Basic usage
codelinter # Check current project
codelinter /path/to/project # Check specified project
codelinter -c ./code-linter.json5 # Use custom rules
# Check and auto-fix
codelinter --fix
codelinter -c ./code-linter.json5 --fix
# Output formats
codelinter -f json -o ./report.json # JSON report
codelinter -f html -o ./report.html # HTML report
# Incremental check (Git changes only)
codelinter -i
# CI/CD with exit codes
codelinter --exit-on error,warn # Non-zero exit on error/warn
| Parameter | Description |
|---|---|
-c, --config <file> | Specify rules config file |
--fix | Auto-fix supported issues |
-f, --format | Output format: default/json/xml/html |
-o, --output <file> | Save result to file |
-i, --incremental | Check only Git changed files |
-p, --product <name> | Specify product |
-e, --exit-on <levels> | Exit code levels: error,warn,suggestion |
See references/codelinter.md for complete reference.
hstack parses obfuscated crash stacks from Release builds back to source code locations.
# Parse crash files directory
hstack -i crashDir -o outputDir -s sourcemapDir -n nameCacheDir
# Parse with C++ symbols
hstack -i crashDir -o outputDir -s sourcemapDir --so soDir -n nameCacheDir
# Parse single crash stack
hstack -c "at func (entry|entry|1.0.0|src/main/ets/pages/Index.ts:58:58)" -s sourcemapDir
| Parameter | Description |
|---|---|
-i, --input | Crash files directory |
-c, --crash | Single crash stack string |
-o, --output | Output directory (or file with -c) |
-s, --sourcemapDir | Sourcemap files directory |
--so, --soDir | Shared object (.so) files directory |
-n, --nameObfuscation | NameCache files directory |
Requirements:
-i or -c (not both)-s or --so-s and -nSee references/hstack.md for complete reference.
Enable in build-profile.json5:
"arkOptions": {
"obfuscation": {
"ruleOptions": {
"enable": true,
"files": ["./obfuscation-rules.txt"]
}
}
}
Common rules in obfuscation-rules.txt:
-enable-property-obfuscation # Property name obfuscation
-enable-toplevel-obfuscation # Top-level scope obfuscation
-enable-filename-obfuscation # Filename obfuscation
-keep-property-name apiKey # Whitelist specific names
See references/arkguard-obfuscation.md for complete guide.
harmonyos-build-deploy skill for building, packaging, and device installationjuliusbrussee/caveman
mattpocock/skills
shadcn/improve
obra/superpowers
forrestchang/andrej-karpathy-skills
vercel-labs/skills