ohos-app-scaffold

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OHOS App Scaffold

OHOS 应用脚手架

Create only the project skeleton from the Empty Ability template, then stop. Use the
devecocli
CLI
for project creation instead of manually copying a template. This skill is a project-initialization skill, not an app-development skill. Building, feature implementation, UI design, tests, and device validation belong to
ohos-app-dev
after the project is created.
仅基于 Empty Ability 模板创建项目骨架,然后停止。使用
devecocli
CLI
创建项目,而不是手动复制模板。本 skill 是项目初始化 skill,而非应用开发 skill。构建、功能实现、UI 设计、测试和设备验证应在项目创建后交由
ohos-app-dev
完成。

Scope gate

范围判定

Before acting, separate the request into two possible intents:
  • Scaffolding intent: create a new OHOS/HarmonyOS project, specify its app name, bundle name, project path, or API level. Handle this with this skill.
  • Development intent: implement a todo list, login screen, database, networking, custom UI, business logic, tests, or any other feature. Do not handle this with this skill. Stop after scaffolding and ask whether the user wants to continue with
    ohos-app-dev
    , or with
    ohos-system-app-dev
    for privilege preflight when the requested APIs or permissions may require
    hos_system_app
    , an elevated APL, ACL/provisioning, or a Full SDK system API.
If a request contains both intents, perform only the scaffolding intent. Do not infer permission to implement the requested feature merely because the user named the app after that feature (for example,
TodoList
).
Prereqs: Node.js and npm, the DevEco CLI installed by the hackathon setup and on PATH, and an available DevEco Studio toolchain (
hvigor
,
ohpm
,
hdc
, etc.). Verify with
devecocli -V
.
在执行前,将请求区分为两种可能的意图:
  • 脚手架意图: 创建新的 OHOS/HarmonyOS 项目,并指定其应用名称、bundle 名称、项目路径或 API 级别。使用此 skill 处理。
  • 开发意图: 实现待办事项列表、登录界面、数据库、网络、自定义 UI、业务逻辑、测试或任何其他功能。不要使用此 skill 处理。完成脚手架后停止,并询问用户是否希望继续使用
    ohos-app-dev
    ;如果请求的 API 或权限可能需要
    hos_system_app
    、提升的 APL、ACL/provisioning 或 Full SDK 系统 API,则改用
    ohos-system-app-dev
    进行权限预检。
如果请求同时包含这两种意图,仅执行脚手架意图。不要仅仅因为用户以某个功能命名应用,就推断用户允许实现该功能(例如
TodoList
)。
前置条件: 具备 Node.js 和 npm、由 hackathon setup 安装且位于 PATH 中的 DevEco CLI,以及可用的 DevEco Studio 工具链(
hvigor
、
ohpm
、
hdc
等)。使用
devecocli -V
进行验证。

Windows toolchain selection

Windows 工具链选择

Require the caller's
PATH
to contain the preferred DevEco Studio Node directory first, followed by the npm global bin directory and the DevEco toolchain directories. Do not hard-code, probe, or modify installation paths in this skill. Verify the resolved tools:
powershell
Get-Command node, npm, devecocli
node --version; npm --version; devecocli -V
Do not mix executables from different Node installations. If the resolved
node
,
npm
, or
devecocli
is not the intended DevEco environment, stop and report the PATH issue.
要求调用方的 PATH 首先包含首选的 DevEco Studio Node 目录,其次是 npm 全局 bin 目录和 DevEco 工具链目录。在此 skill 中,不要硬编码、探测或修改安装路径。验证解析到的工具:
powershell
Get-Command node, npm, devecocli
node --version; npm --version; devecocli -V
不要混用来自不同 Node 安装的可执行文件。如果解析到的
node
、
npm
或
devecocli
并非预期的 DevEco 环境,则停止执行并报告 PATH 问题。

Scaffold

脚手架

DevEco CLI creates a HarmonyOS application from the Empty Ability template. Provide the project values as explicit options so the command is non-interactive:
devecocli create --project-path <project-dir> --app-name <AppName> --bundle-name <com.example.app> [--api-level <level>]
Options:
  • --project-path <project-dir>
    — project directory; defaults to
    ./<app-name>
    .
  • --app-name <AppName>
    — application name.
  • --bundle-name <com.example.app>
    — bundle name; defaults to
    com.example.<app-name>
    .
  • --api-level <level>
    — optional API level; it is auto-detected from the SDK when omitted, and the minimum supported value is 17.
The project path must be an explicit directory path and must not be
.
. When the current directory is the intended destination, pass its absolute path or its named relative directory path (for example,
./my-app
rather than
.
).
The DevEco CLI interface documents the Empty Ability template only; do not assume a Native C++ template or unsupported
--template
/
--sdk
flags.
DevEco CLI 基于 Empty Ability 模板创建 HarmonyOS 应用。通过显式选项提供项目参数,以确保命令以非交互方式运行:
devecocli create --project-path <project-dir> --app-name <AppName> --bundle-name <com.example.app> [--api-level <level>]
选项:
  • --project-path <project-dir>
    — 项目目录;默认为
    ./<app-name>
    。
  • --app-name <AppName>
    — 应用名称。
  • --bundle-name <com.example.app>
    — bundle 名称;默认为
    com.example.<app-name>
    。
  • --api-level <level>
    — 可选的 API 级别;省略时自动从 SDK 检测,最低支持值为 17。
项目路径必须是显式的目录路径,且不能为
.
。当当前目录就是目标目录时,请传入其绝对路径或具名的相对目录路径(例如使用
./my-app
,而不是
.
)。
DevEco CLI 接口仅记录了 Empty Ability 模板;不要假设存在 Native C++ 模板,也不要使用不受支持的
--template
/
--sdk
标志。

Mandatory stop after scaffolding

脚手架完成后必须停止

After
devecocli create
succeeds:
  1. Report the generated project path, app name, bundle name, and API level.
  2. Confirm that only the CLI-generated scaffold was created.
  3. Stop. Do not open, rewrite, or enhance
    Index.ets
    or any other generated source file.
  4. Do not add feature code, resources, dependencies, tests, documentation, or configuration unrelated to the generated scaffold.
  5. Do not run
    devecocli build
    , lint, run, install, or UI validation as part of this skill.
If the user also requested feature implementation, explicitly state that scaffolding is complete and ask to continue with
ohos-app-dev
; do not silently continue in the same step. For a standalone app whose APIs or permissions may require privileged identity, ask to continue with
ohos-system-app-dev
for privilege preflight instead.
For a separately requested development step, use
ohos-app-dev
for the inner loop (lint → build → run → logs → UI). Use
conductor-dev
only when the user requests Conductor-based orchestration. ArkTS strict-mode rules and app architecture guidance live in
ohos-app-dev
(
references/arkts-strict.md
,
references/architecture.md
).
执行
devecocli create
成功后:
  1. 报告生成的项目路径、应用名称、bundle 名称和 API 级别。
  2. 确认仅创建了 CLI 生成的脚手架。
  3. 停止。不要打开、重写或增强
    Index.ets
    或任何其他生成的源文件。
  4. 不要添加功能代码、资源、依赖项、测试、文档或与生成的脚手架无关的配置。
  5. 在此 skill 的执行范围内,不要运行
    devecocli build
    、lint、run、install 或 UI 验证。
如果用户还要求实现功能,请明确说明脚手架已完成,并询问是否继续使用
ohos-app-dev
;不要在同一步中擅自继续。对于 API 或权限可能需要特权身份的应用,请改为询问是否继续使用
ohos-system-app-dev
进行权限预检。
如果用户单独请求开发步骤,请使用
ohos-app-dev
执行内部开发流程(lint → build → run → logs → UI)。仅当用户请求基于 Conductor 的编排时,才使用
conductor-dev
。ArkTS 严格模式规则和应用架构指导位于
ohos-app-dev
(
references/arkts-strict.md
、
references/architecture.md
)。

Out of scope

不在范围内

  • Ordinary inner-loop work on an existing project →
    ohos-app-dev
    .
  • Standalone apps that may require
    hos_system_app
    , elevated APL, ACL/provisioning, or a Full SDK system API →
    ohos-system-app-dev
    .
  • System / persistent bundles (systemui, launcher, OHOS source-tree builds) →
    ohos-system-dev
    .
  • 对现有项目执行常规内部开发流程 →
    ohos-app-dev
    。
  • 可能需要
    hos_system_app
    、提升的 APL、ACL/provisioning 或 Full SDK 系统 API 的独立应用 →
    ohos-system-app-dev
    。
  • 系统/持久化 bundle(systemui、launcher、OHOS 源码树构建)→
    ohos-system-dev
    。