skills/code-problem-analyzer/SKILL.md
深度代码问题分析与根因定位。用于分析代码行为异常、执行流程问题、配置错误等技术问题。当用户需要:1) 分析代码执行流程找到问题根因,2) 理解复杂代码逻辑和调用链,3) 定位异常行为的原因,4) 排查配置或状态问题。使用触发词:问题定位、分析问题、问题分析、代码分析、根因分析。
npx skillsauth add openharmonyinsight/openharmony-skills code-problem-analyzerInstall 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 时,用户必须提供以下信息:
问题背景
问题相关信息
根据问题类型,使用以下策略探索代码:
执行流程问题:
grep 搜索关键函数、参数、标志位read 阅读关键文件,理解调用链状态管理问题:
isDebugApp、isStartWithDebug)配置问题:
GetBoolParam、GetApplicationInfo)在分析过程中,构建清晰的执行流程:
入口点 → 函数A → 函数B → 关键决策点 → 结果
对于每个关键点,记录:
根据流程分析,列出所有可能导致问题的原因:
根据以下标准排序可能的原因:
如果存在以下情况,使用 question 工具暂停并询问用户:
询问示例:
question:
questions:
- question: "我发现了两个可能的原因:[原因1] 和 [原因2]。为了进一步确认,请提供:"
header: "需要更多信息"
options:
- label: "检查配置文件"
description: "查看应用配置文件中的 debug 字段值"
- label: "查看完整日志"
description: "提供应用启动的完整日志"
- label: "检查等待调试列表"
description: "运行 aa appdebug get 命令查看等待调试状态"
## 问题分析结果
### 所有可能的流程
1. **流程1**: [流程描述]
- 文件:file.cpp:行号 - [关键代码片段]
- 文件:file.cpp:行号 - [关键代码片段]
- ...
2. **流程2**: [流程描述]
- 文件:file.cpp:行号 - [关键代码片段]
- ...
### 最有可能的根因
**根因**: [明确的根因描述]
**原因解释**:
- [解释1]
- [解释2]
- [关键代码位置]: file.cpp:行号
**建议的解决方案**:
1. [解决方案1]
2. [解决方案2]
### 需要进一步确认
[如果需要,说明需要用户做什么]
## 问题分析结果
### 最有可能的根因
**根因**: [明确的根因描述]
**原因**: [简短解释]
**关键代码位置**: file.cpp:行号
**解决方案**: [具体操作步骤]
如需更详细的分析方法论,请参阅:
development
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