一键导入
homeassistant-testing-playbook
Practical test/CI playbook for Home Assistant custom components (config flow, coordinator, entities, diagnostics)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Practical test/CI playbook for Home Assistant custom components (config flow, coordinator, entities, diagnostics)
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
How to create, update, and manage Changesets for release preparation in this repository
Guidance for using correct energy and power metrics in Home Assistant energy features
High-level Home Assistant integration best practices, quality scale cues, and testing/CI expectations for custom components
Patterns for Home Assistant config flows, discovery handlers, options flows, and reauth for custom components
Project-specific patterns for the Marstek integration (config flow, coordinator, scanner, entities, translations)
Repo-specific guidance for maintaining the Marstek integration (UDP Open API, polling, discovery/scanner) in a Home Assistant-friendly way
| name | homeassistant-testing-playbook |
| description | Practical test/CI playbook for Home Assistant custom components (config flow, coordinator, entities, diagnostics) |
Use this skill to design and implement tests/CI for a custom integration targeting Bronze/Silver quality scale.
tests/ structure, fixtures, snapshots)tests/
conftest.py: enable custom integrations; shared fixtures (MockConfigEntry, mock UDP/HTTP, snapshot extension)test_config_flow.py: user/discovery/reauth/options flowstest_init.py: setup/unload/reload lifecycletest_sensor.py) per platformfixtures/: sanitized API/device payloads for mocks/snapshotspytest-homeassistant-custom-component: hass fixture, MockConfigEntry, aiohttp client mock (if HTTP), time helpers.syrupy + HomeAssistantSnapshotExtension for diagnostics/device registry/entity attributes; redact secrets before snapshotting.freezer + async_fire_time_changed to advance coordinator timers.pytest --cov=custom_components.marstek --cov-report=xml --cov-fail-under=95.tests/ and requirements_test.txt for pinned deps and starter tests.cannot_connect, invalid_auth, invalid_discovery_info, already_configured aborts.UpdateFailed → entities become unavailable; last_update_success false.async_request_refresh calls coalesce to one fetch (spy call count).ruff and mypy --strict (required, not optional).requirements_test.txt to avoid drift.After every code modification, you MUST run verification:
# 1. Type checking (strict mode enforced)
python3 -m mypy --strict custom_components/<domain>/
# 2. Run all tests
pytest tests/ -q
Do not consider work complete until both pass. This catches:
Fix failures immediately before moving on.