Session Cleanup Skill
Description
A Claude Code skill for structured end-of-session git housekeeping.
Installation
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open the source below and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
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:
- Doc Review — Checks CLAUDE.md for stale entries, MEMORY.md for anything worth persisting, and commits dirty submodule state
- Branch Audit — Checks PR status for every non-main branch; uses two-dot diff to distinguish genuine unreleased content from squash-merge artifacts
- Branch Cleanup — Pushes or cherry-picks unreleased content to main, then deletes merged branches locally and remotely
- 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 - 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/mainguarded by uncommitted-work check--no-verifyrequires 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- `
Related Skills
使用 Git Worktrees
创建孤立的 Git worktrees,带有智能目录选择与安全验证。
Git Claude skills github
[Building agent skills blog](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-ag
Git #148
, [#161](https://github.com/affaan-m/everything-claude-code/pull/161))
Git GitHub MCP
| Token | Repos, issues, PRs, workflows |
Git GitHub MCP Server
Official first-party server to read repos, manage issues/PRs, and automate workflows.
Git mcp-server-github
GitHub API integration for repos, issues, PRs.
Git