harmony-arkts
Installation
SKILL.md
HarmonyOS ArkTS Development
This skill covers building HarmonyOS applications with ArkTS and the declarative ArkUI framework, including component structure, state management, layout, lifecycle, resources, and accessibility.
Workflow for Building an ArkTS Component
- Define the component — Create a
structdecorated with@Component, named in PascalCase. - Declare state near the top — List
@State,@Prop,@Link, and other state decorators first, before any methods. - Add lifecycle hooks — Implement
aboutToAppear()/aboutToDisappear()(and others as needed) after state, beforebuild(). - Compose the UI in build() — Place
build()last, using ArkUI primitives (Column,Row,Stack,List, etc.) to lay out child components. - Extract complex UI — Once
build()grows large or nested, pull sections into smaller@Componentstructs or@Builderfunctions. - Wire events — Attach arrow-function event handlers that delegate non-trivial logic to named methods on the component.
- Externalize resources — Move strings, colors, dimensions, and images into the resource system and reference them with
$r(). - Verify accessibility and responsiveness — Add accessibility labels, check touch target sizes, and test across representative device sizes/orientations.