skills/oh-add-memory-trace-tags/SKILL.md
Use when adding new resource tracking types to memory profiling in developtools_profiler and third_party_musl repositories. Triggered by requests to add trace tags, resource labels, or memory tracking types.
npx skillsauth add openharmonyinsight/openharmony-skills add-memory-trace-tagsInstall 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.
自动在 developtools_profiler 和 third_party_musl 仓库中添加新的资源跟踪类型标签。
此 skill 自动跨两个仓库的多个文件添加内存跟踪标签,确保定义一致、协议更新和测试覆盖。
适用于以下情况:
| 组件 | 修改文件数 | 主要变更 | |------|-----------|---------| | third_party_musl | 2 个文件 | TAG 和 MASK 定义 | | developtools_profiler | 9 个文件 | 协议、逻辑、测试 |
在对话中直接调用:
请添加一个新的资源跟踪标签 <标签名称>
或
使用 add-res-trace-tag 添加 <标签名>
此 skill 会提示输入:
标签名称(必填)
COMMON_<类型名> 或描述性名称COMMON_PIXELMAP、CREATE_NATIVE_WINDOW_FROM_SURFACE描述(可选)
是否绕过大小过滤(可选,默认:是)
src/hook/linux/memory_trace.h - TAG、MASK、位域布局porting/linux/user/src/hook/memory_trace.h - 重复定义协议:
protos/types/plugins/native_hook/native_hook_result.proto - TraceType、MemoryType 枚举常量:
device/plugins/native_daemon/include/hook_common.h - 索引常量业务逻辑:
device/plugins/native_hook/src/hook_guard.cpp - TagId 映射device/plugins/native_daemon/src/hook_manager.cpp - 掩码转换device/plugins/native_daemon/src/stack_preprocess.cpp - 统计映射device/plugins/native_daemon/src/hook_record.cpp - TraceType 设置device/plugins/native_hook/src/hook_client.cpp - 过滤条件(仅 COMMON_* 类型)测试:
device/plugins/native_daemon/test/unittest/common/native/hook_record_test.cppdevice/plugins/native_daemon/test/unittest/common/native/stack_preprocess_test.cpp每个资源类型必须定义两个宏:
// ✅ 正确:同时定义两个宏
#define RES_COMMON_WINDOW (1ULL << 33)
#define RES_COMMON_WINDOW_MASK (1ULL << 33)
// ❌ 错误:缺少 _MASK 后缀
#define RES_COMMON_WINDOW (1ULL << 33)
// 缺少 RES_COMMON_WINDOW_MASK!
为什么需要两个定义:
RES_<NAME> - 基础掩码值RES_<NAME>_MASK - 统一接口的别名常见错误场景:
错误 1:忘记添加 _MASK 后缀
#define RES_COMMON_SURFACE (1ULL << 34) // ✅ 有这个
// ❌ 缺少:#define RES_COMMON_SURFACE_MASK (1ULL << 34)
错误 2:只复制了第一行
#define RES_COMMON_TEXTURE (1ULL << 35) // ✅ 有这个
#define RES_COMMON_TEXTURE // ❌ 这行是错的!应该是 (1ULL << 35)
Skill 自动验证: 此 skill 会自动检查是否两个定义都存在,如果缺失会自动添加。
添加新标签后检查:
d:\Code\tools_develop\hook_client.cpp 的过滤条件| 错误 | 解决方案 | |------|----------| | 标签已存在 | 使用不同的标签名称 | | 文件未找到 | 验证仓库路径 | | 权限被拒绝 | 检查文件写入权限 | | 格式无效 | 标签名称必须是大写字母和下划线 | | 缺少 MASK | Skill 自动添加 RES_MASK 定义 | | 定义不匹配 | RES 和 RES_*_MASK 的值必须相同 |
testing
--- name: ohos-req-value-decision description: Use after review meeting to record decision and route to next step. Triggers: 评审决策纪要, 评审结论回流, value decision, 评审接纳, 评审不接纳, 评审退回, 下次重新上会. Do NOT use for feature baseline (ohos-req-feature-baseline), review gate checks (ohos-req-review-gate), or IR generation (ohos-req-feature-to-ir). metadata: author: openharmony scope: common stage: requirements capability: value-decision version: 0.3.0 status: draft tags: - sdd - requirements
development
Use when converting an OpenHarmony requirement document, spec, or design proposal into an OpenHarmony review slide deck (需求评审 / 需求变更评审 / 设计评审 PPTX) — produces the fixed OpenHarmony-branded review-deck structure (OH logo on every page) with architecture/flow diagrams and field tables. Triggers on "需求评审PPT", "需求变更评审", "把需求文档转成评审PPT", "spec转评审PPT", "requirement/spec to review deck". NOT for arbitrary or generic slide decks unrelated to OpenHarmony requirement/design review.
testing
Use when performing the Phase 0 Step 0.5 Review Ready Gate on a 04-feature.md, especially when the user says "evaluate gate", "review readiness", "feature ready?", "should we generate IR", or when the ohos-req-intake-orchestration main session needs a structured Ready / Conditional Ready / Not Ready judgment instead of doing the check inline. Reads 01-04, runs seven fixed checks plus a conditional-items check, and returns a machine-readable JSON summary plus a human-readable table that the main session can route on. Do NOT use for feature baseline generation (ohos-req-feature-baseline), value decision recording (ohos-req-value-decision), or IR generation (ohos-req-feature-to-ir).
testing
--- name: ohos-req-requirement-intake description: Use when importing an OHOS requirement into Phase 0.1, especially for 01-requirement.md, requirement intake, background, user value, scenarios, scope, FR/NFR, affected modules, or priority. Triggers: 需求导入, 01-requirement, 需求基线, RR单号. Do NOT use for feasibility analysis (ohos-req-feasibility-analysis), architecture decision (ohos-req-arch-decision), or feature baseline (ohos-req-feature-baseline). metadata: author: openharmony scope: common