wrsmith108

Session Cleanup Skill — Git skill for Claude Code

Git community

A Claude Code skill for structured end-of-session git housekeeping.

How to install Session Cleanup Skill

This entry records only its repository, not the path inside it, so there is no exact command to give. Open wrsmith108/session-cleanup-skill and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Session Cleanup Skill does

A Claude Code skill for structured end-of-session git housekeeping.

Alternatives in Git

  • Create Worktree + Spawn Agent — git worktree add ../feat-custom-templates -b feat/custom-templates origin/main cd ../feat-custom-templates && 211 ★
  • Hybrid Complete — Complete Hybrid Ralph task in worktree, verify all stories complete, commit code changes (excluding planning f 123 ★
  • Wrap Session — Automate end-of-session workflow: update SESSION.md, create git checkpoint, and prepare for context clear 88 ★

README

session-cleanup

A Claude Code skill for structured end-of-session git housekeeping.

What it does

Runs a five-phase cleanup at the end of a working session:

  1. Doc Review — Checks CLAUDE.md for stale entries, MEMORY.md for anything worth persisting, and commits dirty submodule state
  2. Branch Audit — Checks PR status for every non-main branch; uses two-dot diff to distinguish genuine unreleased content from squash-merge artifacts
  3. Branch Cleanup — Pushes or cherry-picks unreleased content to main, then deletes merged branches locally and remotely
  4. Worktree Cleanup — Removes stale worktrees via project script or git worktree remove; sweeps for orphaned Docker volumes/images left by worktrees removed outside the normal path (crash, manual removal), via a project-specific prune script if one exists
  5. Final State — Syncs local main to origin, confirms clean working tree, reports summary

Install

# Via Skillsmith MCP
# In Claude Code: "install session-cleanup skill"

# Or manually
git clone https://github.com/wrsmith108/session-cleanup-skill ~/.claude/skills/session-cleanup

Usage

/session-cleanup

Or say: `"end of session"`, `"clean up branches"`, `"clean up worktrees"`, `"session cleanup"`

Safety

  • Never deletes a branch without checking PR status first
  • Shows categorized branch list and requires explicit approval before any deletion
  • Uses two-dot diff (git diff main ) as the content gate — not three-dot — to correctly handle squash-merged branches
  • Cherry-pick conflicts trigger abort + report; source branch is preserved
  • git reset --hard origin/main guarded by uncommitted-work check
  • --no-verify requires explicit user consent with documented reason
  • Docker orphan sweep (Phase 4c) runs read-only by default; deletion requires showing the candidate list and getting explicit approval first
  • Graceful abort at any phase if user says "stop"

Requirements

  • git — core operations
  • `