prune-worktrees
hardkoded/puppeteer-sharp/.claude/skills/prune-worktrees/SKILL.md
Prune git worktrees whose associated pull requests have been closed or merged.
Skill3.9k starsChanged 7 months ago
What's in it
- Task
- Steps
# Task Prune git worktrees whose associated pull requests have been closed or merged. ## Steps 1. List all worktrees using `git worktree list` 2. Skip the main working tree (the first entry listed) 3. For each remaining worktree, extract the branch name 4. Use `gh pr list --head <branch> --state all --json number,state,title` to check if there is a PR for that branch 5. If the PR state is "CLOSED" or "MERGED", remove the worktree with `git worktree remove <path>` 6. If there is no PR for the branch, skip it and report it as "no PR found" 7. After processing all worktrees, run `git worktree prune` to clean up stale references 8. Report a summary: which worktrees were removed (and why), which were kept, and which had no PR
More agent context in hardkoded/puppeteer-sharp
6 other files this repository gives its agents.
CLAUDE.md
Skill
- implement-bidi-feature.claude/skills/implement-bidi-feature/SKILL.md
- implement-puppeteer-release.claude/skills/implement-puppeteer-release/SKILL.md
- implement-upstream-change.claude/skills/implement-upstream-change/SKILL.md
- remove-all-worktrees.claude/skills/remove-all-worktrees/SKILL.md
- work-on-open-issues.claude/skills/work-on-open-issues/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

