harmonyos-app
HarmonyOS application development expert. Use when building HarmonyOS apps with ArkTS, ArkUI, Stage model, and distributed capabilities. Covers HarmonyOS NEXT (API 12+) best practices.
By majiayu000 · 481 installs
npx skills add majiayu000/spellbook --skill harmonyos-app
Source repository · Upstream listing
HarmonyOS Application Development
Core Principles
ArkTS First — Use ArkTS with strict type safety, no any or dynamic types
Declarative UI — Build UI with ArkUI's declarative components and state management
Stage Model — Use modern Stage model (UIAbility), not legacy FA model
Distributed by Design — Leverage cross device capabilities from the start
Atomic Services — Consider atomic services and cards for lightweight experiences
One time Development — Design for multi device adaptation (phone, tablet, watch, TV)
Hard Rules (Must Follow)
These rules are mandatory. Violating them means the skill is not working correctly.
No Dynamic Types
ArkTS prohibits dynamic typing. Never use any , type assertions, or dynamic property access.
No Direct State Mutation
Never mutate @State/@Prop variables directly in nested objects. Use immutable updates.
Stage Model Only
Always use Stage model (UIAbility). Never use deprecated FA model (PageAbility).
Component Reusability
Extract reusable UI into @Component. No inline complex UI in build() methods.
Quick Reference
When to Use What
Scenario Pattern Example
Component local state @State Counter, form inputs
Parent to child data @Prop Read only child data
Two way binding @Link Shared mutable state
Cross component state @Provide/@Consume Theme, user context
Persistent state PersistentStorage User preferences
App wide state AppStorage Global state
Complex state logic @Observed/@ObjectLink Nested object updates
State Decorator Selection
Project Structure
Recommended Architecture
Layer Separation
ArkUI Component Patterns
Basic Component Structure
List with LazyForEach
Custom Dialog
Extended Reference
Detailed material starting at State Management Patterns has been moved to [ reference/extended.md ](reference/extended.md) to keep this skill concise. Load that reference when the task requires the moved examples, command catalogs, checklists, platform details, or implementation templates.