Announce at start: "I am using the arkweb-code-analysis skill to analyze the code repository."
Run mode
Mode A: Subagent mode (recommended)
When invoked as an independent subagent by arkweb-architect , obtain the requirement keywords and knowledge base evidence package from the task description, combine the DeepWiki online index + local analysis documents, and output a structured code index.
Input format (parsed from the task description):
## 需求关键词
{从需求中提取的技术关键词}
## 分析范围
- ace_engine: Web 组件相关代码
- web_webview: NWeb API 相关代码
- chromium_src: 内核相关代码(如涉及)
Knowledge base evidence package (the main Session has already completed retrieval in Phase 2 Step 2.0)
{knowledge base retrieval results, can be cited directly}
**输出:** 分析文档 → 保存到指定路径 → 回复关键发现
### 模式 B:交互模式
在主 session 中直接调用,用户指定仓库和分析目标。
---
## 分析数据源
> 通用降级策略、仓库信息、认证方式详见 `_shared/KB_RULES.md`。以下仅列出本 skill 的检索流程。
### 🥇 oh-chromium-knowledge 知识库
**读取流程(严格按顺序):**
1. `index.json` → 全局路由入口(14 个仓库索引)
2. `search/by_feature.json` → 按需求类型定位(35 个功能特性)
3. `search/by_module.json` → 按模块定位(20 个模块)
4. `repos/chromium_src/arkweb_adapter/routing_table.json` → 代码路径映射(29 个需求类型)
5. `repos/chromium_src/modules/components.json` → 组件索引(17 个核心组件)
6. `repos/chromium_src/arkweb_adapter/ohos_dirs.json` → OHOS 适配目录(43 个)
7. `repos/chromium_src/arkweb_adapter/nweb_service.json` → NWeb 接口映射
8. `repos/{repo}/architecture.md` → 各仓库架构文档
**禁止事项:**
- ❌ 不要一次性读取所有 repos/ 下的文件
- ❌ 不要跳过 Step 1(必须先读 index.json)
- ❌ 不要把知识库当源码——知识库仅提供索引,具体实现需查看实际代码仓库
**调用策略:**
1. 先读 `index.json` 了解全局结构
2. 根据需求关键词在 `search/by_feature.json` 中匹配相关功能特性
3. 从匹配到的 `files` 列表中读取 1-2 个关键文件
4. 用定位到的代码路径指导 DeepWiki 查询(更精准的关键词)
5. 如涉及 OHOS 适配,额外读取 `ohos_dirs.json` 和 `skills/ohos-adapter-guide.md`
**覆盖范围:**
- chromium_src / chromium_cef / chromium_third_party / chromium_chrome / chromium_v8 / chromium_third_party_skia(Tier 1)
- ffmpeg / angle / devtools_frontend / webrtc / blink_webtests / dawn / pdfium(Tier 2)
- chromium_arkweb(Tier 3)
- 详见知识库 SKILL.md:`skills/oh-chromium-knowledge/SKILL.md`
### 🥇 oh-ai-full-design 知识库
**仓库**: `openharmony-ai-design/oh-ai-full-design`(GitCode 私有)
**用途**: 鸿蒙组件体系检索(子系统/部件/API/SystemCapability),与 oh-chromium-knowledge 互补
**读取流程:**
1. `index.json` → 全局路由入口
2. `search/by_keyword.json` → 按关键词定位组件
3. `subsystems/{subsystem}.json` → 子系统索引
4. `components/*/*.json` → 部件详情
5. `apis/*/*.json` → 接口详情(按需)
**注意**: 私有仓库,无权限时跳过。详见 `_shared/KB_RULES.md` 第 3 节。
### 🥈 DeepWiki MCP(在线索引增强)
通过 OpenCode MCP 直接调用 DeepWiki API,获取 AI 增强的仓库代码理解(架构、类关系、调用链路等)。无需浏览器渲染,速度快、结构化输出。
**MCP 配置(opencode.json):**
```json
{
"mcp": {
"deepwiki": {
"type": "remote",
"url": "https://mcp.deepwiki.com/mcp"
}
}
}
MCP tools (3):
| Tool | Function | Parameter | Applicable scenario |
|---|---|---|---|
read_wiki_structure |
Get the list of repository document topics | repoName: GitHub repository path |
Quickly understand the repository coverage and determine the search direction |
read_wiki_contents |
View repository document content | repoName + topic |
Deeply understand the detailed documentation of modules/classes/APIs |
ask_question |
AI Q&A (based on repository context) | repoName + question |
Precisely search code issues and obtain AI-enhanced analysis |
Covered repositories:
| Repository | repoName | DeepWiki URL |
|---|---|---|
| OpenHarmony ACE Engine | openharmony/arkui_ace_engine |
https://deepwiki.com/openharmony/arkui_ace_engine |
| OpenHarmony WebWebView | openharmony/web_webview |
https://deepwiki.com/openharmony/web_webview |
| OpenHarmony Chromium adaptation | OpenHarmony-TPC/chromium_src |
https://deepwiki.com/OpenHarmony-TPC/chromium_src |
| OpenHarmony CEF adaptation | OpenHarmony-TPC/chromium_cef |
https://deepwiki.com/OpenHarmony-TPC/chromium_cef |
| OpenHarmony Chromium third-party libraries | OpenHarmony-TPC/chromium_third_party |
https://deepwiki.com/OpenHarmony-TPC/chromium_third_party |
Invocation strategy:
- First call
read_wiki_structureto get the repository topic overview and determine relevant modules - Call
read_wiki_contentsto read the detailed documentation of relevant modules - Call
ask_questionto precisely search specific code issues (class definitions, method signatures, call chains, etc.) - Call
ask_questionseparately for multiple keywords, and merge the results - For chromium_src, prioritize searching for classes in the Blink namespace (such as
blink::HTMLInputElement)
Fallback strategy: see _shared/KB_RULES.md
🥉 Local analysis documents (reuse)
| Document | Path | Content |
|---|---|---|
| ACE Engine analysis | analysis/arkweb-ace-engine-analysis.md |
Complete index of Web components |
| WebWebView analysis | analysis/web-webview-analysis.md |
NWeb API index |
| Chromium ArkWeb | analysis/chromium-arkweb-analysis.md |
Kernel analysis |
| CEF analysis | analysis/chromium-cef-analysis.md |
CEF layer analysis |
Usage: grep -n -i "{keyword}" {project_root}/analysis/*.md
🏅 Clone repository (last resort)
When neither DeepWiki nor local documents can cover it:
git clone --depth=1 https://gitcode.com/{owner}/{repo}.git {DOCS_REPO}/tmp/{repo}
Process
Step 1: oh-chromium-knowledge knowledge base retrieval
- Read
index.jsonto obtain the global structure - Match relevant functional features in
search/by_feature.jsonaccording to requirement keywords - Obtain the recommended file list from the matching results
- Read
routing_table.jsonfor the code path mapping of the corresponding requirement type - If OHOS adaptation is involved, read
ohos_dirs.jsonandnweb_service.json - If a specific component is involved, read
components.jsonfor the corresponding entry
Step 2: DeepWiki MCP query
- Determine the repositories to query based on the analysis scope (see the covered repositories table above)
- Call
read_wiki_structureto get an overview of the repository documentation topics - Call
read_wiki_contentsto read the documentation of the relevant modules - Call
ask_questionto precisely search code questions:- Class definitions and inheritance relationships
- Method signatures and parameters
- Call chains
- Architecture relationships
- File paths (e.g.,
third_party/blink/renderer/core/html/...)
- Repeat the query for multiple keywords and merge the results
When MCP is unavailable, fall back to the browser method:
- Use the agent-browser skill to open the DeepWiki page
- After taking a snapshot, search for keywords and extract code information
Step 3: Local documentation supplement
- Search for keywords in existing analysis documents
- Supplement details not covered by DeepWiki (e.g., file paths, line numbers)
Step 4: Merge analysis
Merge the knowledge base index + DeepWiki findings + local documentation information into a unified analysis result.
Step 5: Evidence package persistence (mandatory)
[Mandatory persistence] Write the evidence package to {DOCS_REPO}/tmp/, see _shared/KB_RULES.md Section 10.
The evidence package file must contain:
- Theraw retrieval resultsof each data source (complete JSON, text, code snippets); saving only summaries is not allowed
- 🥇 The complete JSON response of the knowledge base index
- 🥈 The complete answer content of DeepWiki
- 🥉 The complete matching snippets of the local documentation
- 🏅 The complete search output of the cloned repository
Step 6: Generate analysis document
# {feature-name} 代码分析
## 数据源
- 知识库: oh-chromium-knowledge({匹配的需求类型}, {读取的索引文件})
- DeepWiki: {使用的仓库 URL,搜索的关键词及结果摘要}
- {仓库1}: {URL} → 搜索 "{keyword1}", "{keyword2}" → {发现摘要}
- {仓库2}: {URL} → 搜索 "{keyword3}" → {发现摘要}
- 本地文档: {参考的分析文件}
## 相关文件清单
| 文件 | 路径 | 职责 | 与本需求的关系 |
|------|------|------|--------------|
## 关键类和接口
| 类/结构 | 文件 | 方法/字段 | 说明 |
|---------|------|----------|------|
## 调用链路
{描述相关代码的调用关系}
## 现有相关逻辑
{描述现有代码中与本需求相关的已有实现}
## 技术可行性评估
| 方案 | 涉及的现有代码 | 可行性 | 风险点 |
|------|--------------|--------|--------|
Step 7: Output
Subagent mode
Save the document and reply with a summary of key findings.
Interactive mode
Output the analysis results for the user's reference.
Deliverables
- Path:
{DOCS_REPO}/analysis/YYYY-MM-DD-{feature}-analysis.md
Subagent reply format
✅ code-analysis 完成
📄 文档:{file_path}
🔍 数据源:oh-chromium-knowledge + oh-ai-full-design ({N} 个索引) + DeepWiki ({N} 个仓库, {N} 个关键词) + 本地文档 ({N} 个)
📊 关键发现:
- 相关文件 {N} 个,核心类 {N} 个
- 关键接口:{interface_1}, {interface_2}
- 调用链路:{简要描述}
- ⚠️ 注意:{潜在风险或需关注的点}