hmos-arkts-knowledge-retriever

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ArkTS Retrieval Skill

ArkTS 检索 Skill

Use this skill to find real ArkTS documentation quickly and return traceable references.
This skill is for retrieval. It does not default to running validation or execution tools automatically. In this copied package, prefer commands that work inside the package itself.
In the source repository, this skill lives under
skills/arkts-skill/
. This copied package is self-contained. Open cited markdown files under
docs/ArkTS-Language-Guide/
,
docs/ArkTS-API-Reference/
, or
docs/linter/
when you need the original context.
使用此 Skill 快速查找实际的 ArkTS 文档,并返回可追溯的参考资料。
此 Skill 用于检索,不会默认自动运行验证或执行工具。在此复制包中,应优先使用可在包内运行的命令。
在源仓库中,此 Skill 位于
skills/arkts-skill/
。此复制包是自包含的。需要原始上下文时,请打开
docs/ArkTS-Language-Guide/
、
docs/ArkTS-API-Reference/
或
docs/linter/
下的已引用 Markdown 文件。

What this skill covers

此 Skill 涵盖

  • Pure non-UI ArkTS syntax and language rules from
    docs/ArkTS-Language-Guide/02-Basic-Syntax
  • ArkTS-specific syntax constraints and boundary cases summarized from
    docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
  • Common-library usage from
    docs/ArkTS-Language-Guide/03-Common-Library
  • OpenHarmony ArkTS API reference material from
    docs/ArkTS-API-Reference/
    , including imports, parameters, return values, API versions, system capabilities, and error codes
  • Lightweight ArkTS lint workflow notes from
    docs/linter/linter-cli.md
    and the bundled
    linter-cli/
    package
  • Concurrency, runtime, toolchain, migration, and related language-guide sections when the query clearly points there
  • Snippet-level validation metadata derived from the repository's snippet framework
  • Grounded references for pure non-UI
    .ets
    topics inside this copied package, without assuming external validation tools are present
  • docs/ArkTS-Language-Guide/02-Basic-Syntax
    中不涉及 UI 的纯 ArkTS 语法和语言规则
  • docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
    中总结的 ArkTS 专属语法约束和边界情况
  • docs/ArkTS-Language-Guide/03-Common-Library
    中的 Common Library 使用方式
  • docs/ArkTS-API-Reference/
    中的 OpenHarmony ArkTS API 参考资料,包括导入、参数、返回值、API 版本、系统能力和错误码
  • docs/linter/linter-cli.md
    和随附的
    linter-cli/
    包中的轻量级 ArkTS lint 工作流说明
  • 当用户查询明确指向相关主题时,涵盖并发、运行时、工具链、迁移及相关语言指南章节
  • 从仓库代码片段框架派生的代码片段级验证元数据
  • 为此复制包中不涉及 UI 的
    .ets
    主题提供有依据的参考资料,同时不假定存在外部验证工具

Required behavior

必需行为

  1. Ground the answer in local repository sources, not in vague prior knowledge.
  2. Treat
    docs/ArkTS-Language-Guide/
    as the primary source for normative language explanations,
    docs/ArkTS-API-Reference/
    as the primary source for API/module/member details, and
    docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
    as implementation-derived evidence for ArkTS-specific restrictions and edge cases.
  3. Prefer pure non-UI and validation-backed references when multiple sections could fit.
  4. When a result comes from the linter summary, say that clearly instead of presenting it as official spec text. When a result comes from the API reference, do not treat its examples as pure non-UI snippet validation evidence.
  5. If the task mentions testing, validation, running, or debugging, add command hints as optional next steps rather than automatically executing them.
  6. If the first retrieval pass is weak, broaden to neighboring sections or adjacent categories before answering.
  7. If you still cannot find a grounded reference, say that clearly and name the searches you attempted.
  8. Return concise, useful citations by default:
    • file path
    • section path
    • source kind
    • short summary
    • why the section matched
  1. 以本地仓库来源为依据来回答问题,而不是依赖模糊的先验知识。
  2. 将
    docs/ArkTS-Language-Guide/
    视为规范性语言说明的主要来源,将
    docs/ArkTS-API-Reference/
    视为 API/模块/成员详情的主要来源,并将
    docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
    视为 ArkTS 专属限制和边界情况的实现派生证据。
  3. 当多个章节都适用时,优先选择不涉及 UI 且有验证依据的参考资料。
  4. 如果结果来自 linter 摘要,应明确说明这一点,而不要将其表述为官方规范文本。当结果来自 API 参考资料时,不要将其示例视为不涉及 UI 的代码片段验证证据。
  5. 如果任务涉及测试、验证、运行或调试,请将命令提示作为可选的后续步骤添加,而不是自动执行。
  6. 如果首次检索结果较弱,请扩大范围,检索相邻章节或邻近分类后再回答。
  7. 如果仍找不到有依据的参考资料,请明确说明,并列出尝试过的搜索。
  8. 默认返回简洁、实用的引用:
    • 文件路径
    • 章节路径
    • 来源类型
    • 简短摘要
    • 匹配原因

Retrieval workflow

检索工作流

  1. Run:
bash
python scripts/search_docs.py --query "<user request>"
  1. Read the top results.
  2. Open the cited markdown file under
    docs/ArkTS-Language-Guide/
    ,
    docs/ArkTS-API-Reference/
    , or
    docs/linter/
    if you need exact wording or more context.
  3. Answer using the result structure below.
Prefer
grouped_results
when it is present. Treat
results
as the raw flat candidate list kept for compatibility and debugging.
  1. 运行:
bash
python scripts/search_docs.py --query "<user request>"
  1. 读取排名靠前的结果。
  2. 如果需要准确措辞或更多上下文,请打开
    docs/ArkTS-Language-Guide/
    、
    docs/ArkTS-API-Reference/
    或
    docs/linter/
    下的已引用 Markdown 文件。
  3. 使用以下结果结构回答。
存在
grouped_results
时应优先使用。将
results
视为为兼容性和调试而保留的原始扁平候选列表。

Result structure

结果结构

Use this format unless the user wants something else:
markdown
- Topic: <topic label>
- Reference: <path>
- Section: <section path>
- Source: <official-guide | openharmony-arkts-api | linter-summary>
- Why it matches: <one sentence>
- Guidance: <one or two sentences grounded in the doc>
- Next step: <optional command hint>
除非用户另有要求,请使用以下格式:
markdown
- 主题: <主题标签>
- 参考资料: <路径>
- 章节: <章节路径>
- 来源: <official-guide | openharmony-arkts-api | linter-summary>
- 匹配原因: <一句话>
- 指导建议: <一到两句基于文档的建议>
- 后续步骤: <可选的命令提示>

When to expand past the top result

何时扩展到首个结果之外

Expand further when:
  • the top result is from
    04-Concurrency
    ,
    05-Runtime
    , or
    07-Compilation-Toolchain
    but the user question is still ambiguous
  • the top result is from
    docs/ArkTS-API-Reference/
    but the user is asking about ArkTS syntax restrictions rather than API signatures or module behavior
  • the top result is from
    docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
    and you still need an official guide section for broader context
  • grouped_results
    mixes only one source kind and the question looks restriction-heavy or diagnostic
  • the result has
    verification_level = doc_only
  • the user needs runnable or compile-checkable examples
  • multiple syntax rules interact, such as classes plus generics, or enums plus control flow
出现以下情况时,应继续扩大检索范围:
  • 首个结果来自
    04-Concurrency
    、
    05-Runtime
    或
    07-Compilation-Toolchain
    ,但用户问题仍不明确
  • 首个结果来自
    docs/ArkTS-API-Reference/
    ,但用户询问的是 ArkTS 语法限制,而不是 API 签名或模块行为
  • 首个结果来自
    docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
    ,但仍需要官方指南章节提供更广泛的上下文
  • grouped_results
    仅包含一种来源类型,且问题看起来高度关注限制或故障诊断
  • 结果的
    verification_level = doc_only
  • 用户需要可运行或可通过编译检查的示例
  • 多个语法规则相互影响,例如类与泛型组合,或枚举与控制流组合

Validation follow-ups

验证后续步骤

This copied package bundles
linter-cli/
, so you may suggest local lightweight lint commands from this directory when validation or diagnostics are relevant. Before first use, install its runtime dependencies inside
linter-cli/
. This package still does not bundle
arkts-cli
or
tools/snippets_cli.py
, so do not suggest those as local commands here.
Preferred local lint command:
bash
cd linter-cli && npm install && npm run install-runtime-deps
bash
cd linter-cli && node ./bin/linter-cli.js --input /abs/path/file.ets
此复制包随附了
linter-cli/
,因此当验证或诊断相关时,可以建议从当前目录运行本地轻量级 lint 命令。
首次使用前,请在
linter-cli/
内安装其运行时依赖。
此包仍未随附
arkts-cli
或
tools/snippets_cli.py
,因此不要在此建议将它们作为本地命令。
首选本地 lint 命令:
bash
cd linter-cli && npm install && npm run install-runtime-deps
bash
cd linter-cli && node ./bin/linter-cli.js --input /abs/path/file.ets

Index assets

索引资源

This skill relies on:
  • references/doc_index.json
  • references/snippet_index.json
  • references/cli_index.json
  • references/topic_aliases.json
The indexed repository sources are:
  • docs/ArkTS-Language-Guide/**/*.md
  • docs/ArkTS-API-Reference/**/*.md
  • docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
此 Skill 依赖:
  • references/doc_index.json
  • references/snippet_index.json
  • references/cli_index.json
  • references/topic_aliases.json
已建立索引的仓库来源包括:
  • docs/ArkTS-Language-Guide/**/*.md
  • docs/ArkTS-API-Reference/**/*.md
  • docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md