benyoskovitz

Worktree Janitor — Security skill for Claude Code

Security community

Audit and clean up Claude Code worktrees in the current project.

How to install Worktree Janitor

Installs to ~/.claude/skills/benyoskovitz-claude-code-workflow-worktree-janitor/SKILL.md

Terminal
mkdir -p ~/.claude/skills/benyoskovitz-claude-code-workflow-worktree-janitor && curl -fsSL https://raw.githubusercontent.com/benyoskovitz/claude-code-workflow/HEAD/commands/worktree-janitor.md -o ~/.claude/skills/benyoskovitz-claude-code-workflow-worktree-janitor/SKILL.md

Restart Claude Code, or start a new session, for it to be picked up.

What Worktree Janitor does

Audit and clean up Claude Code worktrees in the current project. Lists every worktree with status, classifies orphans and phantom registrations, and prompts per-worktree to keep or remove.

Use this any time the worktree directory feels cluttered, or when `/session-end` left debris behind. Safe to run on a project that doesn't use worktrees, it reports cleanly and exits.

Assumes the convention of placing worktrees under `/.claude/worktrees/` and a default integration branch (this

Alternatives in Security

Full documentation available on GitHub

View Source Repository