بنقرة واحدة
cleanup
Git branch hygiene - delete merged/closed branch, prune stale refs, sync dependencies
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Git branch hygiene - delete merged/closed branch, prune stale refs, sync dependencies
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Interview the user, inspect this template repo, run the interactive onboarding CLI, and prune unused systems so a new Python project gets running quickly.
Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear or thermonuclear code quality review, deep code-quality audit, or especially harsh maintainability review.
Use whenever creating, editing, renaming, or deleting any file under .claude/skills/, .claude/agents/, .agents/skills/, or .codex/agents/. Teaches the dual-tool Claude/Codex layout and reminds to run `make sync-agent-config`.
Instructions for managing and running git hooks using `prek`. Use this skill for any mention of pre-commit hooks, as `prek` overrides pre-commit hooks.
Pause execution for a requested number of minutes by sleeping one-minute increments to avoid exceeding shell timeouts.
Instructions for running code quality checks and maintaining standards in the Python-Template project.
| name | cleanup |
| description | Git branch hygiene - delete merged/closed branch, prune stale refs, sync dependencies |
| user_invocable | true |
| triggers | ["/cleanup"] |
Automates git branch hygiene after merging or closing PRs. Safely deletes merged branches (and force-deletes closed/abandoned branches), prunes stale remote tracking refs, syncs dependencies, and runs garbage collection.
Execute these steps in order:
git branch --show-current
Store the result as CURRENT_BRANCH.
If CURRENT_BRANCH is main or master:
git status --porcelain
If output is non-empty:
First check for merged PRs:
gh pr list --state merged --head CURRENT_BRANCH --json number
If merged, proceed to step 5.
If not merged, check for closed PRs:
gh pr list --state closed --head CURRENT_BRANCH --json number
If closed (result is non-empty):
If neither merged nor closed:
git branch --merged main | grep -w CURRENT_BRANCHgit branch -D manually if you want to force delete."Store whether the branch was MERGED or CLOSED for use in step 6.
git checkout main
If branch was MERGED:
git branch -d CURRENT_BRANCH
If branch was CLOSED (PR closed without merging):
git branch -D CURRENT_BRANCH
Report: "Deleted branch CURRENT_BRANCH." (mention if force-deleted due to closed PR)
git pull origin main
git fetch --prune
Find and delete local branches whose upstream is gone:
git for-each-ref --format '%(refname:short) %(upstream:track)' refs/heads | while read branch track; do
if [ "$track" = "[gone]" ]; then
git branch -d "$branch" 2>/dev/null && echo "Deleted stale branch: $branch"
fi
done
Report any branches deleted.
Detect package manager and sync:
uv.lock exists: uv syncbun.lockb exists: bun installpackage-lock.json exists: npm installrequirements.txt exists: pip install -r requirements.txtgit gc --prune=now
Report completion:
-D since branch is abandonedgit pull fails due to no remote, continue with local operationsgit branch --merged check