Skip to content
Back to skills

Worktree Protection

ASecurity

Verify exact worktree ownership, preserved state and cleanup authorization; names and missing sessions are not permission to remove work.

  • 6 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 26, 2026
businessgit

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add jleechanorg/jleechan-skills --skill worktree-protection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Worktree Protection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Worktree Protection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jleechanorg-worktree-protection/badge)](https://www.skillsdirectory.com/skills/jleechanorg-worktree-protection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: worktree-protection
description: Verify exact worktree ownership, preserved state and cleanup authorization; names and missing sessions are not permission to remove work.
type: policy
---

# Worktree Protection Rules

## Verify ownership and authority

A basename pattern or missing tmux session is an inventory hint, not proof that
a worktree is abandoned or disposable. Resolve the exact registered path,
branch and owner; inspect dirty files, unpushed commits, active processes and
the owner's transcript before assessing cleanup. Preserve unrelated work and
the active worktree.

Removal requires existing authorization for that exact target under shared
destructive-action policy. Neither an AO-looking name nor a merged PR supplies
that authorization. Conversely, an explicitly authorized target does not need
an AO-style name. Use the owning cleanup procedure and prefer recoverable
operations; report what was removed and how it can be recovered.

## Hard rules

- **NEVER run `git worktree prune`** — it indiscriminately removes all dead worktrees including human ones
- Never use name matching as the cleanup safety gate or recursively remove a
  computed target. Follow the shared destructive-path guard.
- Create worktrees with `diskm worktree-new` under `~/.worktrees/<repo>/<name>`
  unless an explicit applicable allowlist permits another root.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in business →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.