Skip to content
Deployment
Skill

/pcl

Delete stale git branches (local + remote) that have no open PR, and prune worktrees.

From plugin
spawn
2527 skills

Claude Code

$ npx -y skills add OpenRouterLabs/spawn --skill pcl --agent claude-code

SKILL.md

pcl.SKILL.md
name: pcl
description: Delete stale git branches (local + remote) that have no open PR, and prune worktrees.
argument-hint: "[--dry-run]"
allowed-tools: Bash

Cleanup Stale Branches

Delete local and remote git branches that no longer have an open PR, and prune stale worktrees.

Arguments

  • `--dry-run` — List what would be deleted without actually deleting anything.

**$ARGUMENTS**

Procedure

Step 1: Checkout main branch

Switch to main and update to latest:

git checkout main
git pull --rebase origin main

**Critical:** This ensures we're not on a branch that's about to be deleted, and that we're working from the latest main.

Step 2: Fetch and prune remote refs

git fetch --prune origin

Step 3: Identify stale remote branches

List all remote branches except `main` and `HEAD`:

git branch -r --format='%(refname:short) %(committerdate:relative)' | grep -v 'origin/main\|origin/HEAD\|^origin '

Step 4: Get branches with open PRs (protected)

gh pr list --repo OpenRouterLabs/spawn --state open --json headRefName --jq '.[].headRefName'

Any branch with an open PR MUST be skipped. Never delete a branch that has an open PR.

Step 5: Delete stale remote branches

For each remote branch that is NOT in the open PR list:

git push origin --delete BRANCH_NAME

If `--dry-run` was passed, print `[dry-run] would delete origin/BRANCH_NAME` instead.

Step 6: Delete stale local branches

List local branches (excluding the current branch and `main`):

git branch --list | grep -v '^\*' | grep -v '^ *main$' | tr -d ' '

For each, check if it's already merged into main or has no remote:

git branch -d BRANCH_NAME 2>/dev/null || git branch -D BRANCH_NAME

If `--dry-run`, print `[dry-run] would delete local BRANCH_NAME` instead.

Step 7: Prune worktrees

git worktree prune

Remove any leftover worktree directories:

rm -rf /tmp/spawn-worktrees 2>/dev/null || true

Step 8: Verify final state

Ensure we're on main branch:

git branch --show-current

Should output: `main`

Step 9: Summary

Print a summary:

  • Number of remote branches deleted
  • Number of local branches deleted
  • Number of branches skipped (had open PRs)
  • Worktree prune status
Read more
@openrouterlabs
Ships withspawn

Launch any AI agent on any cloud with a single command. Coding agents, research agents, self-hosted AI tools — Spawn deploys them all. All models powered by OpenRouter. (ALPHA software, use at your own risk!) 10 agents. 8 clouds. 79 working combinations.

Stars on GitHub

Momentum

stars in total
252
Star history of OpenRouterLabs/spawn on GitHub, a chart by star-history.com

Other skills on spawn.

More skills from other plugins.

configuring-horizon

configuring-horizon

Use this skill whenever the user mentions Horizon by name in a Laravel context. Covers the full Horizon lifecycle: installing…

coolify13d66k
@coollabsio@coollabsioInstall Skill
vercel-cli

vercel-cli

Guides deployment, configuration, and troubleshooting with the Vercel CLI. Use when operating Vercel projects or resources…

vercel2w16k
@vercel@vercelInstall Skill
skypilot

skypilot

Use when launching cloud VMs, Kubernetes pods, or Slurm jobs for GPU/TPU/CPU workloads, training or fine-tuning models on cloud…

@skypilot-org@skypilot-orgInstall Skill
pinme

pinme

Use this skill when the user mentions "pinme", or needs to upload files, store to IPFS, create/publish/deploy websites or…

pinme2mo3.8k
@glitternetwork@glitternetworkInstall Skill

Questions about pcl.

Which coding agents can use pcl?
pcl installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.