hmos-arkts-knowledge-retriever
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseArkTS 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 . This copied package is self-contained. Open cited markdown files under , , or when you need the original context.
skills/arkts-skill/docs/ArkTS-Language-Guide/docs/ArkTS-API-Reference/docs/linter/使用此 Skill 快速查找实际的 ArkTS 文档,并返回可追溯的参考资料。
此 Skill 用于检索,不会默认自动运行验证或执行工具。在此复制包中,应优先使用可在包内运行的命令。
在源仓库中,此 Skill 位于 。此复制包是自包含的。需要原始上下文时,请打开 、 或 下的已引用 Markdown 文件。
skills/arkts-skill/docs/ArkTS-Language-Guide/docs/ArkTS-API-Reference/docs/linter/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 , including imports, parameters, return values, API versions, system capabilities, and error codes
docs/ArkTS-API-Reference/ - Lightweight ArkTS lint workflow notes from and the bundled
docs/linter/linter-cli.mdpackagelinter-cli/ - 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 topics inside this copied package, without assuming external validation tools are present
.ets
- 中不涉及 UI 的纯 ArkTS 语法和语言规则
docs/ArkTS-Language-Guide/02-Basic-Syntax - 中总结的 ArkTS 专属语法约束和边界情况
docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md - 中的 Common Library 使用方式
docs/ArkTS-Language-Guide/03-Common-Library - 中的 OpenHarmony ArkTS API 参考资料,包括导入、参数、返回值、API 版本、系统能力和错误码
docs/ArkTS-API-Reference/ - 和随附的
docs/linter/linter-cli.md包中的轻量级 ArkTS lint 工作流说明linter-cli/ - 当用户查询明确指向相关主题时,涵盖并发、运行时、工具链、迁移及相关语言指南章节
- 从仓库代码片段框架派生的代码片段级验证元数据
- 为此复制包中不涉及 UI 的 主题提供有依据的参考资料,同时不假定存在外部验证工具
.ets
Required behavior
必需行为
- Ground the answer in local repository sources, not in vague prior knowledge.
- Treat as the primary source for normative language explanations,
docs/ArkTS-Language-Guide/as the primary source for API/module/member details, anddocs/ArkTS-API-Reference/as implementation-derived evidence for ArkTS-specific restrictions and edge cases.docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md - Prefer pure non-UI and validation-backed references when multiple sections could fit.
- 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.
- If the task mentions testing, validation, running, or debugging, add command hints as optional next steps rather than automatically executing them.
- If the first retrieval pass is weak, broaden to neighboring sections or adjacent categories before answering.
- If you still cannot find a grounded reference, say that clearly and name the searches you attempted.
- Return concise, useful citations by default:
- file path
- section path
- source kind
- short summary
- why the section matched
- 以本地仓库来源为依据来回答问题,而不是依赖模糊的先验知识。
- 将 视为规范性语言说明的主要来源,将
docs/ArkTS-Language-Guide/视为 API/模块/成员详情的主要来源,并将docs/ArkTS-API-Reference/视为 ArkTS 专属限制和边界情况的实现派生证据。docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md - 当多个章节都适用时,优先选择不涉及 UI 且有验证依据的参考资料。
- 如果结果来自 linter 摘要,应明确说明这一点,而不要将其表述为官方规范文本。当结果来自 API 参考资料时,不要将其示例视为不涉及 UI 的代码片段验证证据。
- 如果任务涉及测试、验证、运行或调试,请将命令提示作为可选的后续步骤添加,而不是自动执行。
- 如果首次检索结果较弱,请扩大范围,检索相邻章节或邻近分类后再回答。
- 如果仍找不到有依据的参考资料,请明确说明,并列出尝试过的搜索。
- 默认返回简洁、实用的引用:
- 文件路径
- 章节路径
- 来源类型
- 简短摘要
- 匹配原因
Retrieval workflow
检索工作流
- Run:
bash
python scripts/search_docs.py --query "<user request>"- Read the top results.
- Open the cited markdown file under ,
docs/ArkTS-Language-Guide/, ordocs/ArkTS-API-Reference/if you need exact wording or more context.docs/linter/ - Answer using the result structure below.
Prefer when it is present. Treat as the raw flat candidate list kept for compatibility and debugging.
grouped_resultsresults- 运行:
bash
python scripts/search_docs.py --query "<user request>"- 读取排名靠前的结果。
- 如果需要准确措辞或更多上下文,请打开 、
docs/ArkTS-Language-Guide/或docs/ArkTS-API-Reference/下的已引用 Markdown 文件。docs/linter/ - 使用以下结果结构回答。
存在 时应优先使用。将 视为为兼容性和调试而保留的原始扁平候选列表。
grouped_resultsresultsResult 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, or05-Runtimebut the user question is still ambiguous07-Compilation-Toolchain - the top result is from but the user is asking about ArkTS syntax restrictions rather than API signatures or module behavior
docs/ArkTS-API-Reference/ - the top result is from and you still need an official guide section for broader context
docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md - mixes only one source kind and the question looks restriction-heavy or diagnostic
grouped_results - 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 - 首个结果来自 ,但用户询问的是 ArkTS 语法限制,而不是 API 签名或模块行为
docs/ArkTS-API-Reference/ - 首个结果来自 ,但仍需要官方指南章节提供更广泛的上下文
docs/linter/ArkTS_Syntax_Knowledge_From_Linter.md - 仅包含一种来源类型,且问题看起来高度关注限制或故障诊断
grouped_results - 结果的
verification_level = doc_only - 用户需要可运行或可通过编译检查的示例
- 多个语法规则相互影响,例如类与泛型组合,或枚举与控制流组合
Validation follow-ups
验证后续步骤
This copied package bundles , 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 .
This package still does not bundle or , so do not suggest those as local commands here.
linter-cli/linter-cli/arkts-clitools/snippets_cli.pyPreferred local lint command:
bash
cd linter-cli && npm install && npm run install-runtime-depsbash
cd linter-cli && node ./bin/linter-cli.js --input /abs/path/file.ets此复制包随附了 ,因此当验证或诊断相关时,可以建议从当前目录运行本地轻量级 lint 命令。
linter-cli/首次使用前,请在 内安装其运行时依赖。
linter-cli/此包仍未随附 或 ,因此不要在此建议将它们作为本地命令。
arkts-clitools/snippets_cli.py首选本地 lint 命令:
bash
cd linter-cli && npm install && npm run install-runtime-depsbash
cd linter-cli && node ./bin/linter-cli.js --input /abs/path/file.etsIndex assets
索引资源
This skill relies on:
references/doc_index.jsonreferences/snippet_index.jsonreferences/cli_index.jsonreferences/topic_aliases.json
The indexed repository sources are:
docs/ArkTS-Language-Guide/**/*.mddocs/ArkTS-API-Reference/**/*.mddocs/linter/ArkTS_Syntax_Knowledge_From_Linter.md
此 Skill 依赖:
references/doc_index.jsonreferences/snippet_index.jsonreferences/cli_index.jsonreferences/topic_aliases.json
已建立索引的仓库来源包括:
docs/ArkTS-Language-Guide/**/*.mddocs/ArkTS-API-Reference/**/*.mddocs/linter/ArkTS_Syntax_Knowledge_From_Linter.md