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

ha-frontend-types

GitHub

规范 Home Assistant 前端 TypeScript 类型定义、数据契约复用、断言及 Lit 生命周期类型使用,确保类型与后端一致并符合 ESLint 约束。

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

Trigger Scenarios

定义或审查 TypeScript 类型契约 复用 Home Assistant 共享类型 配置 Lit 组件生命周期类型

Install

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

Non-standard path

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

Use without installing

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

指定 Agent (Claude Code)

npx skills add home-assistant/frontend --skill ha-frontend-types -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-types",
    "description": "Home Assistant frontend TypeScript conventions. Use when defining or reviewing backend data contracts, optional schemas, shared types, assertions, or Lit lifecycle types."
}

HA Frontend Types

Use this skill for Home Assistant-specific TypeScript contracts and type choices.

Home Assistant Data Contracts

Verify data contracts against the source that owns them, such as Home Assistant Core, Supervisor, a WebSocket handler, or an exported component type. Do not shape a type around assumptions made by its current frontend consumers.

  • Match required, optional, nullable, and defaulted fields to the producer and runtime contract. Preserve optional configuration fields when omission is supported and has defined behavior.
  • Use distinct request and response types when their wire shapes differ.
  • When changing a shared contract, check affected consumers, tests, fixtures, and mocks.

Reuse Home Assistant Contracts

  • Reuse the canonical Home Assistant type when one exists. Define shared contract types in the data or API module that owns them.
  • Reuse types exported by components and helpers rather than reconstructing their payloads. For event types, follow ha-frontend-events.
  • When one domain contract is used across modules, define and export it from the module that owns that contract.

Prefer an existing owning contract. Introduce a frontend-specific type when the frontend shape or boundary genuinely differs.

Assertions

Prefer accurate types and runtime narrowing. Use assertions or TypeScript suppressions at boundaries where the runtime invariant is understood but cannot be expressed cleanly; keep them narrow and explain non-obvious invariants.

Lit Lifecycle Types

For Lit lifecycle methods that receive changed properties, use PropertyValues<this> when the method only needs public reactive properties:

protected willUpdate(changedProperties: PropertyValues<this>) {
  // ...
}

Use unparameterized PropertyValues when the method inspects private or protected reactive properties, which are not keys of this. Do not add assertions solely to retain PropertyValues<this>.

Enforced Baseline

Use import type for type-only imports. This is enforced by the repository ESLint configuration.

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-demo/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-user-facing-text/SKILL.md

Metadata

Files
0
Version
3c7560a
Hash
7723ad49
Indexed
2026-08-20 08:57

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