[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79N9DBZRRHXHBPP552WTK0T":3,"skill-same:01M79N9DBZRRHXHBPP552WTK0T":66},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":13,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":43},"01M79N9DBZRRHXHBPP552WTK0T","git-cleanup",null,"Safely analyzes and cleans up local git branches and worktrees by categorizing them as merged, squash-merged, superseded, or active work.","AndreHahm\u002Fandres-cc-marketplace","AndreHahm","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F80748019?v=4","01M79N2VZJT9MAJ7K695C9VXQ4","01M79N2W06PFX8BSCQ592M8K8K",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgit-cleanup\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: git-cleanup\ndescription: >-\n  Safely analyzes and cleans up local git branches and worktrees by categorizing them as merged, squash-merged, superseded, or active work.\ndisable-model-invocation: true\nallowed-tools: Bash(git branch:*), Bash(git worktree:*), Bash(git fetch:*), Bash(git log:*), Bash(git status:*), Bash(git symbolic-ref:*), Bash(git -C:*), Bash(*\u002Fgit-kit\u002Fscripts\u002Fwrite-git-kit-marker.sh:*), Bash(*\u002Fgit-kit\u002Fskills\u002Fgit-cleanup\u002Fscripts\u002Fphase1-analysis.sh:*), Read, Grep\n---\n\n# Git Cleanup\n\nSafely clean up accumulated git worktrees and local branches by categorizing them into: safely deletable (merged), potentially related (similar themes), and active work (keep).\n\n**On the `Bash(git -C:*)` grant:** this is broad by necessity, not oversight — Phase 4's dirty-state and\ngitignored-content checks run `git -C \u003Cworktree-path> status --porcelain[--ignored]` against a worktree\npath that's only known at runtime, and `Bash(prefix:*)` permission syntax can't express \"any `-C \u003Cpath>`\nbut only followed by `status`\" without a wrapper script. Reviewed 2026-08-11 (git-kit retro follow-up);\nno narrower grant is expressible with the current permission syntax.\n\n## When to Use\n\n- When the user has accumulated many local branches and worktrees\n- When branches have been merged but not cleaned up locally\n- When remote branches have been deleted but local tracking branches remain\n\n## When NOT to Use\n\n- Do not use for remote branch management (this is local cleanup only)\n- Do not use for repository maintenance tasks like gc or prune\n- Not designed for headless or non-interactive automation (requires user confirmations at two gates)\n- Cannot run from a session sandboxed to a worktree checkout — this command needs to operate on the\n  primary checkout's branch\u002Fworktree list, and a worktree-sandboxed session cannot `cd` there. Run it from\n  a session started in the primary checkout instead. See `finishing-work`'s hand-off note for the same\n  constraint on the more common path into this skill.\n\n## Core Principle: SAFETY FIRST\n\n**Never delete anything without explicit user confirmation.** This skill uses a gated workflow where users must approve each step before any destructive action.\n\n## Critical Implementation Notes\n\nSee [references\u002Fcritical-implementation-notes.md](references\u002Fcritical-implementation-notes.md) for the\nsquash-merge `-D` requirement and the PR-history investigation commands — the branch-grouping procedure\nitself is already fully covered by Phase 2 below, so the reference file doesn't restate it. Read the\nreference before Phase 3 (Categorize) for the squash-merge nuance; the PR-history commands apply\nspecifically to `[gone]` branches within Phase 2\u002F3.\n\n## Workflow\n\n### Phase 1: Comprehensive Analysis\n\nGather ALL information upfront before any categorization. Run `\"${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fgit-cleanup\u002Fscripts\u002Fphase1-analysis.sh\"` directly via `Bash` — it resolves the default branch, lists local branches and worktrees, fetches\u002Fprunes, gets merged-branch and recent PR-merge history, and for each non-protected branch (protected names excluded via the script's own `grep -vE` filter) reports unmerged and unpushed commits. Read its output rather than re-deriving these git calls by hand.\n\n**Note on branch names:** Git branch names can contain characters that break shell expansion. Always quote `\"$branch\"` in commands.\n\n### Phase 2: Group Related Branches\n\n**Do this BEFORE individual categorization.**\n\nIdentify branch groups by shared prefixes:\n\n```bash\n# List branches and extract prefixes\ngit branch --format='%(refname:short)' | sed 's\u002F-[^-]*$\u002F\u002F' | sort | uniq -c | sort -rn\n```\n\nFor each group with 2+ branches:\n\n1. **Compare commit histories** - Which branches contain commits from others?\n2. **Find merge evidence** - Which PRs incorporated work from this group?\n3. **Identify the \"final\" branch** - Usually the most recent or most complete\n4. **Mark superseded branches** - Older iterations whose work is in main or in a newer branch\n\n**SUPERSEDED requires evidence, not just shared prefix:**\n- A PR merged the work into main, OR\n- A newer branch contains all commits from the older branch\n- Name prefix alone is NOT sufficient — similarly named branches may contain independent work\n\nExample analysis for `feat\u002Fapi-*` branches:\n\n```markdown\n### Related Branch Group: feat\u002Fapi-*\n\n| Branch | Commits | PR Merged | Status |\n|--------|---------|-----------|--------|\n| feat\u002Fapi | 12 | #29 (initial API) | Superseded - work in main |\n| feat\u002Fapi-v2 | 8 | #45 (API improvements) | Superseded - work in main |\n| feat\u002Fapi-refactor | 5 | #67 (refactor) | Superseded - work in main |\n| feat\u002Fapi-final | 4 | None found | Superseded by above PRs |\n\n**Recommendation:** All 4 branches can be deleted - work incorporated via PRs #29, #45, #67\n```\n\n### Phase 3: Categorize Remaining Branches\n\nFor branches NOT in a related group, categorize individually:\n\n```\nIs branch merged into default branch?\n├─ YES → SAFE_TO_DELETE (use -d)\n└─ NO → Is tracking a remote?\n        ├─ YES → Remote deleted? ([gone])\n        │        ├─ YES → Was work squash-merged? (check main for PR)\n        │        │        ├─ YES → SQUASH_MERGED (use -D)\n        │        │        └─ NO → REMOTE_GONE (needs review)\n        │        └─ NO → Local ahead of remote? (check: git log origin\u002F\u003Cbranch>..\u003Cbranch>)\n        │                ├─ YES (has output) → UNPUSHED_WORK (keep)\n        │                └─ NO (empty output) → SYNCED_WITH_REMOTE (keep)\n        └─ NO → Has unique commits?\n                ├─ YES → LOCAL_WORK (keep)\n                └─ NO → SAFE_TO_DELETE (use -d)\n```\n\n**Category definitions:**\n\n| Category | Meaning | Delete Command |\n|----------|---------|----------------|\n| SAFE_TO_DELETE | Merged into default branch | `git branch -d` |\n| SQUASH_MERGED | Work incorporated via squash merge | `git branch -D` |\n| SUPERSEDED | Part of a group, work verified in main via PR or in newer branch | `git branch -D` |\n| REMOTE_GONE | Remote deleted, work NOT found in main | Review needed |\n| UNPUSHED_WORK | Has commits not pushed to remote | Keep |\n| LOCAL_WORK | Untracked branch with unique commits | Keep |\n| SYNCED_WITH_REMOTE | Up to date with remote | Keep |\n\n### Phase 4: Dirty State Detection\n\nCheck ALL worktrees and current directory for uncommitted changes:\n\n```bash\n# For each worktree path\ngit -C \u003Cworktree-path> status --porcelain\n\n# For current directory\ngit status --porcelain\n```\n\n**Also check for gitignored content** — `git status --porcelain` never lists gitignored files, tracked\nor not, so a worktree can carry a `.env`, a local settings override, or other gitignored content that this\ncheck alone would silently miss:\n\n```bash\n# For each worktree path\ngit -C \u003Cworktree-path> status --porcelain --ignored\n\n# For current directory\ngit status --porcelain --ignored\n```\n\nDo not use `git clean` here — it's a destructive command with no place in an analysis-only phase of a\nskill whose Core Principle is \"never delete anything without explicit user confirmation.\" `--ignored` is\nread-only and sufficient. If the ignored-file list is long (e.g. `node_modules\u002F`, `.venv\u002F`), show only the\ntop-level entries plus a count rather than every path, so the warning stays readable.\n\n**Exclude `.claude\u002Fsettings.local.json` and any `**\u002FCLAUDE.local.md`** from this warning — `starting-work`\nnow copies both into every worktree it creates from the main worktree's own copy, so a worktree's version\nis a duplicate, not the only copy; deleting the worktree does not lose them the way an untracked `.env` or\nscratch file would. Do not list these two patterns under \"will also be deleted\" below.\n\n**Display warnings prominently:**\n\n```markdown\nWARNING: ..\u002Fproj-auth has uncommitted changes:\n  M  src\u002Fauth.js\n  ?? new-file.txt\n\nIgnored (not tracked by git, will also be deleted):\n  .env\n\nThese changes will be LOST if you remove this worktree.\n```\n\n**Check for session locks:** `git worktree list --verbose` shows `locked: \u003Creason>` for any locked\nworktree (`starting-work` locks every worktree it creates — see its own Instructions). A locked worktree\nrecommended for deletion needs an unlock step before `git worktree remove` — note this against that\nworktree in the analysis rather than only discovering it when the removal command itself fails.\n\n### GATE 1: Present Complete Analysis\n\nPresent everything in ONE comprehensive view. Group related branches together. See `assets\u002Fanalysis-report-template.md` for the full example layout (related branch groups, individual branch categories, worktrees, and summary).\n\nUse AskUserQuestion with clear options:\n- Delete all recommended (groups + merged + squash-merged)\n- Delete specific groups\u002Fcategories\n- Let me pick individual branches\n\n**Do not proceed until user responds.**\n\n### GATE 2: Final Confirmation with Exact Commands\n\nShow the EXACT commands that will run, with correct flags:\n\n```markdown\nI will execute:\n\n# Merged branches (safe delete)\ngit branch -d fix\u002Ftypo\n\n# Squash-merged branches (force delete - work is in main via PRs)\ngit branch -D feat\u002Flogin\ngit branch -D feat\u002Fapi\ngit branch -D feat\u002Fapi-v2\ngit branch -D feat\u002Fapi-refactor\ngit branch -D feat\u002Fapi-final\n\n# Worktrees (unlock first if session-locked, per Phase 4's lock check)\ngit worktree unlock ..\u002Fproj-auth\ngit worktree remove ..\u002Fproj-auth\n\nConfirm? (yes\u002Fno)\n```\n\n**IMPORTANT:** This is the ONLY confirmation needed for deletion. Do not add extra confirmations if `-D` is required.\n\n### Phase 5: Execute\n\nRun each deletion as a **separate command** so partial failures don't block remaining deletions. Report the result of each. Immediately before each `git branch -D` call — never earlier, since git-kit's guard hook only accepts a marker up to 60 seconds old — run `\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup`. This writes the marker git-kit's destructive-cleanup guard requires before it will let a raw `git branch -D` targeting a protected branch name through — the same marker-handshake pattern every other git-kit skill uses before its own guarded command. Plain `git branch -d` (lowercase, already-merged-only) and plain `git worktree remove` (no `--force`) aren't guarded and need no marker; only `git worktree remove --force`\u002F`-f` does, since a plain removal already refuses on a dirty or locked worktree via git's own safeguard.\n\n```bash\ngit branch -d fix\u002Ftypo\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Flogin\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi-v2\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi-refactor\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi-final\ngit worktree unlock ..\u002Fproj-auth\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit worktree remove ..\u002Fproj-auth\n```\n\nIf a deletion fails, report the error and continue with remaining deletions. If `git worktree remove`\nfails specifically because the worktree is still locked (the unlock step above was skipped, or a lock was\nadded after Phase 4's check), report this distinctly from a generic removal failure — say plainly that it's\nlocked and by which reason, rather than surfacing git's raw error text unexplained.\n\n### Phase 6: Report\n\n```markdown\n## Cleanup Complete\n\n### Deleted\n- fix\u002Ftypo\n- feat\u002Flogin\n- feat\u002Fapi\n- feat\u002Fapi-v2\n- feat\u002Fapi-refactor\n- feat\u002Fapi-final\n- Worktree: ..\u002Fproj-auth\n\n### Remaining (4 branches)\n| Branch | Status |\n|--------|--------|\n| main | current |\n| wip\u002Fnew-feature | active work |\n| experiment\u002Fold | needs review |\n```\n\n## Safety Rules\n\n1. **Never invoke automatically** - Only run when user explicitly uses `\u002Fgit-cleanup`\n2. **Two confirmation gates only** - Analysis review, then deletion confirmation\n3. **Use correct delete command** - `-d` for merged, `-D` for squash-merged\u002Fsuperseded\n4. **Never touch protected branches** - main, master, develop, release\u002F* are excluded from Phase 1's\n   per-branch commit-analysis loop by `scripts\u002Fphase1-analysis.sh`'s own `grep -vE` filter (run directly,\n   not just read), and any raw `git branch -D` that still targets one of these names is additionally\n   hard-blocked by git-kit's `guard-raw-destructive-cleanup.sh` PreToolUse hook\n5. **Block dirty worktree removal** - Refuse without explicit data loss acknowledgment. \"Dirty\" covers\n   gitignored content too, not just tracked\u002Funtracked-but-not-ignored changes — `git status --porcelain`\n   alone misses gitignored files entirely, so Phase 4's `--ignored` check is what actually completes this\n   rule's coverage\n6. **Unlock before removing** - A session-locked worktree (per Phase 4's lock check) gets\n   `git worktree unlock` immediately before `git worktree remove`, never `--force` as a substitute for\n   unlocking — `--force` bypasses the dirty-worktree safeguard in Safety Rule 5 too, not just the lock\n7. **Group related branches** - Don't scatter them across categories\n\n## Rationalizations to Reject\n\nThese are common shortcuts that lead to data loss. Reject them:\n\n| Rationalization | Why It's Wrong |\n|-----------------|----------------|\n| \"The branch is old, it's probably safe to delete\" | Age doesn't indicate merge status. Old branches may contain unmerged work. |\n| \"I can recover from reflog if needed\" | Reflog entries expire. Users often don't know how to use reflog. Don't rely on it as a safety net. |\n| \"It's just a local branch, nothing important\" | Local branches may contain the only copy of work not pushed anywhere. |\n| \"The PR was merged, so the branch is safe\" | Squash merges don't preserve branch history. Verify the *specific* commits were incorporated. |\n| \"I'll just delete all the `[gone]` branches\" | `[gone]` only means the remote was deleted. The local branch may have unpushed commits. |\n| \"The user seems to want everything deleted\" | Always present analysis first. Let the user choose what to delete. |\n| \"The branch has commits not in main, so it has unpushed work\" | \"Not in main\" ≠ \"not pushed\". A branch can be synced with its remote but not merged to main. Always check `git log origin\u002F\u003Cbranch>..\u003Cbranch>`. |\n| \"It's gitignored, so it's not important\" | Gitignored means *not in git history* — it is often the only copy of a `.env`, a local override, or uncommitted scratch output. Absence from git is not evidence of unimportance. |\n\n## Testing & Validation\n\nSee [references\u002Ftesting-and-validation.md](references\u002Ftesting-and-validation.md) for activation\ntriggers\u002Fnon-triggers, the Phase 4 gitignored-content detection scenarios, and the full quality-gates\nchecklist.\n","# Git Cleanup\n\nSafely clean up accumulated git worktrees and local branches by categorizing them into: safely deletable (merged), potentially related (similar themes), and active work (keep).\n\n**On the `Bash(git -C:*)` grant:** this is broad by necessity, not oversight — Phase 4's dirty-state and\ngitignored-content checks run `git -C \u003Cworktree-path> status --porcelain[--ignored]` against a worktree\npath that's only known at runtime, and `Bash(prefix:*)` permission syntax can't express \"any `-C \u003Cpath>`\nbut only followed by `status`\" without a wrapper script. Reviewed 2026-08-11 (git-kit retro follow-up);\nno narrower grant is expressible with the current permission syntax.\n\n## When to Use\n\n- When the user has accumulated many local branches and worktrees\n- When branches have been merged but not cleaned up locally\n- When remote branches have been deleted but local tracking branches remain\n\n## When NOT to Use\n\n- Do not use for remote branch management (this is local cleanup only)\n- Do not use for repository maintenance tasks like gc or prune\n- Not designed for headless or non-interactive automation (requires user confirmations at two gates)\n- Cannot run from a session sandboxed to a worktree checkout — this command needs to operate on the\n  primary checkout's branch\u002Fworktree list, and a worktree-sandboxed session cannot `cd` there. Run it from\n  a session started in the primary checkout instead. See `finishing-work`'s hand-off note for the same\n  constraint on the more common path into this skill.\n\n## Core Principle: SAFETY FIRST\n\n**Never delete anything without explicit user confirmation.** This skill uses a gated workflow where users must approve each step before any destructive action.\n\n## Critical Implementation Notes\n\nSee [references\u002Fcritical-implementation-notes.md](references\u002Fcritical-implementation-notes.md) for the\nsquash-merge `-D` requirement and the PR-history investigation commands — the branch-grouping procedure\nitself is already fully covered by Phase 2 below, so the reference file doesn't restate it. Read the\nreference before Phase 3 (Categorize) for the squash-merge nuance; the PR-history commands apply\nspecifically to `[gone]` branches within Phase 2\u002F3.\n\n## Workflow\n\n### Phase 1: Comprehensive Analysis\n\nGather ALL information upfront before any categorization. Run `\"${CLAUDE_PLUGIN_ROOT}\u002Fskills\u002Fgit-cleanup\u002Fscripts\u002Fphase1-analysis.sh\"` directly via `Bash` — it resolves the default branch, lists local branches and worktrees, fetches\u002Fprunes, gets merged-branch and recent PR-merge history, and for each non-protected branch (protected names excluded via the script's own `grep -vE` filter) reports unmerged and unpushed commits. Read its output rather than re-deriving these git calls by hand.\n\n**Note on branch names:** Git branch names can contain characters that break shell expansion. Always quote `\"$branch\"` in commands.\n\n### Phase 2: Group Related Branches\n\n**Do this BEFORE individual categorization.**\n\nIdentify branch groups by shared prefixes:\n\n```bash\n# List branches and extract prefixes\ngit branch --format='%(refname:short)' | sed 's\u002F-[^-]*$\u002F\u002F' | sort | uniq -c | sort -rn\n```\n\nFor each group with 2+ branches:\n\n1. **Compare commit histories** - Which branches contain commits from others?\n2. **Find merge evidence** - Which PRs incorporated work from this group?\n3. **Identify the \"final\" branch** - Usually the most recent or most complete\n4. **Mark superseded branches** - Older iterations whose work is in main or in a newer branch\n\n**SUPERSEDED requires evidence, not just shared prefix:**\n- A PR merged the work into main, OR\n- A newer branch contains all commits from the older branch\n- Name prefix alone is NOT sufficient — similarly named branches may contain independent work\n\nExample analysis for `feat\u002Fapi-*` branches:\n\n```markdown\n### Related Branch Group: feat\u002Fapi-*\n\n| Branch | Commits | PR Merged | Status |\n|--------|---------|-----------|--------|\n| feat\u002Fapi | 12 | #29 (initial API) | Superseded - work in main |\n| feat\u002Fapi-v2 | 8 | #45 (API improvements) | Superseded - work in main |\n| feat\u002Fapi-refactor | 5 | #67 (refactor) | Superseded - work in main |\n| feat\u002Fapi-final | 4 | None found | Superseded by above PRs |\n\n**Recommendation:** All 4 branches can be deleted - work incorporated via PRs #29, #45, #67\n```\n\n### Phase 3: Categorize Remaining Branches\n\nFor branches NOT in a related group, categorize individually:\n\n```\nIs branch merged into default branch?\n├─ YES → SAFE_TO_DELETE (use -d)\n└─ NO → Is tracking a remote?\n        ├─ YES → Remote deleted? ([gone])\n        │        ├─ YES → Was work squash-merged? (check main for PR)\n        │        │        ├─ YES → SQUASH_MERGED (use -D)\n        │        │        └─ NO → REMOTE_GONE (needs review)\n        │        └─ NO → Local ahead of remote? (check: git log origin\u002F\u003Cbranch>..\u003Cbranch>)\n        │                ├─ YES (has output) → UNPUSHED_WORK (keep)\n        │                └─ NO (empty output) → SYNCED_WITH_REMOTE (keep)\n        └─ NO → Has unique commits?\n                ├─ YES → LOCAL_WORK (keep)\n                └─ NO → SAFE_TO_DELETE (use -d)\n```\n\n**Category definitions:**\n\n| Category | Meaning | Delete Command |\n|----------|---------|----------------|\n| SAFE_TO_DELETE | Merged into default branch | `git branch -d` |\n| SQUASH_MERGED | Work incorporated via squash merge | `git branch -D` |\n| SUPERSEDED | Part of a group, work verified in main via PR or in newer branch | `git branch -D` |\n| REMOTE_GONE | Remote deleted, work NOT found in main | Review needed |\n| UNPUSHED_WORK | Has commits not pushed to remote | Keep |\n| LOCAL_WORK | Untracked branch with unique commits | Keep |\n| SYNCED_WITH_REMOTE | Up to date with remote | Keep |\n\n### Phase 4: Dirty State Detection\n\nCheck ALL worktrees and current directory for uncommitted changes:\n\n```bash\n# For each worktree path\ngit -C \u003Cworktree-path> status --porcelain\n\n# For current directory\ngit status --porcelain\n```\n\n**Also check for gitignored content** — `git status --porcelain` never lists gitignored files, tracked\nor not, so a worktree can carry a `.env`, a local settings override, or other gitignored content that this\ncheck alone would silently miss:\n\n```bash\n# For each worktree path\ngit -C \u003Cworktree-path> status --porcelain --ignored\n\n# For current directory\ngit status --porcelain --ignored\n```\n\nDo not use `git clean` here — it's a destructive command with no place in an analysis-only phase of a\nskill whose Core Principle is \"never delete anything without explicit user confirmation.\" `--ignored` is\nread-only and sufficient. If the ignored-file list is long (e.g. `node_modules\u002F`, `.venv\u002F`), show only the\ntop-level entries plus a count rather than every path, so the warning stays readable.\n\n**Exclude `.claude\u002Fsettings.local.json` and any `**\u002FCLAUDE.local.md`** from this warning — `starting-work`\nnow copies both into every worktree it creates from the main worktree's own copy, so a worktree's version\nis a duplicate, not the only copy; deleting the worktree does not lose them the way an untracked `.env` or\nscratch file would. Do not list these two patterns under \"will also be deleted\" below.\n\n**Display warnings prominently:**\n\n```markdown\nWARNING: ..\u002Fproj-auth has uncommitted changes:\n  M  src\u002Fauth.js\n  ?? new-file.txt\n\nIgnored (not tracked by git, will also be deleted):\n  .env\n\nThese changes will be LOST if you remove this worktree.\n```\n\n**Check for session locks:** `git worktree list --verbose` shows `locked: \u003Creason>` for any locked\nworktree (`starting-work` locks every worktree it creates — see its own Instructions). A locked worktree\nrecommended for deletion needs an unlock step before `git worktree remove` — note this against that\nworktree in the analysis rather than only discovering it when the removal command itself fails.\n\n### GATE 1: Present Complete Analysis\n\nPresent everything in ONE comprehensive view. Group related branches together. See `assets\u002Fanalysis-report-template.md` for the full example layout (related branch groups, individual branch categories, worktrees, and summary).\n\nUse AskUserQuestion with clear options:\n- Delete all recommended (groups + merged + squash-merged)\n- Delete specific groups\u002Fcategories\n- Let me pick individual branches\n\n**Do not proceed until user responds.**\n\n### GATE 2: Final Confirmation with Exact Commands\n\nShow the EXACT commands that will run, with correct flags:\n\n```markdown\nI will execute:\n\n# Merged branches (safe delete)\ngit branch -d fix\u002Ftypo\n\n# Squash-merged branches (force delete - work is in main via PRs)\ngit branch -D feat\u002Flogin\ngit branch -D feat\u002Fapi\ngit branch -D feat\u002Fapi-v2\ngit branch -D feat\u002Fapi-refactor\ngit branch -D feat\u002Fapi-final\n\n# Worktrees (unlock first if session-locked, per Phase 4's lock check)\ngit worktree unlock ..\u002Fproj-auth\ngit worktree remove ..\u002Fproj-auth\n\nConfirm? (yes\u002Fno)\n```\n\n**IMPORTANT:** This is the ONLY confirmation needed for deletion. Do not add extra confirmations if `-D` is required.\n\n### Phase 5: Execute\n\nRun each deletion as a **separate command** so partial failures don't block remaining deletions. Report the result of each. Immediately before each `git branch -D` call — never earlier, since git-kit's guard hook only accepts a marker up to 60 seconds old — run `\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup`. This writes the marker git-kit's destructive-cleanup guard requires before it will let a raw `git branch -D` targeting a protected branch name through — the same marker-handshake pattern every other git-kit skill uses before its own guarded command. Plain `git branch -d` (lowercase, already-merged-only) and plain `git worktree remove` (no `--force`) aren't guarded and need no marker; only `git worktree remove --force`\u002F`-f` does, since a plain removal already refuses on a dirty or locked worktree via git's own safeguard.\n\n```bash\ngit branch -d fix\u002Ftypo\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Flogin\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi-v2\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi-refactor\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit branch -D feat\u002Fapi-final\ngit worktree unlock ..\u002Fproj-auth\n\"${CLAUDE_PLUGIN_ROOT}\u002Fscripts\u002Fwrite-git-kit-marker.sh\" git-cleanup-destructive git-cleanup\ngit worktree remove ..\u002Fproj-auth\n```\n\nIf a deletion fails, report the error and continue with remaining deletions. If `git worktree remove`\nfails specifically because the worktree is still locked (the unlock step above was skipped, or a lock was\nadded after Phase 4's check), report this distinctly from a generic removal failure — say plainly that it's\nlocked and by which reason, rather than surfacing git's raw error text unexplained.\n\n### Phase 6: Report\n\n```markdown\n## Cleanup Complete\n\n### Deleted\n- fix\u002Ftypo\n- feat\u002Flogin\n- feat\u002Fapi\n- feat\u002Fapi-v2\n- feat\u002Fapi-refactor\n- feat\u002Fapi-final\n- Worktree: ..\u002Fproj-auth\n\n### Remaining (4 branches)\n| Branch | Status |\n|--------|--------|\n| main | current |\n| wip\u002Fnew-feature | active work |\n| experiment\u002Fold | needs review |\n```\n\n## Safety Rules\n\n1. **Never invoke automatically** - Only run when user explicitly uses `\u002Fgit-cleanup`\n2. **Two confirmation gates only** - Analysis review, then deletion confirmation\n3. **Use correct delete command** - `-d` for merged, `-D` for squash-merged\u002Fsuperseded\n4. **Never touch protected branches** - main, master, develop, release\u002F* are excluded from Phase 1's\n   per-branch commit-analysis loop by `scripts\u002Fphase1-analysis.sh`'s own `grep -vE` filter (run directly,\n   not just read), and any raw `git branch -D` that still targets one of these names is additionally\n   hard-blocked by git-kit's `guard-raw-destructive-cleanup.sh` PreToolUse hook\n5. **Block dirty worktree removal** - Refuse without explicit data loss acknowledgment. \"Dirty\" covers\n   gitignored content too, not just tracked\u002Funtracked-but-not-ignored changes — `git status --porcelain`\n   alone misses gitignored files entirely, so Phase 4's `--ignored` check is what actually completes this\n   rule's coverage\n6. **Unlock before removing** - A session-locked worktree (per Phase 4's lock check) gets\n   `git worktree unlock` immediately before `git worktree remove`, never `--force` as a substitute for\n   unlocking — `--force` bypasses the dirty-worktree safeguard in Safety Rule 5 too, not just the lock\n7. **Group related branches** - Don't scatter them across categories\n\n## Rationalizations to Reject\n\nThese are common shortcuts that lead to data loss. Reject them:\n\n| Rationalization | Why It's Wrong |\n|-----------------|----------------|\n| \"The branch is old, it's probably safe to delete\" | Age doesn't indicate merge status. Old branches may contain unmerged work. |\n| \"I can recover from reflog if needed\" | Reflog entries expire. Users often don't know how to use reflog. Don't rely on it as a safety net. |\n| \"It's just a local branch, nothing important\" | Local branches may contain the only copy of work not pushed anywhere. |\n| \"The PR was merged, so the branch is safe\" | Squash merges don't preserve branch history. Verify the *specific* commits were incorporated. |\n| \"I'll just delete all the `[gone]` branches\" | `[gone]` only means the remote was deleted. The local branch may have unpushed commits. |\n| \"The user seems to want everything deleted\" | Always present analysis first. Let the user choose what to delete. |\n| \"The branch has commits not in main, so it has unpushed work\" | \"Not in main\" ≠ \"not pushed\". A branch can be synced with its remote but not merged to main. Always check `git log origin\u002F\u003Cbranch>..\u003Cbranch>`. |\n| \"It's gitignored, so it's not important\" | Gitignored means *not in git history* — it is often the only copy of a `.env`, a local override, or uncommitted scratch output. Absence from git is not evidence of unimportance. |\n\n## Testing & Validation\n\nSee [references\u002Ftesting-and-validation.md](references\u002Ftesting-and-validation.md) for activation\ntriggers\u002Fnon-triggers, the Phase 4 gitignored-content detection scenarios, and the full quality-gates\nchecklist.\n",{"name":5,"description":7,"allowed-tools":23,"disable-model-invocation":24},"Bash(git branch:*), Bash(git worktree:*), Bash(git fetch:*), Bash(git log:*), Bash(git status:*), Bash(git symbolic-ref:*), Bash(git -C:*), Bash(*\u002Fgit-kit\u002Fscripts\u002Fwrite-git-kit-marker.sh:*), Bash(*\u002Fgit-kit\u002Fskills\u002Fgit-cleanup\u002Fscripts\u002Fphase1-analysis.sh:*), Read, Grep",true,"main","1bf12900cac6f28e346abd2912bdb78d306de723",".agents\u002Fskills\u002Fgit-cleanup","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace","https:\u002F\u002Fgithub.com\u002FAndreHahm","2026-11-15 04:26:16",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":24},[33,36,39],{"tool":34,"command":35},"npx","npx skills add AndreHahm\u002Fandres-cc-marketplace --skill git-cleanup",{"tool":37,"command":38},"bunx","bunx skills add AndreHahm\u002Fandres-cc-marketplace --skill git-cleanup",{"tool":40,"command":41},"pnpm","pnpm dlx skills add AndreHahm\u002Fandres-cc-marketplace --skill git-cleanup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgit-cleanup\u002FSKILL.md",[44,50,56,60],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"assets\u002Fanalysis-report-template.md","ASSET","资产文件",1526,"https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgit-cleanup\u002Fassets\u002Fanalysis-report-template.md",{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fcritical-implementation-notes.md","REFERENCE","参考文档",1098,"https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgit-cleanup\u002Freferences\u002Fcritical-implementation-notes.md",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Ftesting-and-validation.md",1533,"https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgit-cleanup\u002Freferences\u002Ftesting-and-validation.md",{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"scripts\u002Fphase1-analysis.sh","SCRIPT","脚本",1194,"https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fgit-cleanup\u002Fscripts\u002Fphase1-analysis.sh",[67,74,81,88,95,102],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M79R0K918Z0XDM74R0EY5H3P","demo","Fixture skill used by scripts.marketplace_ci sync tests.","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002Ftests\u002Fmarketplace_ci\u002Ffixtures\u002Fplugins\u002Fsample-kit\u002Fskills\u002Fdemo\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M79R08VMDJA2FPJKH3ZM309K","export-demo","Fixture skill used by scripts.marketplace_ci export tests.","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002Ftests\u002Fmarketplace_ci\u002Ffixtures\u002Fclaude\u002Fskills\u002Fexport-demo\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M79R042FS581DS2JNW5AZ1MK","work-to-development","Validate an accepted Linear Issue's readiness for implementation (criteria, dependencies, duplicate\u002Fexisting artifacts) and request governed branch\u002Fworktree creation through git-kit:starting-work — recording work-started Git\u002FGitHub evidence and a deliberate Linear Started transition only after Git identity is read back and verified. Use when asked to start work on a Linear issue, begin development for an accepted issue, or prepare an accepted issue for implementation. Never creates a branch directly — always delegates to git-kit.","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkmanagement-kit\u002Fskills\u002Fwork-to-development\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M79QZZD4EHB82P72P4N92BKT","work-linking","Create and maintain stable cross-system links and authority labels between Notion and Linear records, and detect\u002Frepair drift between them. Use when asked to link a Notion record to a Linear record, check for drift between Notion and Linear, or repair a broken\u002Fstale link. Repairs only the bounded non-authoritative copy or link — never chooses by newest timestamp, and never creates a reverse-write loop against either system's own authority.","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkmanagement-kit\u002Fskills\u002Fwork-linking\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M79QZVFA3GTVNZMJ51NESVSP","status-and-learning","Produce a dated, explicitly non-live Linear-to-Notion progress summary, or capture an outcome\u002Flearning after work completes. Use when asked to summarize progress to Notion, report portfolio status, or capture what was learned from a completed piece of work — not to disposition open follow-up items (see open-item-management for that). Never runs automatically or continuously — every summary is a deliberate, approved snapshot, not a live sync.","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkmanagement-kit\u002Fskills\u002Fstatus-and-learning\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":18},"01M79QZNSKSABK7X2PT93X8QT5","repository-gates","Discover, delegate, record, and invalidate this repository's actual Git\u002FGitHub lifecycle gates (pre-commit, pre-push, PR required checks, Codex delta review, review requirements, merge rights) and the repository-policy provider profile that maps governed operations to git-kit. Use when asked what gates apply to this repository, to discover repository policy before starting Wave 2 work, or to check whether prior gate evidence is still valid after new commits. Discovery and delegation only — never executes a gate's own internal logic, and never invents a gate the repository doesn't actually define (in particular, never assumes a \"Review Changes\" gate exists).","https:\u002F\u002Fgithub.com\u002FAndreHahm\u002Fandres-cc-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fworkmanagement-kit\u002Fskills\u002Frepository-gates\u002FSKILL.md",[],[]]