TheVoskamps

orchestrate-cleanup

Remove what sdlc runs leave behind — worktrees, local branches, .claude/tmp/ scratch and, for the whole repo, other sessions' scratchpads — for one merged or closed PR, asking nothing, or for the whole repo after one go-ahead; then bring the default branch up to date. --stale-locks widens it to the locked worktrees of agents no longer running, --review-state to review state, and --dry-run lists what would go and removes nothing.

TheVoskamps 0 Updated 1d ago
GitHub

Install

npx skillscat add thevoskamps/claude-plugins-marketplace/orchestrate-cleanup

Install via the SkillsCat registry.

SKILL.md

Orchestrate Cleanup

Every sdlc run leaves its evidence and its interim work behind: the
review state under the repo's sdlc state directory, the worktrees its
teammates ran in, the issue branches, and task scratch. This skill
removes all but the review state with the sdlc-orchestrate-cleanup
script, which decides what goes by scope and asks nothing, and removes
the review state too only under --review-state. Spell the script as a
bare name.

The run keeps what a running agent may still use. No scope touches a
branch on origin, and none removes the default branch.

Invocation

/sdlc:orchestrate-cleanup <PR> [--stale-locks] [--review-state] [--dry-run]
/sdlc:orchestrate-cleanup --all [--stale-locks] [--review-state] [--dry-run]
  • <PR> — one merged or closed pull request, as N or #N. This
    skill acts only on the repository Claude Code runs in, so it refuses
    every longer form — repo#N, owner/repo#N, host/owner/repo#N, a
    URL: say that it takes a PR only as N or #N, and stop.
  • --all — the whole repository, for a human clearing up after many
    runs.
  • --stale-locks — also remove the locked worktrees of agents that
    are no longer running.
  • --review-state — delete review state as well: the PR's under
    <PR>, every PR's in the repository under --all. Without it, review
    state is kept.
  • --dry-run — list what would be removed, and remove nothing.

Any other token in $ARGUMENTS, both <PR> and --all, or neither,
is not a form this skill knows: say so and stop, rather than guessing
what was meant.

<PR>

Resolve the PR per the sdlc:reference-resolution skill, invoking it
first, with:

github-ref item --type pr '<PR>'

Run the script on its canonical reference,
<PR_REF>, and relay its output as it stands:

sdlc-orchestrate-cleanup --pr <PR_REF> [--stale-locks] [--review-state] [--dry-run]

An open PR is refused with nothing removed.

--all

  1. List what would go, passing the scratchpad path the harness gave
    this session, verbatim, and --stale-locks and --review-state
    when the human passed them:

    sdlc-orchestrate-cleanup --all --scratchpad <this session's scratchpad> [--stale-locks] [--review-state] --dry-run
  2. Show the human the full list as the script printed it. Under the
    skill's own --dry-run, stop there.

  3. Ask one question: whether to remove everything listed. End the turn
    at it.

  4. On a yes, run the same command without --dry-run, and relay its
    output. Any other answer removes nothing.

Output

Each item is one line, <action> <category> <item>, its action
prefixed would- under --dry-run. A failed line after an item
quotes why that item's action failed; the rest carried on. A keep
line names what the run left in place and why, and is not a failure. A
run that removes
switches the primary clone to the default branch before it deletes any
branch, or detaches it off a branch it deletes when another worktree
holds the default branch, and ends by pruning the worktree
registrations, fetching with --prune, and fast-forwarding the default
branch; it prints a failed line only for a step of those that failed.

On a non-zero exit, relay stderr verbatim beside the output. Exit 1
means an action, a step or a command failed. Exits 2 to 5 removed
nothing: 2 is a usage error, 3 an open PR, 4 a default branch that
could not be resolved, and 5 a PR in another repository.