Vela Dev
Use this skill when working on Xiaomi Vela JS wearable quick apps.
What this skill is for
- - Create a new Vela quick app from scratch
- Edit existing
.ux pages - Fix build errors from INLINECODE1
- Adapt UI for Xiaomi Band / Watch screens
- Package an
.rpk for delivery
Workflow
- 1. Identify whether the user wants a new app or edits to an existing Vela project.
- If new, scaffold the minimum required files:
-
src/manifest.json
-
src/app.ux
-
src/config-watch.json
- at least one page like
src/pages/<name>/index.ux
- 3. Prefer a single-page app with internal state switching unless the app clearly benefits from router-based multi-page navigation.
- Build with:
-
cd <project> && npx aiot build
- 5. If build fails, inspect the exact error and patch surgically.
- Only send/package the
.rpk after a successful build.
Xiaomi Band / Vela constraints
Read references/vela-notes.md when you need practical constraints and common fixes.
Important defaults:
- - Xiaomi Band 10 uses a 212x520 跑道屏 style layout.
- Frontend apps should feel foreground-first: quick open, quick action, quick exit.
- Avoid overstuffed home screens. Prefer vertical lists/cards.
- Symbol glyph buttons like
↺ ⏸ ▶ ⏭ may not render reliably on device; prefer plain Chinese text. - When in doubt, choose larger touch targets and fewer simultaneous actions.
Build/debug loop
After each meaningful edit:
- - Run INLINECODE14
- If needed, filter logs with grep for INLINECODE15
- Fix the reported file/line first before changing anything else
Common failure classes are documented in references/vela-notes.md.
Event/style rules
Read references/ux-gotchas.md when build errors point to template/event/CSS issues.
Key reminders:
- - Vela event handlers are strict; avoid unsupported template expression forms in INLINECODE18
- Broken CSS blocks can produce
UxLoader / INLINECODE20 - Prefer simple, explicit structure over clever templating
Project template
If the user asks for a fresh app, copy or adapt files from assets/template/.
Deliverables
Typical successful output includes:
- - working project folder
- successful INLINECODE22
- generated
.rpk path from INLINECODE24
When to read extra files
- - For practical Vela constraints and prior lessons: read INLINECODE25
- For template/event/style pitfalls: read INLINECODE26
- For official documentation entry points and what to consult: read INLINECODE27
- For a reusable end-to-end implementation/debug loop: read INLINECODE28
- For fresh project scaffolding: inspect INLINECODE29
Documentation-backed behavior
When you need authoritative confirmation:
- 1. Start with INLINECODE30
- Open the matching official doc page
- Apply the smallest viable change
- Rebuild immediately
Prefer official docs for:
- - component capability questions
- feature API availability
- project structure uncertainty
- framework/lifecycle questions
Prefer local reference notes for:
- - previously observed build pitfalls
- Band 10-specific practical constraints
- project patterns that already worked here
Vela Dev
在小米Vela JS手表快应用开发中使用此技能。
该技能的用途
- - 从零创建新的Vela快应用
- 编辑现有的.ux页面
- 修复npx aiot build的构建错误
- 适配小米手环/手表屏幕的UI
- 打包.rpk文件用于交付
工作流程
- 1. 判断用户需要新建应用还是编辑现有Vela项目。
- 如果是新建项目,搭建最少必需文件:
- src/manifest.json
- src/app.ux
- src/config-watch.json
- 至少一个页面,如src/pages/<名称>/index.ux
- 3. 优先采用带内部状态切换的单页应用,除非应用明显适合基于路由的多页面导航。
- 构建命令:
- cd <项目> && npx aiot build
- 5. 如果构建失败,检查具体错误并进行精准修复。
- 仅在构建成功后发送/打包.rpk文件。
小米手环/Vela约束
当需要实际约束和常见修复时,请阅读references/vela-notes.md。
重要默认项:
- - 小米手环10采用212x520跑道屏风格布局。
- 前端应用应体现前台优先:快速打开、快速操作、快速退出。
- 避免主屏幕内容过满。优先使用垂直列表/卡片。
- ↺ ⏸ ▶ ⏭ 等符号按钮在设备上可能无法可靠渲染;优先使用纯中文文本。
- 不确定时,选择更大的触摸目标和更少的并发操作。
构建/调试循环
每次有意义的编辑后:
- - 运行npx aiot build
- 如有需要,使用grep过滤日志中的success|error|Error
- 先修复报告的文件/行,再修改其他内容
常见失败类型记录在references/vela-notes.md中。
事件/样式规则
当构建错误指向模板/事件/CSS问题时,请阅读references/ux-gotchas.md。
关键提醒:
- - Vela事件处理程序要求严格;避免在onclick中使用不支持的模板表达式形式
- 损坏的CSS块可能导致UxLoader / Unexpected }错误
- 优先使用简单、明确的结构,而非复杂的模板技巧
项目模板
如果用户要求新建应用,从assets/template/复制或适配文件。
交付物
典型的成功输出包括:
- - 可用的项目文件夹
- 成功的npx aiot build
- 从dist/生成的.rpk路径
何时阅读额外文件
- - 实际Vela约束和先前经验:阅读references/vela-notes.md
- 模板/事件/样式陷阱:阅读references/ux-gotchas.md
- 官方文档入口和参考内容:阅读references/docs-map.md
- 可复用的端到端实现/调试循环:阅读references/dev-workflow.md
- 新项目脚手架:查看assets/template/
文档驱动的行为
当需要权威确认时:
- 1. 从references/docs-map.md开始
- 打开对应的官方文档页面
- 应用最小可行变更
- 立即重新构建
优先参考官方文档:
- - 组件能力相关问题
- 功能API可用性
- 项目结构不确定性
- 框架/生命周期问题
优先参考本地笔记:
- - 之前观察到的构建陷阱
- 手环10特定的实际约束
- 已验证有效的项目模式