Agent Skillshome-assistant/frontend › ha-frontend-demo

ha-frontend-demo

GitHub

用于 Home Assistant 前端独立演示环境的运行、验证及共享 Mock 桩代码的管理。支持本地启动演示服务、URL 路由导航及配置切换,适用于修改 demo/ 目录或 gallery 引用的 stubs 场景。

.agents/skills/ha-frontend-demo/SKILL.md home-assistant/frontend

Trigger Scenarios

需要运行或验证 Home Assistant 前端演示环境 修改 demo/ 目录下的文件或共享 mock 桩代码

Install

npx skills add home-assistant/frontend --skill ha-frontend-demo -g -y
More Options

Non-standard path

npx skills add https://github.com/home-assistant/frontend/tree/dev/.agents/skills/ha-frontend-demo -g -y

Use without installing

npx skills use home-assistant/frontend@ha-frontend-demo

指定 Agent (Claude Code)

npx skills add home-assistant/frontend --skill ha-frontend-demo -a claude-code -g -y

安装 repo 全部 skill

npx skills add home-assistant/frontend --all -g -y

预览 repo 内 skill

npx skills add home-assistant/frontend --list

SKILL.md

Frontmatter
{
    "name": "ha-frontend-demo",
    "description": "Home Assistant standalone demo structure, configurations, URL navigation, mocked APIs, shared demo stubs used by gallery, and verification. Use when changing files under demo\/, changing gallery consumers of demo\/src\/stubs\/, or running and validating the demo."
}

HA Frontend Demo

Use this skill for standalone demo work and changes to shared demo stubs consumed by the gallery. Follow the persistent repository guidance in AGENTS.md and load matching specialist skills alongside this skill, especially ha-frontend-testing when running or validating the demo.

Purpose

The demo is the full Home Assistant frontend running against a mocked backend and is published at https://demo.home-assistant.io. It needs no Home Assistant server, which makes it the easiest way to load the real UI in a browser, for example to take screenshots.

Running The Demo

Run commands from the repository root:

yarn dev:demo               # Development server on http://localhost:8090
yarn dev:demo --background  # Detached; also supports --status/--stop/--logs

Use the E2E workflows documented in ha-frontend-testing when validating the demo.

Opening A Specific Demo

The demo contains multiple demo configurations. Select one directly with the demo query parameter, for example http://localhost:8090/?demo=<slug>. The valid slugs are defined in demoConfigs in demo/src/configs/demo-configs.ts, so "the second demo" means the slug of the second entry in that list. An unknown slug falls back to the default, which is the first entry.

Opening A Specific Page

The demo build uses hash-based routing: the frontend path goes in the URL hash, and the demo query parameter goes before the #. The URL format is:

http://localhost:8090/?demo=<slug>#/<path>

Useful paths:

  • /lovelace/0: The selected demo's dashboard, also the default when no hash is given.
  • /energy: The energy dashboard. Its tabs are views: /energy/overview (Summary), /energy/electricity, /energy/gas, /energy/water, and /energy/now.
  • /map, /history, /todo, /config: Other sidebar panels.

For example, the water tab of the energy dashboard of the second demo is:

http://localhost:8090/?demo=<second slug>#/energy/water

Structure

  • demo/src/ha-demo.ts: Root element that sets up all backend mocks.
  • demo/src/configs/<slug>/: One directory per demo configuration, containing entities, dashboard, and theme data.
  • demo/src/configs/demo-configs.ts: Registry of demo configurations and URL slug handling.
  • demo/src/stubs/: Mocked WebSocket and REST APIs.
  • demo/script/develop_demo, demo/script/build_demo: Development server and static build wrappers.

Shared Gallery Stubs

demo/src/stubs/ is shared, not demo-private: gallery pages import from it directly. Before changing or removing anything a stub does, search for its callers across demo/src/ and gallery/src/, then check the affected gallery pages as well as the demo.

The two consumers use a stub differently, so demo behavior does not predict gallery behavior. A gallery page calls stubs against the hass from provideHass, where hass.config is the shared demoConfig object. A stub that mutates hass.config in place is therefore visible to the page. demo/src/ha-demo.ts copies components into a new array before the stubs run, so the same mutation never reaches the demo. A change can look correct in the demo while quietly breaking a gallery page.

Verification

Load ha-frontend-testing and use its demo and gallery workflows. Validate both consumers when changing shared stubs. Documentation-only changes do not require code tests unless examples or commands change.

Version History

  • 3c7560a Current 2026-08-20 08:57

Same Skill Collection

.agents/skills/ha-frontend-components/SKILL.md
.agents/skills/ha-frontend-contexts/SKILL.md
.agents/skills/ha-frontend-events/SKILL.md
.agents/skills/ha-frontend-gallery/SKILL.md
.agents/skills/ha-frontend-lit/SKILL.md
.agents/skills/ha-frontend-review/SKILL.md
.agents/skills/ha-frontend-styling/SKILL.md
.agents/skills/ha-frontend-testing/SKILL.md
.agents/skills/ha-frontend-types/SKILL.md
.agents/skills/ha-frontend-user-facing-text/SKILL.md

Metadata

Files
0
Version
3c7560a
Hash
83373c09
Indexed
2026-08-20 08:57

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 07:38
浙ICP备14020137号-1 $방문자$