peiyuanqi/work-like-me/cleanup-work

Claude Code and agent skill by peiyuanqi/work-like-me

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Removes one completed Git worktree and its local task branch after delivery, never forced, once it has verified the exact target, a clean worktree, and that the task commit is in the remote default branch. Use when the user explicitly asks to remove a finished worktree or delete its local branch, or when swe:land-work was authorized to clean up. Not for code cleanup, unfinished work, forced deletion, or remote branch deletion.

Install

npx vskill@latest install peiyuanqi/work-like-me/cleanup-work

SKILL.md

The same SKILL.md was published earlier as peiyuanqi/work-like-me/cleanup-work.

Cleanup Work

Version: 1.1.0

Remove one completed Git worktree and its local task branch without discarding work. Cleanup is a destructive delivery action, so it needs explicit user authorization, either directly or as part of an authorized swe:land-work request.

Caller Contract

  • swe:land-work may call this skill only after it verifies that the landed

commit is on the remote default branch, only when the user also requested cleanup, and only from outside the target worktree.

  • A user may call this skill directly with an exact or unambiguous completed

worktree target.

  • swe:start-work, swe:finish-work, swe:submit-work, and ordinary task

completion do not call it.

  • Abandoning or deleting unmerged work is a different, destructive request.

Handle it separately rather than reinterpreting it as completed-work cleanup.

1. Resolve the Exact Target

Operate from a different checkout than the worktree being removed:

bash
git rev-parse --show-toplevel
git worktree list --porcelain
git -C <target-worktree> status --short --branch
git -C <target-worktree> branch --show-current
  • Resolve an absolute target path and its checked-out branch from Git metadata;

Build a destructive target only from resolved values, never from an unresolved variable, glob, or guessed directory.

  • Confirm the target is a registered linked worktree of this repository.
  • Leave these checkouts in place: the primary repository checkout, the

default-branch integration worktree, the caller's current worktree, and any worktree used by another active task.

  • If the target is ambiguous, stop and report the matching worktrees.

2. Prove Cleanup Is Safe

  1. Require empty staged, unstaged, and untracked status in the target worktree.
  2. Confirm no merge, rebase, cherry-pick, or revert is in progress.
  3. Resolve the canonical remote and its default branch rather than assuming

origin or main.

  1. Fetch that remote immediately before the containment check.
  2. For a task branch, prove its tip is an ancestor of the remote default branch:
bash
git fetch <remote> --prune
git merge-base --is-ancestor <task-branch> <remote>/<default-branch>

For a detached worktree, apply the same containment check to HEAD and skip branch deletion. If containment cannot be proven, stop and report. Making the check pass with --force, git branch -D, reset, stash, or file deletion would discard exactly the work these checks protect, so don't.

3. Remove the Worktree

From another checkout of the same repository, remove only the verified path, without --force:

bash
git worktree remove <absolute-target-worktree>
git worktree list --porcelain
  • If Git refuses removal, stop and report its reason.
  • Remove nothing else: no broad filesystem deletion and no pruning of unrelated

worktree metadata.

4. Delete Only the Local Task Branch

After confirming the worktree was removed, delete its local branch with Git's merged-safety check:

bash
git branch -d <task-branch>
  • Keep the default branch.
  • If -d refuses, stop and report; do not escalate to -D.
  • Leave remote branches and upstream configuration alone unless the user makes

a separate explicit request for that operation.

Completion Report

Report the repository, removed worktree path, deleted local branch or detached HEAD, remote default branch used for the containment proof, landed commit, and any target left intact because a safety check failed.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/peiyuanqi/work-like-me/cleanup-work/badge)](https://verified-skill.com/skills/peiyuanqi/work-like-me/cleanup-work)

Something wrong with this skill or its page? Tell us.