skills/harmonyos-ai-agent-skill/references/hmos-multidevice-avoid-areas/SKILL.md
Handle HarmonyOS avoid-area adaptation through a declarative scene and resource index. Use when the task involves safe area expansion, status bar or navigation bar avoidance, notch or cutout handling, immersive full-screen layouts, or soft keyboard overlap handling.
npx skillsauth add openharmonyinsight/openharmony-skills hmos-multidevice-avoid-areasInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| 字段 | 内容 |
| --- | --- |
| skill_id | device-avoid-areas |
| skill_name | 设备避让区适配 |
| one_line_purpose | 为系统栏、挖孔区、软键盘和沉浸式布局提供统一避让策略。 |
| device_scope | phone / tablet / 2in1 / tv |
| problem_scope | safe area、状态栏和导航栏避让、挖孔区、软键盘、沉浸式布局 |
| not_in_scope | 与系统区域无关的普通间距调整、纯业务交互逻辑 |
| primary_outputs | primary_scene、device_constraints、implementation_notes、fix_plan、verification_matrix |
| 标签 | 阶段 | 当前模块关注点 |
| --- | --- | --- |
| REQ | 需求分析设计 | 避让区域类型、背景与内容边界、沉浸式适配、安全区扩展 |
| DEV | 开发 | 动态获取避让区域API、padding设置、窗口设置、expandSafeArea安全区域设置 |
| FIX | 问题修复 | 内容被系统栏区域遮挡、软键盘拉起遮挡内容、沉浸式错位、刘海区/挖孔区内容遮挡或交互失效 |
| VAL | 功能验证 | 截图证据、系统区域变化证据、键盘开闭证据 |
active_phases、primary_phase、primary_scene、secondary_scenes、resources_usedREQ:device_constraints、capability_boundary、acceptance_focusDEV:code_touchpoints、reuse_resources、implementation_notes、integration_risksFIX:problem_profile、root_cause_hypothesis、fix_plan、regression_watchlistVAL:verification_matrix、evidence_requirements、pass_criteria、residual_risksdevice_constraints:指由状态栏、导航栏、挖孔区、软键盘和沉浸式窗口带来的适配硬约束。在 device-avoid-areas 中,通常是哪些系统区域会遮挡内容、背景是否允许延伸、哪些交互区绝不能落入不可点击区域。capability_boundary:指当前避让方案在哪些窗口模式、系统 UI 状态或设备类型下有效,哪些场景需要回退或额外处理。acceptance_focus:指需求阶段验收时必须重点确认的遮挡现象、键盘开闭行为和系统区域变化表现。deliverables.REQ 出现 device_constraints,表示“该避让场景命中后,需求阶段必须先说明遮挡和边界约束”,不是对字段重复定义。AVOID-01。AVOID-02。AVOID-03。AVOID-04。AVOID-01 避让区域识别与动态获取scene_id: AVOID-01
scene_name: 避让区域识别与动态获取
phase_tags: [REQ, DEV, FIX, VAL]
priority: P0
intent_signals:
- AvoidAreaType
- TYPE_SYSTEM
- TYPE_NAVIGATION_INDICATOR
- TYPE_CUTOUT
- TYPE_KEYBOARD
applies_when:
- 需要动态获取系统栏、挖孔区或键盘区域
- 当前问题表现为内容被系统区域遮挡
not_applies_when:
- 只是普通布局间距问题
decisions:
- 确定需要监听哪些避让区域
- 决定使用 padding、margin、offset 还是结构切换
deliverables:
REQ:
- device_constraints
- capability_boundary
- acceptance_focus
DEV:
- code_touchpoints
- reuse_resources
- implementation_notes
- integration_risks
FIX:
- problem_profile
- root_cause_hypothesis
- fix_plan
- regression_watchlist
VAL:
- verification_matrix
- evidence_requirements
- pass_criteria
- residual_risks
resource_refs:
- RSC_AVOID_01
- RSC_AVOID_05
AVOID-02 安全区扩展与背景延伸scene_id: AVOID-02
scene_name: 安全区扩展与背景延伸
phase_tags: [REQ, DEV, FIX, VAL]
priority: P0
intent_signals:
- expandSafeArea
- SafeAreaType
- SafeAreaEdge
- 背景延伸
applies_when:
- 背景需要铺满系统区域,但内容仍需保持在安全区内
- 需要明确顶部和底部内容边界
not_applies_when:
- 页面需要完全沉浸式展示且不保留常规内容边界
decisions:
- 确定哪些层允许越过安全区,哪些层必须避让
- 决定安全区扩展后是否还要补额外内边距
deliverables:
REQ:
- device_constraints
- capability_boundary
- acceptance_focus
DEV:
- code_touchpoints
- reuse_resources
- implementation_notes
- integration_risks
FIX:
- problem_profile
- root_cause_hypothesis
- fix_plan
- regression_watchlist
VAL:
- verification_matrix
- evidence_requirements
- pass_criteria
- residual_risks
resource_refs:
- RSC_AVOID_02
AVOID-03 沉浸式全屏布局scene_id: AVOID-03
scene_name: 沉浸式全屏布局
phase_tags: [REQ, DEV, FIX, VAL]
priority: P1
intent_signals:
- setWindowLayoutFullScreen
- 全屏
- 沉浸式
- 状态栏透明
- 列表沉浸
applies_when:
- 页面需要背景或媒体内容铺满边缘
- 当前问题表现为全屏后内容与系统栏重叠
- 列表/信息流场景需要上滑隐藏标题栏和导航栏
not_applies_when:
- 页面保持普通安全区布局即可
decisions:
- 明确背景延伸和内容避让的分层策略
- 决定窗口级设置和页面级布局如何配合
- 识别是否命中 best practice 场景, 命中时必须逐条对照
deliverables:
REQ:
- device_constraints
- capability_boundary
- acceptance_focus
DEV:
- code_touchpoints
- reuse_resources
- implementation_notes
- integration_risks
FIX:
- problem_profile
- root_cause_hypothesis
- fix_plan
- regression_watchlist
VAL:
- verification_matrix
- evidence_requirements
- pass_criteria
- residual_risks
resource_refs:
- RSC_AVOID_03
- RSC_AVOID_06
- RSC_AVOID_05
AVOID-04 软键盘避让与输入区稳定性scene_id: AVOID-04
scene_name: 软键盘避让与输入区稳定性
phase_tags: [REQ, DEV, FIX, VAL]
priority: P0
intent_signals:
- keyboardAvoidMode
- avoidAreaChange
- 输入框被遮挡
- 键盘弹出
applies_when:
- 输入框、按钮或底部操作栏会被软键盘遮挡
- 当前问题表现为键盘开闭导致内容跳动或错位
not_applies_when:
- 页面没有输入交互
decisions:
- 选择滚动、平移或重排哪种键盘避让方式
- 决定键盘弹出、收起、焦点切换时的同步策略
deliverables:
REQ:
- device_constraints
- capability_boundary
- acceptance_focus
DEV:
- code_touchpoints
- reuse_resources
- implementation_notes
- integration_risks
FIX:
- problem_profile
- root_cause_hypothesis
- fix_plan
- regression_watchlist
VAL:
- verification_matrix
- evidence_requirements
- pass_criteria
- residual_risks
resource_refs:
- RSC_AVOID_01
- RSC_AVOID_04
- RSC_AVOID_05
RSC_AVOID_01 避让区域类型参考resource_id: RSC_AVOID_01
resource_type: reference
path: ./references/avoid_area_types.md
phase_tags: [REQ, DEV, FIX, VAL]
priority: P0
used_for:
- 识别系统栏、导航栏、挖孔区和键盘区域类型
- 设计动态获取与监听策略
load_when:
- 命中 AVOID-01 或 AVOID-04
avoid_when:
- 当前不涉及系统区域和键盘区域
supports_scenes:
- AVOID-01
- AVOID-04
output_fields:
- device_constraints
- capability_boundary
- implementation_notes
- root_cause_hypothesis
- verification_matrix
RSC_AVOID_02 安全区扩展参考resource_id: RSC_AVOID_02
resource_type: reference
path: ./references/safe_area_api.md
phase_tags: [REQ, DEV, FIX, VAL]
priority: P0
used_for:
- 定义安全区扩展和背景延伸的边界
- 判断内容层与背景层的职责划分
load_when:
- 命中 AVOID-02
avoid_when:
- 页面不使用安全区扩展
supports_scenes:
- AVOID-02
output_fields:
- device_constraints
- capability_boundary
- implementation_notes
- fix_plan
- pass_criteria
RSC_AVOID_03 沉浸式布局参考resource_id: RSC_AVOID_03
resource_type: reference
path: ./references/immersive_layout.md
phase_tags: [REQ, DEV, FIX, VAL]
priority: P0
used_for:
- 定义窗口级全屏和页面级避让的配合方式
- 排查沉浸式布局中的内容遮挡问题
load_when:
- 命中 AVOID-03
avoid_when:
- 页面不需要沉浸式展示
supports_scenes:
- AVOID-03
output_fields:
- device_constraints
- implementation_notes
- root_cause_hypothesis
- verification_matrix
- residual_risks
RSC_AVOID_04 键盘避让参考resource_id: RSC_AVOID_04
resource_type: reference
path: ./references/keyboard_handling.md
phase_tags: [REQ, DEV, FIX, VAL]
priority: P0
used_for:
- 设计键盘弹出、收起和焦点切换时的避让逻辑
- 排查输入区跳动、按钮被遮挡等问题
load_when:
- 命中 AVOID-04
avoid_when:
- 页面没有输入交互
supports_scenes:
- AVOID-04
output_fields:
- acceptance_focus
- implementation_notes
- fix_plan
- verification_matrix
- evidence_requirements
RSC_AVOID_05 问题修复案例集resource_id: RSC_AVOID_05
resource_type: reference
path: ./references/bug-fix-cases.md
phase_tags: [FIX]
priority: P1
used_for:
- 排查状态栏遮挡、挖孔区遮挡、沉浸式布局错位、键盘避让异常等常见问题
load_when:
- 命中 AVOID-01 或 AVOID-03 或 AVOID-04 且处于 FIX 阶段
avoid_when:
- 当前不涉及问题修复
supports_scenes:
- AVOID-01
- AVOID-03
- AVOID-04
output_fields:
- problem_profile
- root_cause_hypothesis
- fix_plan
- regression_watchlist
RSC_AVOID_06 开发场景方案集resource_id: RSC_AVOID_06
resource_type: reference
path: ./references/scenario-development-cases.md
phase_tags: [REQ, DEV, VAL]
priority: P0
used_for:
- 提供沉浸式布局等场景的完整开发方案与分步实现
load_when:
- 命中 AVOID-03 且处于 REQ 或 DEV 阶段
avoid_when:
- 当前处于 FIX 阶段(应走 RSC_AVOID_05)
supports_scenes:
- AVOID-03
output_fields:
- acceptance_focus
- implementation_notes
- code_touchpoints
- verification_matrix
REQactive_phases、primary_phase、primary_scene、secondary_scenesdevice_constraints、capability_boundary、acceptance_focusDEVcode_touchpoints、reuse_resources、implementation_notes、integration_risksFIXproblem_profile、root_cause_hypothesis、fix_plan、regression_watchlistVALverification_matrix、evidence_requirements、pass_criteria、residual_risksdevelopment
Run local code quality checks covering a subset of OpenHarmony gate CI (copyright, CodeArts C/C++) plus additional local checks (pylint/flake8, shellcheck/bashate, gn format). Use before committing to reduce gate failures. Triggers on: /oh-precommit-codecheck, "门禁检查", "门禁预检", "检查代码", "run codecheck", "check code quality", "lint my code", "代码检查", or after completing code implementation. WHEN to use: before git commit, before creating PR, after modifying C/C++/Python/Shell/GN files, when gate CI fails with codecheck defects, or when you want to preview what gate will flag.
development
OpenHarmony PR full lifecycle workflow. Five modes: - Commit: standardized commit with DCO sign-off and Issue linking - Create PR: commit + push to fork + create Issue + create PR on upstream - Fix Codecheck: fetch gate CI codecheck defects from a PR and auto-fix them - Review PR: fetch a PR's changes to local for code review - Fix Review: fetch unresolved review comments from a PR and auto-fix them Triggers on: /oh-pr-workflow, "提交代码", "创建PR", "提个PR", "commit", "修复告警", "修复门禁", "修复codecheck", "fix codecheck", "review pr", "review这个pr", "看下这个pr", "检视pr", "修复review", "修复检视意见", "fix review", or a GitCode PR URL with fix/review intent.
testing
分析 HM Desktop PRD 文档,提取需求信息、验证完整性、检查章节顺序(需求来源→需求背景→需求价值分析→竞品分析→需求描述)、检查 KEP 定义、检测需求冲突并生成结构化分析报告。适用于用户请求:(1) 分析或审查 PRD 文档, (2) 从需求中提取 KEP 列表, (3) 检查 PRD 完整性或一致性, (4) 将需求映射到模块架构, (5) 验证 PRD 格式合规性, (6) 验证竞品分析章节完整性。关键词:PRD分析, requirement extraction, KEP验证, completeness check, chapter order validation, 竞品分析检查, analyze PRD, 需求提取, 完整性检查, 章节顺序验证
development
基于 PRD 文档自动生成鸿蒙系统设计文档,包括架构设计文档和功能设计文档。生成前会分析 OpenHarmony 存量代码结构,确保与现有架构兼容。架构设计文档第2章必须为竞品方案分析,位于需求背景之后。适用于用户请求:(1) 生成架构设计文档, (2) 生成功能设计文档, (3) 从 PRD 生成设计文档, (4) 创建系统架构设计, (5) 编写功能规格说明, (6) 分析 OH 代码结构。关键词:architecture design, functional design, design doc, 竞品方案分析, OpenHarmony code analysis, 架构设计, 功能设计, 设计文档生成, OH代码分析, analyze codebase, competitor analysis