name: arkui-knowledge description: Load this skill when answering ArkUI UI questions or when writing/modifying ArkUI components, layouts, state-driven UI, rendering control, navigation, dialogs, interactions, component APIs, or ArkUI declarative UI in .ets files.
ArkUI Knowledge
Use this skill for ArkUI UI knowledge and implementation guidance. It helps answer ArkUI questions and helps agents write correct, polished ArkUI code on the first pass.
When to load
Load this skill when the task involves:
- ArkUI components, component modifiers, component nesting, or declarative UI structure.
- Layout with
Column,Row,Stack,Flex,Grid,List,Scroll,Tabs, orTabContent. - UI state refresh with
@State,@Prop,@Link,@Local,@Param,@Provide,@Consume, or related decorators. - Rendering control with
ForEach,LazyForEach, conditional UI, builders, or reusable UI blocks. - Navigation, dialogs, toast prompts, menus, gestures, animation, visual styling, or UI quality.
- Writing or modifying
.etsfiles that render visible ArkUI surfaces.
Do not load this skill for:
- Plain ArkTS syntax restrictions with no UI component concern; use
arkts-grammar-standards. - Build or type errors after compilation fails; use
arkts-error-fixes. - Runtime crashes, white screens, jscrash logs, or uncaught exceptions; use
arkts-runtime-fix. - New project creation or empty project initialization; use
deveco-create-project.
Responsibilities
- Explain ArkUI concepts, APIs, component choices, and correct usage.
- Guide page and component structure while preserving the current project style.
- Prevent high-frequency ArkUI mistakes before code is written.
- Improve UI quality: visible required text, clickable required controls, stable layout, state refresh, and minimal unrelated edits.
- Keep ArkUI guidance separate from ArkTS language restrictions and post-build error repair.
Before answering or coding
- Identify the ArkUI topic: component, layout, state, rendering, navigation, dialog, interaction, animation, or visual quality.
- For questions, answer directly, then add the correct usage, common trap, and applicable boundary.
- For code changes, read the target
.etsfile first. Keep the existing state-management style, navigation style, directory style, and business flow. - Check the relevant reference before using a high-risk API:
references/component-cookbook.mdreferences/api-guardrails.mdreferences/common-mistakes.mdreferences/ui-quality-checklist.md
- If a component signature, enum, callback parameter, or modifier owner is unclear and the local references do not cover it, inspect official/project documentation or existing project usage before writing code.
ArkUI component guardrails
Tabscan containTabContentdirectly. Build tabs withTabs(...) { TabContent() { ... }.tabBar(...) }.- Do not pass a
builderobject intoTabContent; useTabContent()and set the label with.tabBar(...). ForEachandLazyForEachkey generators should return a stable string key from the item. Avoidvoidkeys and index keys for business data.- Place ArkUI state decorators only on component member declarations with the correct V1 or V2 decorator family. Do not mix V1 and V2 decorators in one component.
- Do not invent modifier names. Use full ArkUI names including
.backgroundColor(),.borderRadius(),.fontSize(), and.fontColor(). - Match modifiers to component owners. For example, text modifiers belong on
Text, image fitting belongs onImage, and layout alignment differs by container. - Prefer the existing navigation approach in the project. Do not replace router,
Navigation, or custom app routers without a clear requirement. - For dialogs, toast prompts, navigation, and animation, prefer valid UI context usage when the current project already follows that pattern.
Common mistakes
Read references/common-mistakes.md before implementing UI with tabs, lists, decorators, dialogs, navigation, or custom builders.
High-risk mistakes to avoid:
TabContentwith a fake object parameter.Tabscontaining direct non-TabContentchildren.ForEachkey generator with a block body that does not return a string.@Stateon top-level variables, local variables, plain classes, or component inputs.@ComponentV2using V1 decorators including@State.- Component modifiers borrowed from web, Android, other UI frameworks, or CSS shorthand.
- Dialog button fields with the wrong key names.
- Required UI text hidden by layout, overlay, tiny size, or unreachable navigation.
UI quality checklist
Use references/ui-quality-checklist.md before finalizing UI work. At minimum:
- Required labels, buttons, cards, tabs, and dialog text are visible on the target screen.
- Required clicks update state, open the dialog, switch the tab, navigate, or show the expected response.
- New UI fits the current page density, spacing, color, and component style.
- Layout has stable dimensions where dynamic content could otherwise shift or overlap.
- The change is limited to files needed by the UI request.
Boundaries with other skills
- Use
arkts-grammar-standardsfor ArkTS language rules, TypeScript-to-ArkTS differences, template literals, dynamic property access, object literal typing, and syntax compliance. - Use
arkts-error-fixesonly after compilation reports errors or when directly fixing build/type failures. - Use
arkts-runtime-fixfor runtime stack traces, white screens, uncaught exceptions, and jscrash logs. - Use
deveco-create-projectfor project initialization. - Do not perform state-management migration unless the user explicitly asks for that migration.