AgentStack
SKILL verified MIT Self-run

Worktree Cleanup

skill-assapir-agent-skills-worktree-cleanup · by assapir

Set up automated cleanup of dead git worktrees and merged branches. Use when user wants to automate worktree/branch cleanup, schedule daily git maintenance, clean up stale branches on wake/login, or set up launchd automation for git hygiene.

No reviews yet
0 installs
5 views
0.0% view→install

Install

$ agentstack add skill-assapir-agent-skills-worktree-cleanup

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Worktree Cleanup? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Worktree Cleanup

Automate daily cleanup of dead worktrees and merged branches on macOS.

What It Does

  • Prunes dead worktrees (git worktree prune)
  • Deletes branches merged into master/main
  • Prunes stale remote tracking branches (git fetch --prune)
  • Runs once per day on configured workdays (default: Sun-Thu)
  • Triggers on first wake/login of the day

Installation

Run the install script with optional parameters:

# Default: ~/code directory, Sun-Thu
~/.claude/skills/worktree-cleanup/scripts/install-cleanup.sh

# Custom directory
~/.claude/skills/worktree-cleanup/scripts/install-cleanup.sh ~/projects

# Custom directory and workdays (Mon-Fri = 1,2,3,4,5)
~/.claude/skills/worktree-cleanup/scripts/install-cleanup.sh ~/projects "1,2,3,4,5"

Management Commands

# Run cleanup manually
~/.local/bin/cleanup-worktrees.sh

# View logs
cat ~/.local/state/worktree-cleanup.log

# Disable temporarily
launchctl unload ~/Library/LaunchAgents/com.$(whoami).cleanup-worktrees.plist

# Re-enable
launchctl load ~/Library/LaunchAgents/com.$(whoami).cleanup-worktrees.plist

# Uninstall completely
launchctl unload ~/Library/LaunchAgents/com.$(whoami).cleanup-worktrees.plist
rm ~/.local/bin/cleanup-worktrees.sh ~/Library/LaunchAgents/com.$(whoami).cleanup-worktrees.plist

Configuration

Environment variables (set in launchd plist):

  • WORKTREE_CLEANUP_DIR - Directory to scan for git repos (default: ~/code)
  • WORKTREE_CLEANUP_DAYS - Workdays as comma-separated numbers, 0=Sun..6=Sat (default: 0,1,2,3,4)

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.