Agent Skills › home-assistant/core › ha-deprecation-cleanup

ha-deprecation-cleanup

GitHub

扫描 Home Assistant 已过期弃用项,自动创建清理分支移除废弃代码,确保测试通过并生成 PR 描述。

.claude/skills/ha-deprecation-cleanup/SKILL.md home-assistant/core

触发场景

扫描已过期的弃用项 查找需清理的 breaks_in_ha_version 创建弃用清理分支

安装

npx skills add home-assistant/core --skill ha-deprecation-cleanup -g -y
更多选项

非标准路径

npx skills add https://github.com/home-assistant/core/tree/dev/.claude/skills/ha-deprecation-cleanup -g -y

不安装直接使用

npx skills use home-assistant/core@ha-deprecation-cleanup

指定 Agent (Claude Code)

npx skills add home-assistant/core --skill ha-deprecation-cleanup -a claude-code -g -y

安装 repo 全部 skill

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

预览 repo 内 skill

npx skills add home-assistant/core --list

SKILL.md

Frontmatter
{
    "name": "ha-deprecation-cleanup",
    "description": "Finds Home Assistant deprecations whose breaks_in_ha_version has been reached on dev and prepares one cleanup branch per deprecation, with the deprecated code removed, tests passing and a ready-to-paste PR description. Use when asked to scan for due or overdue deprecations, find breaks_in_ha_version cleanups, or create deprecation cleanup branches."
}

Clean Up Due Deprecations

Each deprecation is marked with its own breaks_in_ha_version. It is due when that X.Y is at or below the X.Y of the current version on dev (MAJOR_VERSION/MINOR_VERSION in homeassistant/const.py).

Decide on each deprecation separately, and clean up each one in its own branch. Unless the user narrows it down, scan everything, then prepare branches for the deprecations the user picks. When running unattended (for example in a routine), prepare a branch for every deprecation that qualifies.

1. Scan

Fetch the latest dev of home-assistant/core (for example upstream/dev when origin is your fork) and create a detached worktree of it, so the current working tree is left alone. Use that same ref for every branch. Then run from the root of that worktree:

uv run --no-sync python3 ./.claude/skills/ha-deprecation-cleanup/scripts/find_due_deprecations.py [--version X.Y]

The script's output needs a few notes:

  • Each entry in deprecations is one deprecation to check, with the name of the branch to create for it in branch.
  • unresolved lists constants the script could not resolve. Check them by hand and add any that are due.
  • passthrough lists values the script could not follow. Most just forward a caller's argument, like helpers/issue_registry.py and helpers/frame.py, and need nothing. Others hold fixed versions the script can't read, like the tuples in smartthings entity descriptions or _DEPRECATED_DEVICE_INFO_PARAMETERS in helpers/device_registry.py. Add those that are due.

2. Check each deprecation

Read the code and work out what is deprecated and what removing it means. The script's split is a starting point:

  • Items without an issue id (a logged warning, a constant) can belong to a deprecation that also has a repair issue. Clean them up together.
  • Two issue ids can be one deprecation, for example the success and failure issues of one YAML import. Clean them up together on the branch of the first one the script lists.

Then pick one outcome per deprecation:

  • Skip, with a short reason, if: it is the kitchen_sink demo (its repair issues exist to show the deprecation UI); or an open PR in home-assistant/core already removes it.
  • Needs decision, with a one-line reason, when the removal is not mechanical: there is no clear replacement; the issue is a permanent warning that only reuses the field; it would need a config entry migration that can't be defined safely; or it is a core API that custom integrations still use widely (the custom-integration-sources skill can measure that). Don't create a branch.
  • Branch exists: if a branch for this deprecation already exists on the push remote or locally, don't touch it. Branches made for the same deprecation can have another suffix, so look for every branch that starts with the script's branch name up to and including the version, and check its diff. Report whether a PR is open from it, whether it is only local, and whether its base is more than one release behind dev.
  • Prepare a branch otherwise.

For every deprecation, look for an open task issue in home-assistant/core that covers the removal. Report it if exactly one clearly matches, and list the candidates if several might. Searching is read-only: never comment on or edit an issue.

3. Prepare a branch

For each deprecation to clean up, create the branch from the script's output in its own new worktree, so one deprecation's changes never end up on another's branch.

  1. Remove the deprecated code path completely. Leave other deprecations in the same integration alone. Follow the ha-integration-knowledge skill.
  2. Run the tests for the integration or core module and the linters on the changed files. If they still fail after a reasonable attempt, don't commit or push. Report the deprecation as needs decision, with what failed and the worktree path, and leave the worktree for a human to look at, or remove it and its branch in an unattended run.
  3. Commit as "Remove deprecated from ". In the body, name the breaks_in_ha_version and the PR that added the deprecation. Keep the PR template out of the commit message.
  4. Write a ready-to-paste PR description following .github/PULL_REQUEST_TEMPLATE.md, leaving unchecked boxes in place and putting the task issue (if one was found) on the "fixes #" line. When users have to change something, check "Breaking change" and fill in the breaking change section: what breaks, how to fix it and why. Removing a YAML import whose deprecation period has ended is not a breaking change, because the deprecation already announced it: check "Code quality improvements" and remove the breaking change section, as the template allows. Don't commit the description. It goes in the report.
  5. Push only if the user (or the routine prompt) asked for it, to the remote they named, for example the user's fork, or origin for maintainers who keep branches upstream. Use a plain git push <remote> <branch>, and give the compare link to dev of home-assistant/core in the report.
  6. Remove the worktree. The branch stays.

4. Stale branches

List the deprecation-cleanup/* branches on the push remote. A branch is stale when no PR is open from it and either its deprecation is gone from dev or its PR was closed. Report them for a human to delete.

Report

Start with the version used and counts per outcome. Then, per deprecation: name, kind, version, repair issue id if any, what is deprecated, outcome with its reason, branch and compare link if any, task issue if any, and the PR description for each branch prepared in this run. Finish with unresolved items and stale branches.

IMPORTANT

  • Never open pull requests, comment, review, or edit issues. Per AI_POLICY.md, a human reviews each branch and opens the PR.
  • Only create new deprecation-cleanup/ branches. Never force-push, never push to a branch that already exists on the remote, and never push to dev, rc, master or anything outside deprecation-cleanup/. Never delete a remote branch, or a local branch that this run didn't create.
  • If a push is rejected (for example by a branch ruleset), stop pushing for the rest of the run and report why.

版本历史

  • 779c7a7 当前 2026-11-03 04:20

同 Skill 集合

.claude/skills/bump-dependency/SKILL.md
.claude/skills/custom-integration-sources/SKILL.md
.claude/skills/ha-integration-knowledge/SKILL.md
.claude/skills/ha-merge-queue/SKILL.md
.claude/skills/ha-pr-comment-audit/SKILL.md
.claude/skills/ha-pr-reviewer/SKILL.md
.claude/skills/ha-quality-scale-verify/SKILL.md
.claude/skills/ha-review/SKILL.md

元信息

文件数
0
版本
779c7a7
Hash
59b78b1b
收录时间
2026-11-03 04:20

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-06 00:31
浙ICP备14020137号-1