HarmonyOS Code Workshop
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 ofany, destructuring, and other unsupported patterns. - Deprecated API detection: flags patterns like
router.pushUrl, globalanimateTo(),console.log, and legacycamera.Camera, then suggestsNavigation,UIContext,hilog, andCameraManageralternatives. - Pre-output self-check: validates syntax, API usage, component rules, generics, and performance concerns, including a single
@Entry,LazyForEachdata sources,StorageLinkdefaults, 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.
Related Skills
A systematic code error fixing skill that follows a five-step workflow: Reproduce, Isolate, Understand, Fix, Verify, to help developers resolve code errors.
Restores Lanhu designs to target framework code using schema JSON, design tokens, and image assets.
Automatically detects engineering or competition code, analyzes bugs, vulnerabilities, algorithm complexity, and edge cases, then produces risk-level findings with before/after fixes.
Supports inline SVG/HTML rendering and Mermaid code output, covering common technical diagram creation like architecture and flow diagrams.