harmonyOS developer

# HarmonyOS Developer Skills

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "harmonyOS developer" with this command: npx skills add LouisEleven/harmonyos

HarmonyOS Developer Skills

Core Rules

  • Use .equals() for string comparison, not ==
  • HarmonyOS uses ArkTS/TypeScript
  • UI built with ArkUI framework
  • App signing requires certificate configuration

Development Environment

  • IDE: DevEco Studio
  • Language: ArkTS (TypeScript superset)
  • SDK: HarmonyOS SDK
  • API: HarmonyOS Next API

ArkUI Basics

Components

// Basic component
@Entry
@Component
struct Index {
  @State message: string = 'Hello World'

  build() {
    Column() {
      Text(this.message)
        .fontSize(50)
        .fontWeight(FontWeight.Bold)
    }
    .alignItems(HorizontalAlign.Center)
    .width('100%')
    .height('100%')
  }
}

State Management

// @State - Component internal state
@State count: number = 0

// @Prop - Parent component prop
@Prop message: string

// @Link - Two-way binding
@Link childCount: number

// @Observed + @ObjectLink - Deep observation
@Observed
class Person {
  name: string = ''
  age: number = 0
}

@ObjectLink person: Person

Lifecycle

// Component lifecycle
aboutToAppear() {}    // About to display
onDidBuild() {}       // Build complete
aboutToDisappear() {} // About to destroy

Common Components

  • Text - Text display
  • Image - Image display
  • Button - Interactive button
  • Column/Row - Layout containers
  • List - Scrollable list
  • Grid - Grid layout
  • Stack - Stacked layout
  • Swiper - Carousel
  • TabContent - Tab pages

Layouts

// Linear layout
Column() { }  // Vertical
Row() { }     // Horizontal

// Flex layout
Flex() { 
  direction: FlexDirection.Row 
}

// Grid layout
Grid() { 
  columnsTemplate: '1fr 1fr 1fr' 
}

// Stack
Stack() { }

Routing

import router from '@ohos.router'

// Navigate
router.pushUrl('pages/Detail')

// Go back
router.back()

// With params
router.pushUrl({
  url: 'pages/Detail',
  params: { id: 123 }
})

// Get params
const params = router.getParams()

Network Requests

import http from '@ohos.net.http'

let httpRequest = http.createHttp()
httpRequest.request(
  'https://api.example.com/data',
  {
    method: http.RequestMethod.GET,
    header: { 'Content-Type': 'application/json' }
  },
  (err, data) => {
    if (!err) {
      console.log(JSON.stringify(data.result))
    }
  }
)

Local Storage

import preferences from '@ohos.data.preferences'

// Write
let preferences = await preferences.getPreferences(context, 'myPrefs')
await preferences.put('username', 'tom')
await preferences.flush()

// Read
let value = await preferences.get('username', 'default')

Permissions

import abilityAccessCtrl from '@ohos.abilityAccessCtrl'

// Declare in module.json5
// "requestPermissions": [
//   { "name": "ohos.permission.INTERNET" }
// ]

// Request at runtime
let atManager = abilityAccessCtrl.createAtManager()
atManager.requestPermissionsFromUser(context, ['ohos.permission.INTERNET'])

Common Permissions

  • ohos.permission.INTERNET - Network access
  • ohos.permission.GET_NETWORK_INFO - Network status
  • ohos.permission.CAMERA - Camera access
  • ohos.permission.WRITE_MEDIA - Media write
  • ohos.permission.READ_MEDIA - Media read

Build & Signing

  1. DevEco Studio → Build → Build Hap
  2. Configure signing in Project Structure → Signing Configs
  3. Requires .p12 certificate and .cer public key
  4. Use debug signing for development, release for production

Quick Reference

NeedSolution
State management@State, @Prop, @Link, @Observed
ListsList + ListItem
Network@ohos.net.http
Storage@ohos.data.preferences
Routingrouter.pushUrl()
ToastpromptAction.showToast()
Dialogdialog.showDialog()

Learning Resources

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Content Collector

个人内容收藏与知识管理系统。收藏、整理、检索、二创。 Use when: (1) 用户分享链接/文字/截图并要求保存或收藏, (2) 用户说"收藏这个"/"存一下"/"记录下来"/"save this"/"bookmark"/"clip this", (3) 用户要求按关键词/标签搜索之前收藏的内容, (4) 用...

Registry SourceRecently Updated
Coding

Github Stars Tracker

GitHub 仓库 Stars 变化监控与通知。追踪指定仓库的 star 增长、fork 变化,发现新趋势。适合开发者关注项目动态。

Registry SourceRecently Updated
Coding

RabbitMQ client guide for Tencent Cloud TDMQ

RabbitMQ 客户端代码指南。当用户需要编写、调试或审查 RabbitMQ 应用代码时使用。涵盖:用任意语言(Java/Go/Python/PHP/.NET)写生产者或消费者;排查连接暴增、消息丢失、Broken pipe、消费慢、漏消费等客户端问题;审查 spring-boot-starter-amqp、a...

Registry SourceRecently Updated
00
Profile unavailable