agentleFS
gregwebsgregwebs/skills-sdlc/skills/cleanup/SKILL.md

cleanup

Skill21 starsChanged 47 days agoMITView on GitHub

Clean up after merged work. Remove the local branch and its git worktree, delete the remote branch, then delete temp files, containers, images, and leftover test processes that the work left behind.

  • Commits and pushes

75 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use chips, react-query-best-practices and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • udecodeSkill

    chips

    Run the project's suggested-task ledger, the chips. /chips alone brings this session's open tasks up to date: it applies what the ledger helper says, settles stale and split tasks, cards what can start and reports the board, and /chips all also takes the ship-list tasks and the ones no live session owns, and merges duplicate tasks across the board. Use for /chips, /chips offer, start or drop, \"what chips are open\", \"suggest a task for X\", \"update the chips\", \"clean up the chips\", \"which chips are stale\", \"is this chip still worth doing\", \"merge duplicate chips\", at the last hand-back of a run that offered a task, and whenever pstack would file a tracked issue, a follow-up, a reflect Backlog item or an out-of-band PR.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    react-query-best-practices

    Audit and fix React Query usage in apps/web — enforce query key factories, signal forwarding, staleTime, and proper mutation patterns. Use when reviewing or fixing server-state code.

    Also in 3 projects that use this

  • bibektimilsina00Skill

    you-might-not-need-a-callback

    Analyze and fix useCallback anti-patterns in your code

    Also in 3 projects that use this

  • Scylla23Skill

    redo

    Re-run the last routed task one model tier up (haiku → sonnet → opus → fable). User-invoked escalation when the previous result missed. Pass --dry-run to preview without running.

    Also in 3 projects that use this

  • Aetheria-Labs1Skill

    plan-page

    Plan one storefront page from strategy through final copy, section order, proof, offers, template direction, responsive layout, and production asset requirements. Stops at an approved execution-ready specification.

    Also in 3 projects that use this

  • SocialKit-APISkill

    video-transcripts

    Extract transcripts from social videos through SocialKit across YouTube, TikTok, Instagram, Facebook, X/Twitter, LinkedIn, and direct video file URLs. Use when the user asks to transcribe, get captions or subtitles, pull the spoken text, or read what a video says, including one video or many at once. Returns full text plus timestamped segments. Not for posting, private accounts, or unrelated website scraping.

    Also in 3 projects that use this

  • +3 more from bibektimilsina00

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 63 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Stop and report if the branch is unmerged, has an open PR, or is the base of another branch.

    line 22
  2. Distinctive:

    Start the working copy elsewhere.

    line 27
  3. Distinctive:

    Delete the local branch with the safe form, so git itself refuses an unmerged branch:

    line 41
  4. Distinctive:

    Delete the remote branch with the configured access path, then verify:

    line 48
  5. Distinctive:

    Look for what this work created, and keep the scope to it:

    line 60
  6. Distinctive:

    Use the repository's ignore rules and modification times to find candidates, and list them before deleting.

    line 68
  7. Distinctive:

    If you are unsure, report them to the operator instead.

    line 77
  8. Distinctive:

    Remove test images created by this session.

    line 79
  9. Very specific:

    Never remove shared base images, containers or images of other worktrees and active agents, or volumes holding data.

    line 81
  10. Very specific:

    Prefer the project's own teardown commands over raw docker commands when the repository documents one.

    line 85

“Common” is measured: kept by at least 6 in 10 of the 63 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Cleanup after merge

Reclaim what a finished branch consumed. Discover the footprint first, then delete. Every deletion below is irreversible: confirm the work is merged and that nothing else depends on what you are removing.

Confirm the work is merged

Discover the remote and default branch from repository instructions and git remote show, rather than assuming origin and main.

Fetch, then verify the branch landed in the default branch. A squash or rebase merge leaves commit hashes unmatched, so check for the change itself: git log <default> --oneline --grep, the PR's merged state, or a diff of the branch against the default branch. git branch --merged alone is not proof.

Stop and report if the branch is unmerged, has an open PR, or is the base of another branch. Do not clean up work that can still be needed.

Remove the branch and its worktree

Start the working copy elsewhere. If the current checkout is the branch being removed, switch to the updated default branch first; git refuses to delete a branch that is checked out.

git worktree list
git worktree remove <worktree-path>
git worktree prune

git worktree remove refuses a dirty worktree. Inspect what is uncommitted, and only pass --force when the user authorizes discarding it. Never remove a worktree belonging to another branch or another agent's active task.

Delete the local branch with the safe form, so git itself refuses an unmerged branch:

git branch -d <branch>    # -D only if a squash merge makes the check moot

Delete the remote branch with the configured access path, then verify:

git push <remote> --delete <branch>            # or the github-app wrapper's push
git ls-remote --heads <remote> <branch>        # expect no output

Some projects keep the branch for a stacked PR's base, or delete remotely on merge already. Check before pushing a delete.

Remove temp files

Look for what this work created, and keep the scope to it:

  • workflow artifacts such as task briefs, implementation plans, results, and review notes
  • scratch directories, coverage and build output outside version control
  • editor and agent caches keyed to the branch or worktree path
  • the worktree directory itself, once git no longer tracks it

Use the repository's ignore rules and modification times to find candidates, and list them before deleting. Leave user data, dependencies to be reinstalled deliberately, and artifacts belonging to other branches. Ask when a path is ambiguous or outside the repository.

Stop leftover processes and containers

Enumerate processes and containers. For any that you are certain belong to your session, kill/stop them. If you are unsure, report them to the operator instead.

Remove test images created by this session.

Never remove shared base images, containers or images of other worktrees and active agents, or volumes holding data. Volume and system-wide prunes (docker volume prune, docker system prune) need explicit approval.

Prefer the project's own teardown commands over raw docker commands when the repository documents one.

Report

Summarize what was removed: branch and worktree, remote branch, temp files, containers, images, and killed processes. List what you deliberately left, with the reason, and anything needing an operator decision.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.