実際の製品を操作して、利用者が確認できる動作証拠を集め、検証計画に沿った受け入れレポートとして公開するスキルです。
- 変更後の製品動作を実地で検証したいとき
- 画面キャプチャなどの証拠を集めたいとき
- 検証計画とレポートを作成したいとき
Git worktreeを監査し、マージ済み・古いブランチや保護対象を分類して、安全に整理するための候補と確認点を示します。
Use for stale-worktree, Git registration and branch audits. Managed removal uses the repo lifecycle.
実行スコア 未検証
インストール方法を見るGit worktreeとローカルブランチを監査し、状態に応じて削除候補、手動確認が必要な項目、保護対象に分類します。マージ済み、PRの状態、更新からの日数、未 push のコミット、作業ツリーの変更などを確認し、削除できる理由も示します。候補を確認してから、対象を指定したクリーンアップを実行し、もう一度監査して削除結果や残した作業を報告する流れを案内します。
長く使っていないworktreeを整理したいときや、PRをマージした後にローカルブランチを片付けたいときに役立ちます。変更中のファイルや未 push のコミットを誤って失わないよう、残す対象と削除候補を分けて確認できます。サービスなどをworktreeと一緒に管理するリポジトリでは、専用のライフサイクル手順を使う必要があることも把握できます。
監査には付属の scripts/cleanup.sh を使います。PR状態の照会には認証済みの gh CLIを利用できます。削除は破壊的な操作として扱い、対象が明示されていない場合は候補を提示して承認を得てから進めます。登録済みworktreeに再帰削除を使わず、壊れた登録の残存ディレクトリを削除する場合は、パスを指定したうえで確認が必要です。
この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。
SKILL.md の記述から、注意が要る操作と導入の前提を AI が確認しました。点数は実際に動かした結果(実行検証)だけで付けています。
点数には入れていません。 2026年10月26日 時点で AI(OpenAI Codex)が判定しました。目安なので、入れる前に原文も確認してください。
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Use the bundled script to make classification deterministic. Treat cleanup as a destructive action: audit first, show the exact candidates grouped by why they are deletable, and obtain one explicit approval before applying deletion unless the user's current request already names the exact targets. Aim for a single approval round-trip, not a per-item Q&A.
Run the audit from any worktree in the repository:
bash .agents/skills/cleanup-git-worktrees/scripts/cleanup.sh audit --fetch --gh --stale-days 15 --base origin/canary
--fetch: prune the remote first. Omit only when offline and say so.--gh: look up each branch's PR (number, state, head SHA) with the gh CLI. This is what turns [gone] into a verified merge; use it whenever gh is authenticated. It costs roughly one second per branch, so run it in the background on large repos.--stale-days N: mark clean branches idle longer than N days with nothing unpushed as candidate-stale. The repository default the user has approved is 15 days.--noise REGEX: untracked paths that never count as dirt (default node_modules|\.goal-tracing/).Interpret classifications:
| Classification | Meaning | Action |
|---|---|---|
protected-branch | main, canary, or the base ref | never |
protect-current | the worktree running the command | never |
protect-dirty | tracked modifications, or untracked files outside the noise regex | keep; list the files |
candidate-merged | tip is an ancestor of the base | delete |
candidate-pr-merged | PR state MERGED and local tip == PR head SHA | delete |
candidate-pr-closed | PR CLOSED and tip == PR head or nothing unpushed | delete |
candidate-gone | upstream pruned and nothing unpushed | delete after confirming PR state |
candidate-stale | older than --stale-days, clean, nothing unpushed | delete |
review-pr-merged-ahead | PR merged but local tip has extra commits | check the extra commits by subject (below) |
review-gone-unpushed | upstream pruned but local-only commits exist | keep; deleting loses work |
review-no-upstream | no upstream, not merged | keep unless the user names it |
review-detached | detached HEAD worktree | keep; show its dirty files |
broken-registration(...) | registration whose gitdir is gone | see below |
active | everything else | keep |
Columns worth reading: dirty (real dirt), noise (ignorable untracked), age_days, unpushed (commits no remote ref reaches), pr / pr_state / tip_eq_pr.
Present one compact table split into three groups: deletable now (all candidate-*), needs a manual check (review-*), and protected. Keep candidate-merged separate from candidate-gone, and never describe [gone] alone as proof of merge.
After approval, use the repository's worktree lifecycle workflow when it manages services or other resources alongside a checkout; the Git-only script does not tear those down. For plain Git worktrees, pass exact branch names and the same classification flags used for the audit:
bash .agents/skills/cleanup-git-worktrees/scripts/cleanup.sh clean \
--gh --stale-days 15 --base origin/canary \
--branch feat/example \
--branch fix/example \
--apply
Without --apply, cleanup is a dry run. The script re-classifies every target immediately before deletion and refuses anything that is not candidate-*. Worktrees whose only dirt is noise are removed with git worktree remove --force; everything else uses the plain, refusing form.
Removing a worktree that still holds node_modules can take several minutes each. Run large batches in the background and report progress rather than waiting on a single foreground call.
Run the audit again and report:
Squash and rebase merges leave no ancestry, so git merge-base --is-ancestor and git cherry say "not merged" for branches whose PR landed. Use this ladder instead:
--gh reports pr_state=MERGED and tip_eq_pr=eq: the local tip is exactly what GitHub merged. Done.review-pr-merged-ahead (tip moved past the PR head): list the extra commits with git log <pr-head>..<branch> and search the base for each subject: git log origin/canary --oneline -F --grep="<subject>". A hit on the PR's squash commit means the commit was part of the PR. A miss means the commit is unmerged; check which live branch still contains it with git branch --contains <sha> before deleting.pr-18412, codex/pr-18497-fix) are local review copies; verify the PR by number with gh pr view N --json state,headRefOid and compare subjects as above.git diff origin/canary <branch> -- <files>: on an old branch the diff is dominated by later changes on the base.Zero unpushed means every local commit is reachable from some remote ref, so deleting the local branch loses nothing even when the PR is still OPEN; the user has approved deleting such branches once they pass the stale threshold.
The repository owner has approved the following for this repo, so a cleanup run does not need to re-ask per item. It is the sanctioned exception to the safety rules below; state it in the report and say plainly whenever uncommitted work is being discarded.
git diff --quiet <base> -- <file>) is stale residue of a branch that is simply behind. When presenting, do not count it as a real change: list such files in their own group so the genuine modifications stay visible.MERGED or CLOSED, its worktree and local branch may be removed even when unpushed > 0 or the tree is dirty. Record every branch SHA before deleting (reflog keeps them ~90 days) and state in the report that uncommitted edits are not recoverable.*.probe.test.ts, spike scripts under scripts/, and untracked screenshots (*.png) are disposable; do not raise them as blockers.main, canary, the base ref, and the worktree running the command. A branch whose PR is OPEN is kept while it still holds local-only work (dirty files or unpushed > 0); a clean, fully-pushed branch with an open PR is the redundant local copy the stale rule already covers.Proving a merge when the repo squash-merges. This repo squash-merges, so a landed PR leaves the squash commit on the base but none of the branch's own commits. Searching the base for an individual commit subject therefore fails for every squashed branch — do not read that as "unmerged". Decide review-pr-merged-ahead by the PR's state plus commit dates instead: if the branch tip is not newer than mergedAt, the branch is pure pre-merge history whose content is already on the base (verify the PR's mergeCommit with git merge-base --is-ancestor <mergeCommit> origin/canary). Only commits dated after mergedAt are candidate unmerged work — keep the branch and list them.
The bundled script still refuses anything outside candidate-*, so these removals are done manually: wt_path=$(git worktree list --porcelain …) → record git rev-parse <branch> → git worktree remove --force → git branch -D. Keep the run in the background; removals that hold node_modules take minutes each.
git worktree list --porcelain marks an entry prunable when its gitdir file points nowhere (typically after a partial removal). The audit reports these as broken-registration(directory-present|missing; reason) instead of crashing on them.
git worktree prune drops only the registration. It never touches the directory or the branch, so it is safe to run before re-auditing..git, so its dirty state cannot be checked. Show its size and file count and ask before deleting it with rm -rf; that is the one place recursive deletion is acceptable, and only on a path the user named.[gone], or old; noise-only dirt (the --noise regex) does not count. The one exception is a worktree whose branch's PR is MERGED or CLOSED, per the repo-approved deletion policy above.unpushed > 0 through this script; list it and let the user decide. Same exception: a MERGED/CLOSED PR branch may be removed under the owner's standing approval, with its SHA recorded first.main, canary, or the base branch.bash, not the interactive zsh: zsh does not word-split $var in for/argument positions, so file lists collapse into one argument and checks silently pass.Use scripts/cleanup.sh; do not recreate its parsing and guard logic ad hoc unless the repository layout makes it unusable. It is set -euo pipefail; helper functions that pipe through grep wrap it in || true so an empty match is "clean", not an abort.
まだレビューはありません。使ってみた感想をお寄せください。
ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。
まだコメントはありません。最初のコメントを書いてみませんか。
実際の製品を操作して、利用者が確認できる動作証拠を集め、検証計画に沿った受け入れレポートとして公開するスキルです。
LobeHubにAIモデルプロバイダーを追加し、実行時連携からモデル表示、設定、ブランド表記、文書化、動作確認まで進めるスキルです。
ユーザー設定の初期値をサーバー側の環境変数で切り替えるため、型定義や設定の組み立て、ユーザーストアへの反映、環境変数の例と説明書きを追加する手順です。
エージェント実行中の各段階をフックで監視し、ツール呼び出しの模擬・制御や人の承認、圧縮、サブエージェント処理に介入する仕組みを扱います。
イベントを起点にエージェントのバックグラウンド処理を組み立て、ソース・シグナル・アクション・ポリシーの役割分担や非同期連携を実装するためのスキルです。
DiscordやSlackなどの実際のチャットアプリでボットにメッセージを送り、応答を画面で確認する受け入れテストを行うスキルです。