[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75DZQAQ787462NRXPBXYRW5":3,"skill-same:01M75DZQAQ787462NRXPBXYRW5":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"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":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":34,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":6,"updatedAt":37,"install":38,"resources":50},"01M75DZQAQ787462NRXPBXYRW5","git-cleanup",null,"Safely analyzes and cleans up local git branches and worktrees by categorizing them as merged, squash-merged, superseded, or active work.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fgit-cleanup\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: git-cleanup\ndescription: \"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:\n  - Bash\n  - Read\n  - Grep\n  - AskUserQuestion\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## 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\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\n### Squash-Merged Branches Require Force Delete\n\n**IMPORTANT:** `git branch -d` will ALWAYS fail for squash-merged branches because git cannot detect that the work was incorporated. This is expected behavior, not an error.\n\nWhen you identify a branch as squash-merged:\n- Plan to use `git branch -D` (force delete) from the start\n- Do NOT try `git branch -d` first and then ask again for `-D` - this wastes user confirmations\n- In the confirmation step, show `git branch -D` for squash-merged branches\n\n### Group Related Branches BEFORE Categorization\n\n**MANDATORY:** Before categorizing individual branches, group them by name prefix:\n\n```bash\n# Extract common prefixes from branch names\n# e.g., feature\u002Fauth-*, feature\u002Fapi-*, fix\u002Flogin-*\n```\n\nBranches sharing a prefix (e.g., `feature\u002Fapi`, `feature\u002Fapi-v2`, `feature\u002Fapi-refactor`) are almost certainly related iterations. Analyze them as a group:\n\n1. Find the oldest and newest by commit date\n2. Check if newer branches contain commits from older ones\n3. Check which PRs merged work from each\n4. Determine if older branches are superseded\n\nPresent related branches together with a clear recommendation, not scattered across categories.\n\n### Thorough PR History Investigation\n\nDon't rely on simple keyword matching. For `[gone]` branches:\n\n```bash\n# 1. Get the branch's commits that aren't in default branch\ngit log --oneline \"$default_branch\"..\"$branch\"\n\n# 2. Search default branch for PRs that incorporated this work\n# Search by: branch name, commit message keywords, PR numbers\ngit log --oneline \"$default_branch\" | grep -iE \"(branch-name|keyword|#[0-9]+)\"\n\n# 3. For related branch groups, trace which PRs merged which work\ngit log --oneline \"$default_branch\" | grep -iE \"(#[0-9]+)\" | head -20\n```\n\n## Workflow\n\n### Phase 1: Comprehensive Analysis\n\nGather ALL information upfront before any categorization:\n\n```bash\n# Get default branch name\ndefault_branch=$(git symbolic-ref refs\u002Fremotes\u002Forigin\u002FHEAD \\\n  2>\u002Fdev\u002Fnull | sed 's@^refs\u002Fremotes\u002Forigin\u002F@@' || echo \"main\")\n\n# Protected branches - never analyze or delete\nprotected='^(main|master|develop|release\u002F.*)$'\n\n# List all local branches with tracking info\ngit branch -vv\n\n# List all worktrees\ngit worktree list\n\n# Fetch and prune to sync remote state\ngit fetch --prune\n\n# Get merged branches (into default branch)\ngit branch --merged \"$default_branch\"\n\n# Get recent PR merge history (squash-merge detection)\ngit log --oneline \"$default_branch\" | grep -iE \"#[0-9]+\" | head -30\n\n# For EACH non-protected branch, get unique commits and sync status\nfor branch in $(git branch --format='%(refname:short)' \\\n  | grep -vE \"$protected\"); do\n  echo \"=== $branch ===\"\n  echo \"Commits not in $default_branch:\"\n  git log --oneline \"$default_branch\"..\"$branch\" 2>\u002Fdev\u002Fnull \\\n    | head -5\n  echo \"Commits not pushed to remote:\"\n  git log --oneline \"origin\u002F$branch\"..\"$branch\" 2>\u002Fdev\u002Fnull \\\n    | head -5 || echo \"(no remote tracking)\"\ndone\n```\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 `feature\u002Fapi-*` branches:\n\n```markdown\n### Related Branch Group: feature\u002Fapi-*\n\n| Branch | Commits | PR Merged | Status |\n|--------|---------|-----------|--------|\n| feature\u002Fapi | 12 | #29 (initial API) | Superseded - work in main |\n| feature\u002Fapi-v2 | 8 | #45 (API improvements) | Superseded - work in main |\n| feature\u002Fapi-refactor | 5 | #67 (refactor) | Superseded - work in main |\n| feature\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**Display warnings prominently:**\n\n```markdown\nWARNING: ..\u002Fproj-auth has uncommitted changes:\n  M  src\u002Fauth.js\n  ?? new-file.txt\n\nThese changes will be LOST if you remove this worktree.\n```\n\n### GATE 1: Present Complete Analysis\n\nPresent everything in ONE comprehensive view. Group related branches together:\n\n```markdown\n## Git Cleanup Analysis\n\n### Related Branch Groups\n\n**Group: feature\u002Fapi-* (4 branches)**\n| Branch | Status | Evidence |\n|--------|--------|----------|\n| feature\u002Fapi | Superseded | Work merged in PR #29 |\n| feature\u002Fapi-v2 | Superseded | Work merged in PR #45 |\n| feature\u002Fapi-refactor | Superseded | Work merged in PR #67 |\n| feature\u002Fapi-final | Superseded | Older iteration, diverged |\n\nRecommendation: Delete all 4 (work is in main)\n\n---\n\n### Individual Branches\n\n**Safe to Delete (merged with -d)**\n| Branch | Merged Into |\n|--------|-------------|\n| fix\u002Ftypo | main |\n\n**Safe to Delete (squash-merged, requires -D)**\n| Branch | Merged As |\n|--------|-----------|\n| feature\u002Flogin | PR #42 |\n\n**Needs Review ([gone] remotes, no PR found)**\n| Branch | Last Commit |\n|--------|-------------|\n| experiment\u002Fold | abc1234 \"WIP something\" |\n\n**Keep (active work)**\n| Branch | Status |\n|--------|--------|\n| wip\u002Fnew-feature | 5 unpushed commits |\n\n### Worktrees\n| Path | Branch | Status |\n|------|--------|--------|\n| ..\u002Fproj-auth | feature\u002Fauth | STALE (merged) |\n\n---\n\n**Summary:**\n- 4 related branches (feature\u002Fapi-*) - recommend delete all\n- 1 merged branch - safe to delete\n- 1 squash-merged branch - safe to delete\n- 1 needs review\n- 1 to keep\n\nWhich would you like to clean up?\n```\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 feature\u002Flogin\ngit branch -D feature\u002Fapi\ngit branch -D feature\u002Fapi-v2\ngit branch -D feature\u002Fapi-refactor\ngit branch -D feature\u002Fapi-final\n\n# Worktrees\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:\n\n```bash\ngit branch -d fix\u002Ftypo\ngit branch -D feature\u002Flogin\ngit branch -D feature\u002Fapi\ngit branch -D feature\u002Fapi-v2\ngit branch -D feature\u002Fapi-refactor\ngit branch -D feature\u002Fapi-final\ngit worktree remove ..\u002Fproj-auth\n```\n\nIf a deletion fails, report the error and continue with remaining deletions.\n\n### Phase 6: Report\n\n```markdown\n## Cleanup Complete\n\n### Deleted\n- fix\u002Ftypo\n- feature\u002Flogin\n- feature\u002Fapi\n- feature\u002Fapi-v2\n- feature\u002Fapi-refactor\n- feature\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* (filtered programmatically)\n5. **Block dirty worktree removal** - Refuse without explicit data loss acknowledgment\n6. **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","# 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## 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\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\n### Squash-Merged Branches Require Force Delete\n\n**IMPORTANT:** `git branch -d` will ALWAYS fail for squash-merged branches because git cannot detect that the work was incorporated. This is expected behavior, not an error.\n\nWhen you identify a branch as squash-merged:\n- Plan to use `git branch -D` (force delete) from the start\n- Do NOT try `git branch -d` first and then ask again for `-D` - this wastes user confirmations\n- In the confirmation step, show `git branch -D` for squash-merged branches\n\n### Group Related Branches BEFORE Categorization\n\n**MANDATORY:** Before categorizing individual branches, group them by name prefix:\n\n```bash\n# Extract common prefixes from branch names\n# e.g., feature\u002Fauth-*, feature\u002Fapi-*, fix\u002Flogin-*\n```\n\nBranches sharing a prefix (e.g., `feature\u002Fapi`, `feature\u002Fapi-v2`, `feature\u002Fapi-refactor`) are almost certainly related iterations. Analyze them as a group:\n\n1. Find the oldest and newest by commit date\n2. Check if newer branches contain commits from older ones\n3. Check which PRs merged work from each\n4. Determine if older branches are superseded\n\nPresent related branches together with a clear recommendation, not scattered across categories.\n\n### Thorough PR History Investigation\n\nDon't rely on simple keyword matching. For `[gone]` branches:\n\n```bash\n# 1. Get the branch's commits that aren't in default branch\ngit log --oneline \"$default_branch\"..\"$branch\"\n\n# 2. Search default branch for PRs that incorporated this work\n# Search by: branch name, commit message keywords, PR numbers\ngit log --oneline \"$default_branch\" | grep -iE \"(branch-name|keyword|#[0-9]+)\"\n\n# 3. For related branch groups, trace which PRs merged which work\ngit log --oneline \"$default_branch\" | grep -iE \"(#[0-9]+)\" | head -20\n```\n\n## Workflow\n\n### Phase 1: Comprehensive Analysis\n\nGather ALL information upfront before any categorization:\n\n```bash\n# Get default branch name\ndefault_branch=$(git symbolic-ref refs\u002Fremotes\u002Forigin\u002FHEAD \\\n  2>\u002Fdev\u002Fnull | sed 's@^refs\u002Fremotes\u002Forigin\u002F@@' || echo \"main\")\n\n# Protected branches - never analyze or delete\nprotected='^(main|master|develop|release\u002F.*)$'\n\n# List all local branches with tracking info\ngit branch -vv\n\n# List all worktrees\ngit worktree list\n\n# Fetch and prune to sync remote state\ngit fetch --prune\n\n# Get merged branches (into default branch)\ngit branch --merged \"$default_branch\"\n\n# Get recent PR merge history (squash-merge detection)\ngit log --oneline \"$default_branch\" | grep -iE \"#[0-9]+\" | head -30\n\n# For EACH non-protected branch, get unique commits and sync status\nfor branch in $(git branch --format='%(refname:short)' \\\n  | grep -vE \"$protected\"); do\n  echo \"=== $branch ===\"\n  echo \"Commits not in $default_branch:\"\n  git log --oneline \"$default_branch\"..\"$branch\" 2>\u002Fdev\u002Fnull \\\n    | head -5\n  echo \"Commits not pushed to remote:\"\n  git log --oneline \"origin\u002F$branch\"..\"$branch\" 2>\u002Fdev\u002Fnull \\\n    | head -5 || echo \"(no remote tracking)\"\ndone\n```\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 `feature\u002Fapi-*` branches:\n\n```markdown\n### Related Branch Group: feature\u002Fapi-*\n\n| Branch | Commits | PR Merged | Status |\n|--------|---------|-----------|--------|\n| feature\u002Fapi | 12 | #29 (initial API) | Superseded - work in main |\n| feature\u002Fapi-v2 | 8 | #45 (API improvements) | Superseded - work in main |\n| feature\u002Fapi-refactor | 5 | #67 (refactor) | Superseded - work in main |\n| feature\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**Display warnings prominently:**\n\n```markdown\nWARNING: ..\u002Fproj-auth has uncommitted changes:\n  M  src\u002Fauth.js\n  ?? new-file.txt\n\nThese changes will be LOST if you remove this worktree.\n```\n\n### GATE 1: Present Complete Analysis\n\nPresent everything in ONE comprehensive view. Group related branches together:\n\n```markdown\n## Git Cleanup Analysis\n\n### Related Branch Groups\n\n**Group: feature\u002Fapi-* (4 branches)**\n| Branch | Status | Evidence |\n|--------|--------|----------|\n| feature\u002Fapi | Superseded | Work merged in PR #29 |\n| feature\u002Fapi-v2 | Superseded | Work merged in PR #45 |\n| feature\u002Fapi-refactor | Superseded | Work merged in PR #67 |\n| feature\u002Fapi-final | Superseded | Older iteration, diverged |\n\nRecommendation: Delete all 4 (work is in main)\n\n---\n\n### Individual Branches\n\n**Safe to Delete (merged with -d)**\n| Branch | Merged Into |\n|--------|-------------|\n| fix\u002Ftypo | main |\n\n**Safe to Delete (squash-merged, requires -D)**\n| Branch | Merged As |\n|--------|-----------|\n| feature\u002Flogin | PR #42 |\n\n**Needs Review ([gone] remotes, no PR found)**\n| Branch | Last Commit |\n|--------|-------------|\n| experiment\u002Fold | abc1234 \"WIP something\" |\n\n**Keep (active work)**\n| Branch | Status |\n|--------|--------|\n| wip\u002Fnew-feature | 5 unpushed commits |\n\n### Worktrees\n| Path | Branch | Status |\n|------|--------|--------|\n| ..\u002Fproj-auth | feature\u002Fauth | STALE (merged) |\n\n---\n\n**Summary:**\n- 4 related branches (feature\u002Fapi-*) - recommend delete all\n- 1 merged branch - safe to delete\n- 1 squash-merged branch - safe to delete\n- 1 needs review\n- 1 to keep\n\nWhich would you like to clean up?\n```\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 feature\u002Flogin\ngit branch -D feature\u002Fapi\ngit branch -D feature\u002Fapi-v2\ngit branch -D feature\u002Fapi-refactor\ngit branch -D feature\u002Fapi-final\n\n# Worktrees\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:\n\n```bash\ngit branch -d fix\u002Ftypo\ngit branch -D feature\u002Flogin\ngit branch -D feature\u002Fapi\ngit branch -D feature\u002Fapi-v2\ngit branch -D feature\u002Fapi-refactor\ngit branch -D feature\u002Fapi-final\ngit worktree remove ..\u002Fproj-auth\n```\n\nIf a deletion fails, report the error and continue with remaining deletions.\n\n### Phase 6: Report\n\n```markdown\n## Cleanup Complete\n\n### Deleted\n- fix\u002Ftypo\n- feature\u002Flogin\n- feature\u002Fapi\n- feature\u002Fapi-v2\n- feature\u002Fapi-refactor\n- feature\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* (filtered programmatically)\n5. **Block dirty worktree removal** - Refuse without explicit data loss acknowledgment\n6. **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",{"name":5,"description":7,"allowed-tools":23,"disable-model-invocation":28},[24,25,26,27],"Bash","Read","Grep","AskUserQuestion",true,"main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Fgit-cleanup",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":28},[40,43,46],{"tool":41,"command":42},"npx","npx skills add agisota\u002Fold-one --skill git-cleanup",{"tool":44,"command":45},"bunx","bunx skills add agisota\u002Fold-one --skill git-cleanup",{"tool":47,"command":48},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill git-cleanup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fgit-cleanup\u002FSKILL.md",[],[52,59,66,75,82,89],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":70,"licenseFileUrl":71,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]