arkts-debug
Skill1 starsChanged 2 months agoMITView on GitHub
Use when fixing ArkTS / .ets compilation errors and type mismatches in HarmonyOS / OpenHarmony app development. Triggers include errors mentioning ContentType, AppStorage.get, @StorageLink, getLastWindow, AvoidArea, TitleButtonRect, IDataSource, ESObject, LazyForEach, duplicate @Entry, "Object literal must correspond to some explicitly declared class or interface", "Possibly null", "Standalone function uses this", "Indexed access is not supported", arkts-no-props-by-index, "Declaration merging is not supported", arkts-no-decl-merging, "Cannot find module", "Maximum call stack", "inferred type cannot be named", or any arkts-no-* rule reported by hvigor / ArkCompiler. Loads a curated catalog of common HarmonyOS build errors and their canonical fixes.
In this repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- arkts-buildSkill
- arkts-crash-diagnosisSkill
- arkts-helperSkill
- arkts-ndk-devSkill
- arkui-x-devSkill
- atomic-service-devSkill
- create-app-iconSkill
- create-hmos-projectSkill
- harmony-designSkill
- harmony-fetchSkill
- hmos-flowSkill
- lite-simulator-debugSkill
- skill-authorSkill
- understand-hmosSkill
- validate-skillSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
If the task is general ArkTS authoring / migration / style (not a concrete error to fix), prefer arkts-helper instead.
- Distinctive: line 50
Read both for the matched category before editing the user's code.
- Distinctive: line 56
If the user's code has multiple errors, fix them one category at a time and re-check the build before moving on.
- Distinctive: line 60
When you reply, cite the specific reference file you used, e.g.:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Harmony Error Fixes
This skill provides solutions for common ArkTS compilation errors and type mismatches encountered during HarmonyOS / OpenHarmony development. Each entry has a focused reference document under references/ and a minimal .ets example under assets/.
When to Use This Skill
Activate this skill whenever any of the following holds:
- The user pastes an ArkTS /
.etscompile error from DevEco Studio, hvigor, or ArkCompiler. - The error contains rule codes from the
arkts-no-*family, or mentions any of:ContentType,AppStorage.get,@StorageLink,getLastWindow,AvoidArea,TitleButtonRect,IDataSource,ESObject,LazyForEach, duplicate@Entry, "Possibly 'null'", "Object literal must correspond to some explicitly declared class or interface", "Standalone function ... usesthis", "Indexed access is not supported",arkts-no-props-by-index, "Declaration merging is not supported",arkts-no-decl-merging, "Cannot find module", "Maximum call stack", "inferred type cannot be named". - The user asks how to fix a HarmonyOS build failure or strict ArkTS type error.
- You are reviewing
.etscode and want to pre-empt the most common compile errors.
If the task is general ArkTS authoring / migration / style (not a concrete error to fix), prefer arkts-helper instead. Use both together when the user is migrating TS to ArkTS and hits compile errors.
Boundary with Other Skills
This skill covers "how to fix compilation errors", not "how to write code", "how to invoke build commands", or "how to write NDK code". When a fix task involves the following issues, cross-reference the corresponding skill:
| Issue Type | Cross-reference Skill | Boundary |
| ArkTS syntax / migration / coding style (non-error scenarios) | arkts-helper | This skill covers "how to fix errors"; arkts-helper covers "how to write compliant code to avoid errors" |
| Need to rebuild and verify after fixing code | arkts-build | Use this skill to fix code, then use arkts-build's hvigorw commands to rebuild and confirm the error is resolved |
| NDK / C++ side compilation errors | arkts-ndk-dev | This skill only covers ArkTS-side compilation errors; if errors come from C++ / CMake / Node-API layers (e.g. .so link failures, undefined symbols), use arkts-ndk-dev |
| Errors / API changes not covered by offline docs | harmony-fetch | If the 28 error categories in this skill do not cover the current error (e.g. new arkts-no-* rules, deprecated APIs), use harmony-fetch to fetch the latest documentation from the Huawei developer portal |
| Code compiles but crashes at runtime (闪退/白屏/jscrash) | arkts-crash-diagnosis | This skill covers compile-time errors; runtime crash diagnosis and faultlog analysis belong to arkts-crash-diagnosis |
| Understanding an existing project / config field meaning | understand-hmos | "What is this file / why is this config here" questions belong to understand-hmos |
| Creating a new project from scratch | create-hmos-project | Project scaffolding belongs to create-hmos-project |
| Lite Wearable app fails at runtime on the Simulator (仿真器) | lite-simulator-debug | Compile-time errors belong to this skill; once the code compiles, running/debugging Lite Wearable apps on the DevEco Studio Simulator belongs to lite-simulator-debug |
Workflow (follow strictly)
1. Identify the error category
Read the user's error message and map it to one row in the Error Categories table below. The mapping is based on the diagnostic text or the API/decorator that triggered it. If the error does not match any row, fall back to arkts-helper/references/04-ts-to-arkts-migration-rules.md for the underlying arkts-no-* rule.
2. Open the matching reference + asset
For each category there are two files:
references/<topic>.md- root cause, canonical fix, edge-case notes.assets/<Topic>.ets- minimal before / after code that compiles cleanly.
Read both for the matched category before editing the user's code. Do not skim only the Quick Reference table.
3. Apply the canonical fix
Apply the fix exactly as documented. Do not silence errors with as any, // @ts-ignore, ESObject, or by deleting type annotations - these patterns are themselves flagged by ArkTS strict mode and will resurface elsewhere.
If the user's code has multiple errors, fix them one category at a time and re-check the build before moving on; one fix often unblocks or reshapes the next error.
4. Cite the reference
When you reply, cite the specific reference file you used, e.g.:
Fix per
arkts-debug/references/possibly_null_errors.md.
Error Categories
| Category | Description |
| Notification API Type Errors | ContentType type incompatibility |
| Window API Type Errors | Type inference issues with window.getLastWindow |
| AppStorage Type Errors | Type inference errors with AppStorage.get() |
| Object Spread Type Errors | Type inference issues with object spread |
| @StorageLink Default Value Errors | Missing default values for @StorageLink properties |
| Object Literal Interface Errors | Object literals without explicit interfaces |
| Object Literal Type Errors | Using object literal types in return type annotations |
| Function Return Type Errors | Limited return type inference |
| Arrow Function Conversion Errors | Using function expressions instead of arrow functions |
| Color Property Errors | Non-existent Color properties |
| Interface Method Signature Errors | Method signature mismatches in object literals |
| AvoidArea Type Errors | Missing visible property in AvoidArea type |
Standalone Function this Errors | Using this in standalone functions |
| TitleButtonRect Type Errors | Incorrect return type for getTitleButtonRect; non-existent left/top |
| Catch Clause Type Errors | Type annotations in catch clauses |
| ESObject Type Errors | Restricted usage of ESObject type |
| Resource Conversion Errors | Resource to string/number conversion errors |
| Unused Variable Warnings | Declared but never used variables |
| IDataSource Type Errors | LazyForEach requires IDataSource implementation |
| Duplicate Entry Errors | Multiple @Entry decorators in the same file |
| Possibly Null Errors | Object possibly null when accessing properties |
| Window Rect/Size Type Errors | window.Rect / window.Size shape mismatch |
| Indexed Access Errors | arkts-no-props-by-index — bracket notation property access |
| Declaration Merging Errors | arkts-no-decl-merging — duplicate declarations or namespace merging |
| Inferred Type Naming Errors | Exported symbol's inferred type cannot be named without internal reference |
| Array Type Inference Errors | Missing element type in array declarations (e.g., [][]) |
| Module Resolution Errors | Cannot find module or no exported member |
| Circular Import Errors | Circular module dependencies causing stack overflow |
Quick Reference
| Error Type | Solution |
| Notification type error | Cast to number type |
| Window type error | Use callback pattern for getLastWindow |
| AppStorage type error | Use @StorageLink with LocalStorage or AppStorage.setAndLink (avoid setOrCreate) |
| Object spread error | Explicitly type objects |
| @StorageLink default value error | Add = undefined or a specific default value |
| Object literal interface error | Define an interface before using the object literal |
| Object literal type error | Define an interface and use it as the return type |
| Function return type error | Add explicit return type annotation |
| Arrow function conversion error | Convert function to arrow function => |
| Color property error | Use hex color values instead of non-existent Color properties |
| Interface method signature error | Use property syntax method: () => {} instead of method syntax |
| AvoidArea type error | Add visible: false property to AvoidArea object |
Standalone function this error | Pass context as parameter: function foo(context: Context) |
| TitleButtonRect type error | Use window.TitleButtonRect; only width/height are available |
| Catch clause type error | Remove type annotation from the catch parameter |
| ESObject type error | Use a concrete type or ESModule instead of ESObject |
| Resource conversion error | Use Resource directly in UI or ResourceManager for runtime values |
| Unused variable warning | Use the value or delete the declaration |
| IDataSource type error | Implement IDataSource for LazyForEach |
| Duplicate Entry error | Remove extra @Entry; use @Component for child components |
| Possibly Null error | Add !== null check or use optional chaining |
| Window Rect/Size type error | Use the correct window.Rect / window.Size shape |
| Indexed access error | Use dot notation or Map instead of bracket notation |
| Declaration merging error | Consolidate into a single declaration or use extends |
| Inferred type naming error | Add explicit return type annotation to exported symbols |
| Array type inference error | Specify explicit element type (e.g., string[][] instead of [][]) |
| Module resolution error | Check oh-package.json5, import path, and case sensitivity |
| Circular import error | Extract shared types into a separate module |
Detailed Error Solutions
Notification API Type Errors
- Notification Type Error
- Code Example
Window API Type Errors
- Window Type Inference Error
- Code Example
AppStorage Type Errors
- AppStorage Type Error
- Code Example
Object Spread Type Errors
- Object Spread Type Error
- Code Example
@StorageLink Default Value Errors
- @StorageLink Default Value Error
- Code Example
Object Literal Interface Errors
- Object Literal Interface Error
- Code Example
Object Literal Type Errors
- Object Literal Type Error
- Code Example
Function Return Type Errors
- Function Return Type Error
- Code Example
Arrow Function Conversion Errors
- Arrow Function Conversion Error
- Code Example
Color Property Errors
- Color Property Error
- Code Example
Interface Method Signature Errors
- Interface Method Signature Error
- Code Example
AvoidArea Type Errors
- AvoidArea Type Error
- Code Example
Standalone Function this Errors
- Standalone Function
thisError - Code Example
TitleButtonRect Type Errors
- TitleButtonRect Type Error
- Code Example
Catch Clause Type Errors
- Catch Clause Type Error
- Code Example
ESObject Type Errors
- ESObject Type Error
- Code Example
Resource Conversion Errors
- Resource Conversion Error
- Code Example
Unused Variable Warnings
- Unused Variable Warning
- Code Example
IDataSource Type Errors
- IDataSource Type Error
- Code Example
Duplicate Entry Errors
- Duplicate Entry Error
- Code Example
Possibly Null Errors
- Possibly Null Error
- Code Example
Window Rect/Size Type Errors
- Window Rect/Size Type Error
- Code Example
Indexed Access Errors
- Indexed Access Error
- Code Example
Declaration Merging Errors
- Declaration Merging Error
- Code Example
Inferred Type Naming Errors
- Inferred Type Naming Error
- Code Example
Array Type Inference Errors
- Array Type Inference Error
- Code Example
Module Resolution Errors
- Module Resolution Error
- Code Example
Circular Import Errors
- Circular Import Error
- Code Example
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

