Agent Skills › home-assistant/frontend › ha-frontend-types

ha-frontend-types

GitHub

提供Home Assistant前端TypeScript类型定义规范,涵盖数据契约验证、类型复用策略、断言使用及Lit生命周期类型处理。

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

Trigger Scenarios

定义或审查后端数据契约 创建共享类型或可选模式 检查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
.agents/skills/ha-frontend-ux-readiness/SKILL.md

Metadata

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

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-30 20:40
浙ICP备14020137号-1