|
1 | 1 | --- |
2 | 2 | name: harmony-next |
3 | | -description: Expert guidance for HarmonyOS NEXT (API 12+) development. Use this skill for ArkTS, ArkUI, and NDK development using official offline documentation for 3,300+ APIs and components. |
| 3 | +description: HarmonyOS NEXT(API 12+)离线参考库导航:按 Kit/任务/索引渐进式定位文档(ArkTS/ArkUI/NDK)。 |
4 | 4 | --- |
5 | 5 |
|
6 | | -# HarmonyOS NEXT Expert |
| 6 | +# HarmonyOS NEXT(离线文档导航) |
7 | 7 |
|
8 | | -This skill equips you with comprehensive, offline knowledge of HarmonyOS 5+ (ArkTS, ArkUI, NDK, System Services, etc.). The `references/` directory contains thousands of localized Markdown files directly converted from official developer documentation. |
| 8 | +目标:在不盲读 `references/` 的前提下,快速定位到 1 个或少量目标 Markdown,然后只打开这些文件。 |
9 | 9 |
|
10 | | -## How to use this skill |
| 10 | +## 渐进式披露(按顺序走) |
11 | 11 |
|
12 | | -Because the reference library is massive (~50MB, 3300+ files), **DO NOT attempt to read files blindly**. You MUST use the `grep_search` and `glob` tools to find the exact API or module you need before reading the specific Markdown file. |
| 12 | +1. **先缩小范围(选 Kit 或任务)** |
| 13 | + - Kit 导航:`references/KITS.md` |
| 14 | + - 任务导向:`references/TASK_MAP.md` |
13 | 15 |
|
14 | | -### Recommended Workflow (Optimized Search Protocol) |
| 16 | +2. **再精确命中文件(搜路径清单)** |
| 17 | + - 全库路径清单:`references/INDEX.md` |
| 18 | + - JS/ETS API 分桶清单:`references/JsEtsAPIReference/INDEX.md` |
15 | 19 |
|
16 | | -Due to the massive size of this knowledge base (3,300+ files), you MUST follow this **Three-Tier Search Protocol** to avoid being overwhelmed by irrelevant files: |
| 20 | +3. **仅在必要时浏览目录** |
| 21 | + `references/JsEtsAPIReference/` 已按桶分层:`modules/`、`topics/`、`capi/headers/`、`types/`、`errors/`、`guides/`。 |
17 | 22 |
|
18 | | -1. **Tier 1: Identify the Kit (Read `references/KITS.md`)** |
19 | | - HarmonyOS 5+ is organized by Kits (e.g., `AbilityKit`, `ArkUI`, `MediaKit`). Read `references/KITS.md` first to identify which Kit contains the functionality you need. This drastically narrows down the search space. |
| 23 | +## 常用检索(直接复制用) |
20 | 24 |
|
21 | | -2. **Tier 2: Task-to-File Mapping (Read `references/TASK_MAP.md`)** |
22 | | - For common tasks (Layout, Lifecycle, Network), check `references/TASK_MAP.md`. It links tasks to their most important keywords and Kits. |
| 25 | +- 先按关键词命中路径:`rg -n "UIAbility|AbilityStage|Want" references/INDEX.md | head` |
| 26 | +- 查某个 `@ohos.*` 模块:`rg -n "@ohos\\.app\\.ability\\.|@ohos\\.ability\\." references/JsEtsAPIReference/INDEX.md | head` |
| 27 | +- 查 NDK/C API 头文件:`rg -n "^capi/headers/.*(napi|arkui|window|ability).*\\.h\\.md$" references/JsEtsAPIReference/INDEX.md | head` |
23 | 28 |
|
24 | | -3. **Tier 3: Surgical Grep (via `references/INDEX.md`)** |
25 | | - Once you have the Kit name or specific keywords, use `grep` on `references/INDEX.md` to find the exact filenames. |
26 | | - - *Example*: `grep "AbilityKit" references/INDEX.md | grep "Context"` |
| 29 | +## 生成约束(避免踩坑) |
27 | 30 |
|
28 | | -### Core Content Structure |
| 31 | +- **不要全量读取**:先在 `INDEX.md` 命中路径,再打开对应 `.md`。 |
| 32 | +- **不确定就查文档**:API 签名、入参、返回值以 `references/` 内文本为准,不凭经验补全。 |
| 33 | +- **ArkUI 优先声明式**:示例优先使用 `@Entry` / `@Component` / `build()`(除非文档明确是 NDK 或系统服务)。 |
29 | 34 |
|
30 | | -- `JsEtsAPIReference/`: Detailed API signatures and C-API headers. |
31 | | -- `quickStart/`: Step-by-step developer guides. |
32 | | -- `ideGuides/`: Comprehensive IDE guides (Signing, Running, Debugging, CLI Tools, Standalone CLI Config). |
33 | | -- `performanceAndStandards/`: Performance optimization and UX best practices (Profiler, Latency, Memory). |
34 | | -- `appBasics/`: Core architecture guides (HAP/HAR/HSP, Stage Model, Concurrency). |
35 | | -- `multiDevice/`: Multi-device adaptation strategies (Adaptive/Responsive Layout). |
36 | | -- `continuation/`: Cross-device migration and multi-device collaboration. |
37 | | -- `ndkGuides/`: Native development guides (Node-API, C++ integration). |
38 | | -- `publishing/`: AppGallery Connect release and publishing process. |
39 | | -- `testing/`: Automation testing guides using Hypium. |
40 | | -- `KITS.md`: The primary navigation hub organized by @kit. |
41 | | -- `INDEX.md`: The full file list for surgical lookups. |
42 | | - |
43 | | -### Directory Structure under `references/` |
44 | | - |
45 | | -- `JsEtsAPIReference/` : Contains the bulk of ArkTS and ArkUI component APIs, lifecycle methods, error codes, and C-API/NDK headers. |
46 | | -- `quickStart/` : Beginner tutorials and fundamental concepts (e.g., page navigation, entry points). |
47 | | -- `ideGuides/` : IDE operational guides, CLI references, and debugging methodologies. |
48 | | -- `performanceAndStandards/` : Profiling tools (Insight) and app performance standards. |
49 | | -- `appBasics/` : Fundamental application architecture, models, and package structures. |
50 | | -- `testing/` : Testing frameworks and UI automation strategies. |
51 | | -- `hos/` & `hos_en/` : Core concepts, system services, and framework overviews. |
52 | | - |
53 | | -## Core Directives for HarmonyOS Generation |
54 | | - |
55 | | -1. **Strictly Declarative**: Always use the declarative UI paradigm syntax (`@Entry`, `@Component`, `build()`). |
56 | | -2. **No Hallucinations**: Rely strictly on the documentation provided in the `references/` folder when unsure about an API signature in HarmonyOS 5+. Do not assume standard Web JS or Android APIs are available unless verified in the docs. |
57 | | -3. **TypeScript/ArkTS Validation**: Ensure type safety and use standard ArkTS conventions. |
58 | | -\n<!-- version: 1.0.1 --> |
| 35 | +<!-- version: 1.1.0 --> |
0 commit comments