Token导航 LogoToken导航TokenDH.com
开发规范external-servicegithub未标认证来源可访问许可证需确认审计提醒

home-assistant-best-practices家庭助理最佳实践

Agent Skill

home-assistant-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

61,152

周安装

2,564

GitHub Stars

342

下载量

21,424
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:home-assistant-best-practices(家庭助理最佳实践)
来源仓库:https://github.com/homeassistant-ai/skills
仓库路径:skills/home-assistant-best-practices
安装命令:
npx skills add https://github.com/homeassistant-ai/skills --skill home-assistant-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/homeassistant-ai/skills --skill home-assistant-best-practices

简介

Native Home Assistant 构建了自动化、助手、脚本和 Lovelace 仪表板。

  • 优先考虑内置条件、触发器和帮助程序而不是 Jinja2 模板;包括用于在本机状态条件、数字状态、时间触发器和模板助手之间进行选择的决策工作流程
  • 涵盖自动化模式(单一、重新启动、排队、并行)以及场景、entity_id 与 device_id 使用情况以及 ZHA 和 Zigbee2MQTT 的 Zigbee 按钮/远程模式
  • 为实体重命名、帮助器替换和触发器重组提供安全的重构工作流程,以防止仪表板和脚本之间的无提示破坏
  • 记录反模式(模板条件、wait_template 轮询、device_id 脆弱性)以及本机替代方案和推理

SKILL.md

Home Assistant Best Practices

Core principle: Use native Home Assistant constructs wherever possible. Templates bypass validation, fail silently at runtime, and make debugging opaque.

Decision Workflow

Follow this sequence when creating any automation:

0. Gate: modifying existing config?

If your change affects entity IDs or cross-component references — renaming entities, replacing template sensors with helpers, converting device triggers, or restructuring automations — read references/safe-refactoring.md first. That reference covers impact analysis, device-sibling discovery, and post-change verification. Complete its workflow before proceeding.

Steps 1-5 below apply to new config or pattern evaluation.

1. Check for native condition/trigger

Before writing any template, check references/automation-patterns.md for native alternatives.

Common substitutions:

  • {{states('x') | float > 25}}numeric_state condition with above: 25
  • {{is_state('x', 'on') and is_state('y', 'on')}}condition: and with state conditions
  • {{now().hour >= 9}}condition: time with after: "09:00:00"
  • wait_template: "{{is_state(...)}}"wait_for_trigger with state trigger (caveat: different behavior when state is already true — see references/safe-refactoring.md#trigger-restructuring)

2. Check for built-in helper or Template Helper

Before creating a template sensor, check references/helper-selection.md.

Common substitutions:

  • Sum/average multiple sensors → min_max integration
  • Binary any-on/all-on logic → group helper
  • Rate of change → derivative integration
  • Cross threshold detection → threshold integration
  • Consumption tracking → utility_meter helper

If no built-in helper fits, use a Template Helper — not YAML. Create it via the HA config flow (MCP tool or API) or via the UI: Settings → Devices & Services → Helpers → Create Helper → Template. Only write template: YAML if explicitly requested or if neither path is available.

3. Select correct automation mode

Default single mode is often wrong. See references/automation-patterns.md#automation-modes.

ScenarioMode
Motion light with timeoutrestart
Sequential processing (door locks)queued
Independent per-entity actionsparallel
One-shot notificationssingle

4. Use entity_id over device_id

device_id breaks when devices are re-added. See references/device-control.md.

Exception: Zigbee2MQTT autodiscovered device triggers are acceptable.

5. For Zigbee buttons/remotes

  • ZHA: Use event trigger with device_ieee (persistent)
  • Z2M: Use device trigger (autodiscovered) or mqtt trigger

See references/device-control.md#zigbee-buttonremote-patterns.


Critical Anti-Patterns

Anti-patternUse insteadWhyReference
condition: template with float > 25condition: numeric_stateValidated at load, not runtimereferences/automation-patterns.md#native-conditions
wait_template: "{{is_state(...)}}"wait_for_trigger with state triggerEvent-driven, not polling; waits for *change* (see references/safe-refactoring.md#trigger-restructuring for semantic differences)references/automation-patterns.md#wait-actions
device_id in triggersentity_id (or device_ieee for ZHA)device_id breaks on re-addreferences/device-control.md#entity-id-vs-device-id
mode: single for motion lightsmode: restartRe-triggers must reset the timerreferences/automation-patterns.md#automation-modes
enabled: false as a top-level key in automations.yamlautomation.turn_off (temporary) or entity registry disable (permanent)Not a valid top-level key — rejected during schema validation; automation loads as unavailablereferences/automation-patterns.md#disabling-automations
Template sensor for sum/meanmin_max helperDeclarative, handles unavailable statesreferences/helper-selection.md#numeric-aggregation
Template binary sensor with thresholdthreshold helperBuilt-in hysteresis supportreferences/helper-selection.md#threshold
Renaming entity IDs without impact analysisFollow references/safe-refactoring.md workflowRenames break dashboards, scripts, scenes, Config-Entry data, and storage dashboards silentlyreferences/safe-refactoring.md#entity-renames
Renaming members of Config-Entry-based groups (UI groups) without updating membershipUpdate group membership via Options Flow after the registry renameThe entity registry rename does not update options.entities in the Config Entry — group silently breaksreferences/safe-refactoring.md#config-entry-groups
Renaming entities used by Config-Entry integrations (Better/Generic Thermostat, Min/Max, Threshold) without patching Config-Entry dataScan and patch core.config_entries data+options fieldsThese integrations store entity_ids in Config Entry — not updated by entity registry renamesreferences/safe-refactoring.md#config-entry-data--blind-spots-for-entity-registry-renames
template: sensor/binary sensor in YAMLTemplate Helper (UI or config flow API)Requires file edit and config reload; harder to managereferences/template-guidelines.md
Editing .storage/ files or other HA internal state directlyUse the HA REST/WebSocket API to manage state and config entries.storage/ files are HA's internal state database; direct edits bypass validation, risk corruption, and can be silently overwritten by HA
Writing raw YAML to configuration.yaml by hand for YAML-only integrationsUse managed YAML config editing with backup and validationUnmanaged writes risk syntax errors, have no backup, and skip check_config — managed editing provides all threereferences/yaml-only-integrations.md
Generating YAML snippets for automations/scripts/scenesUse the HA config API to create automations/scripts programmaticallyAPI calls validate config, avoid syntax errors, and don't require manual file edits or restartsreferences/automation-patterns.md, references/examples.yaml
Telling user to edit configuration.yaml for integrationsDirect user to Settings > Devices & Services in the HA UIMost integrations are UI-configured; YAML integration config is rare and integration-specific
Referring to HA "add-ons"Use the term "Apps"HA renamed add-ons to Apps in 2026.2 — "Apps are standalone applications that run alongside Home Assistant"
vacuum.send_command with vendor room IDsvacuum.clean_area with HA area_id (if segments are mapped)Uses native HA areas, works across integrations — but requires segment-to-area mapping in entity settings firstreferences/device-control.md#vacuum-control
Using color_temp (mireds) in light service callsUse color_temp_kelvinThe color_temp parameter was removed in 2026.3; only Kelvin is supportedreferences/device-control.md#lights

Reference Files

Read these when you need detailed information:

FileWhen to readKey sections
references/safe-refactoring.mdRenaming entities, replacing helpers, restructuring automations, or any modification to existing config#universal-workflow, #entity-renames, #helper-replacements, #trigger-restructuring, #config-entry-data--blind-spots-for-entity-registry-renames, #storage-mode-dashboards-storagelovelace
references/automation-patterns.mdWriting triggers, conditions, waits, or choosing automation modes; disabling automations#native-conditions, #trigger-types, #wait-actions, #automation-modes, #continue-on-error, #repeat-actions, #ifthen-vs-choose, #trigger-ids, #disabling-automations
references/helper-selection.mdDeciding whether to use a built-in helper vs template sensor#numeric-aggregation, #rate-and-change, #time-based-tracking, #counting-and-timing, #scheduling, #entity-grouping, #decision-matrix
references/template-guidelines.mdConfirming templates ARE appropriate for a use case#when-templates-are-appropriate, #when-to-avoid-templates, #template-sensor-best-practices, #common-patterns, #error-handling
references/yaml-only-integrations.mdCreating or editing YAML-only integrations that have no config flow (e.g. command_line, platform-based mqtt, rest)#yaml-only-integration-types, #post-edit-actions
references/device-control.mdWriting service calls, Zigbee button automations, or using target:#entity-id-vs-device-id, #service-calls-best-practices, #zigbee-buttonremote-patterns, #domain-specific-patterns
references/dashboard-guide.mdDesigning or modifying Lovelace dashboards — layout, view types, sections, custom cards, CSS styling, HACS#dashboard-structure, #view-types, #built-in-cards, #features, #custom-cards, #css-styling, #common-pitfalls
references/dashboard-cards.mdLooking up available card types or fetching card-specific documentation
references/domain-docs.mdLooking up integration or domain documentation for service calls, entity attributes, or configuration
references/examples.yamlNeed compound examples combining multiple best practices

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.55%
按下载量换算7,830

Claude

30.79%
按下载量换算6,596

Cursor

21.42%
按下载量换算4,589

Gemini CLI

9.12%
按下载量换算1,954

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills