Apply
Execute a /repo-fleet-hygiene:audit plan: dry-run default; --apply cleans merged branches then worktrees after confirm; --remote-branches opt-in.
by melodic-software★ 34 GitHub stars
Install Apply in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Apply
Purpose
Consume the machine-readable action-plan JSON emitted by /repo-fleet-hygiene:audit and drive
cleanup for N repositories behind one confirmation gate. This is the executing verb for the
fleet cleanup contract. It is a separate skill from :audit on purpose: keeping execution out of
audit-fleet.sh keeps the audit's allowed-tools grant from ever covering a mutation.
- Pointer: how a prefix rule matches the arguments after it is in Permission rule syntax.
Default is dry-run (evidence refresh + ordered preview, no mutation). Execution requires an
explicit --apply, then interactive confirmation or --yes for non-interactive consent.
Non-negotiable boundary
- Never run without
--plan-filepointing at a prior audit plan (schema_version: 1). - Never treat plan tips as authorization. Re-derive every mutable OID immediately before delete.
- Skip fail-closed on OID drift, missing plan OID, protected/current/worktree-attached branches, locked or stranded worktrees, or unknown operations.
- Own batched
merged-local-branchdeletion here (repo-hygiene branch deletion stays interactive / per-repo and is not batched). - Order:
delete-merged-local-branches,cleanup-worktrees, thendelete-remote-branches. - No remote branch is deleted unless
--remote-branchesis passed.
Arguments
Parse $ARGUMENTS and pass them through to the bundled script. Supported flags:
--plan-file <path>(required): action-plan JSON from a prior audit (--plan-fileon audit, or the temp path named in the audit report).--apply: opt into mutation after the batch confirmation gate.--yes/-y: skip the interactive prompt (required for non-interactive--apply).--remote-branches: opt in todelete-remote-branchesrows (unmerged-remote-branchfindings of classnever-prorclosed-unmerged). Without it those rows are skipped withremote deletion requires --remote-branches, no remote is contacted, and the local rows run under the confirmation gate alone.--yesnever answers this flag's prompts.
Reject any other flag. Run exactly once:
${CLAUDE_SKILL_DIR}/scripts/apply-plan.sh <validated-and-quoted-arguments>
Confirmation gate
| Session | Flags | Behavior |
|---|---|---|
| Any | (default / no --apply) |
Dry-run preview only |
| Interactive tty | --apply |
Prompt once for the whole plan; decline → mutate nothing |
| Interactive tty | --apply --yes |
Apply without prompt |
| Non-interactive | --apply without --yes |
Print plan, stop (exit 3), mutate nothing |
| Non-interactive | --apply --yes |
Apply |
One gate covers every repository and every local operation in the plan.
Remote branch rows (--remote-branches)
Remote deletion is separate from that gate and stricter:
- Before any prompt the script re-checks each row against live state and skips on drift, a head
already gone, or the remote's default branch. It re-reads the tip with
git ls-remote. It requires every URL Git would fetch from or push to for the remote (effective config, sopushurlandurl.*.insteadOfcount) to name the repository the audit recorded inremote_key. It re-reads the branch's pull requests withgh pr list --state allforgithub_repo:never-prneeds none,closed-unmergedneeds onlyCLOSEDones with one at the plan tip. AnOPENorMERGEDpull request, a changed class, a full 100-row page, or a failedghcall skips the row. The identity and pull request checks run again after a yes and before the ledger write and the push. - Each branch gets its own
[y/N]prompt naming repository, remote, branch, class, and tip.--yesdoes not answer it. A non-interactive session with any remote row that would be prompted deletes nothing at all, local rows included (exit 3). - Before each push the tip is appended to
<plan-file>.tip-ledger(tab-separated: repository, remote, branch, class, tip, UTC time, restore command). A ledger write failure aborts that branch (exit 4). The push isgit push <remote> --delete refs/heads/<branch>with a lease on the exact recorded tip, so a head that moved since the read is not deleted. - Restore a branch by running the ledger line's last field,
git -C <repo> push <remote> <tip>:refs/heads/<branch>. It works only while the tip object exists locally. Apply fetches the tip first when it is absent, but a successful delete removes the remote-tracking ref, so the object is unreachable afterward andgit gcprunes it oncegc.pruneExpirepasses (two weeks by default). - Claim:
gc.pruneExpiredefaults to two weeks. Basis: thegc.pruneExpireentry of https://git-scm.com/docs/git-gc ("prune --expire 2.weeks.ago"), matchinggit help config(git 2.53.0). As of: 2026-09-29. Recheck: when a Git release changes thegc.pruneExpiredefault or the restore window in th
Allowed tools
Tools this skill is permitted to call.
- 01
Bash(${CLAUDE_SKILL_DIR}/scripts/apply-plan.sh:*)
Bundled files
- evals/evals.json
- scripts/apply-plan.sh
- scripts/apply-plan.test.sh
FAQ
What does the Apply skill do?
Execute a /repo-fleet-hygiene:audit plan: dry-run default; --apply cleans merged branches then worktrees after confirm; --remote-branches opt-in.
How do I install the Apply skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the Apply skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…