AI Agent Hub
Back to skills
HarmonyOS Code Workshop icon

HarmonyOS Code Workshop

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @user_8c9419f3/harmonyos-code-workshop.

About this skill

Problem

When building ArkTS apps under HarmonyOS 7 (API 26 Beta1) and DevEco Studio 26.0.0 Beta1, developers often run into compile-time friction caused by TypeScript/ArkTS syntax gaps, deprecated APIs mixed with newer ones, inconsistent state and routing patterns such as @State, @Prop, and Navigation, and missing constraints for folding-screen, tablet, and multi-device adaptation. This skill focuses on those practical issues rather than generic snippets.

How It Works

  • ArkTS constraints: generates code around let / const, explicit types, arrow functions, interface-based object literals, and avoidance of any, destructuring, and other unsupported patterns.
  • Deprecated API detection: flags patterns like router.pushUrl, global animateTo(), console.log, and legacy camera.Camera, then suggests Navigation, UIContext, hilog, and CameraManager alternatives.
  • Pre-output self-check: validates syntax, API usage, component rules, generics, and performance concerns, including a single @Entry, LazyForEach data sources, StorageLink defaults, and explicit return types.
  • Version annotations: adds an API version comment at the top of code blocks, defaulting to API 23+ unless the user specifies another target.

Boundaries

The material is written for HarmonyOS 7 (API 26 Beta1) and DevEco Studio 26.0.0 Beta1. Other API versions may have interface differences. For release, privacy, signing, and filing concerns, verify compliance against AGC review requirements.

Use Cases

  • Migrate legacy routing and animation calls in DevEco Studio 26 by replacing `router.pushUrl` and `animateTo` with `Navigation` and `UIContext`.
  • Build an ArkTS list page using `LazyForEach`, `IDataSource`, `@State`, and `@Link`, then run pre-output compile checks.
  • Adapt layouts for folding screens or tablets using breakpoints, window changes, and `BreakpointType` instead of stretching phone-only UI.
  • Review deprecated APIs such as `console.log`, legacy camera, and file APIs before release, then check permissions, privacy, and signing items.

Best For

  • HarmonyOS app engineers using DevEco Studio 26 who need compilable ArkTS code and fewer deprecated API pitfalls.
  • Front-end or client developers refactoring UI components and migrating old `Router` or global `animateTo` calls to `Navigation` and `UIContext`.
  • HarmonyOS developers handling multi-device adaptation, especially folding screens, tablets, and 2in1 layout or window state changes.
  • Client release owners preparing app submission who need to check permissions, privacy, signing, and review risks.