Skip to content
cccskills
FreePublished on GitHub

clean-complete-branches

Clean up completed Git branches and worktrees for this repository both locally and on GitHub. Use when the user asks to remove complete, completed, merged, stale, finished, or done branches, delete merged GitHub branches, tidy local worktrees, prune completed PR branches, or clean up branches and worktrees after pull requests have merged.

The English summary is being prepared. Showing the original description.

jtenniswood/espcontrol1,120 stars(GitHub 1,120 + cccskills 0)
Works withGitHub

Run score Not tested

See how to install

Files included (3)

  • SKILL.md3.2 KB
  • agents/openai.yaml258 B
  • scripts/clean_complete_branches.py13.0 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Clean Complete Branches

Overview

Clean up branch work safely after pull requests are complete. This skill covers:

  • local worktree folders;
  • local branch refs;
  • matching origin/* remote branches on GitHub.

Use the bundled script for detection and cleanup. It dry-runs by default and requires --apply before removing anything.

Workflow

1. Check the Repository

Start from any worktree for this repository:

git status --short --branch
git worktree list
git fetch origin main --prune

Resolve the active worktree root before running bundled scripts so the command also works when started from a subdirectory:

REPO_ROOT="$(git rev-parse --show-toplevel)"

Do not overwrite, revert, or remove local changes. If a worktree has uncommitted changes, leave it alone and mention it in the final update.

2. Preview Complete Branches

Run the script in dry-run mode first:

python3 "$REPO_ROOT/.agents/skills/clean-complete-branches/scripts/clean_complete_branches.py"

The script treats a branch as complete only when:

  • the branch is not protected, such as main, master, develop, dev, release, or gh-pages;
  • the branch has no open GitHub PR;
  • Git says the branch is already contained in origin/main, or GitHub reports a merged PR for that branch into main;
  • any checked-out worktree for that branch has no uncommitted changes.

If GitHub CLI is unavailable or unauthenticated, the script still uses Git's merge check. Squash-merged PR branches usually need GitHub CLI evidence because their exact commits may not be ancestors of main.

3. Apply Cleanup

After reviewing the dry-run output, remove only the listed safe candidates:

python3 "$REPO_ROOT/.agents/skills/clean-complete-branches/scripts/clean_complete_branches.py" --apply

By default, --apply removes safe worktree folders and local branch refs. To also delete matching GitHub remote branches, add --delete-remotes:

python3 "$REPO_ROOT/.agents/skills/clean-complete-branches/scripts/clean_complete_branches.py" --apply --delete-remotes

The script does not merge PRs, close issues, or delete protected branches.

4. Validate the Result

Confirm the cleanup:

git worktree list
git branch
git branch -r
git status --short --branch

Keep the final update practical: list what was removed, what was skipped, and whether GitHub remote branches were deleted.

Safety Rules

  • Never remove main, the current worktree, dirty worktrees, detached worktrees, or branches with open PRs.
  • Never use rm -rf for registered Git worktrees. Use git worktree remove.
  • Do not delete GitHub remote branches unless the user asked to clean GitHub too and the script has shown them as complete in dry-run output.
  • Do not close GitHub issues or merge pull requests as part of cleanup.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Find local Git worktree folders whose branches or pull requests have merged into main, then preview which clean, inactive folders can be removed. The bundled script defaults to a dry run and requires an explicit apply option to perform cleanup.

  • Previewing merged worktree folders for cleanup
  • Tidying old feature branch directories
  • Removing merged PR worktrees while keeping branch refs
jtenniswood/espcontrol1.1KUpdated Oct 27, 2026

compile

FreeSummary

Compile ESPHome firmware for every listed device using the version pinned by the repository and Docker. When a build fails, inspect the reported YAML or configuration issue, fix its source, and retry until each device compiles.

  • Checking firmware builds before committing
  • Finding YAML or configuration errors
  • Compiling all listed devices with Docker
jtenniswood/espcontrol1.1KUpdated Oct 27, 2026

docs-review

FreeSummary

Check a code change for missing, outdated, excessive, or misplaced documentation. Identify only actionable gaps, explain who needs the information, and suggest the smallest useful update and a suitable existing documentation location.

  • Check whether a feature change needs user documentation
  • Review documentation coverage in a pull request
  • Find outdated or misplaced docs related to a code change
jtenniswood/espcontrol1.1KUpdated Oct 27, 2026

Provide an expert codebase review for this repository. Use when the user says "Expert Review" or "/expert-review", asks for an expert review, wants refactoring or codebase improvement recommendations, wants consistency and quality assessed, or asks how to reduce duplication, improve component use, preserve the end-user experience, and keep upgrades cleanly migratable.

The English summary is being prepared. Showing the original description.

jtenniswood/espcontrol1.1KUpdated Oct 27, 2026

expert-reset

FreeSummary

Review a project as if rebuilding it today while keeping its current user experience as the target. Produce evidence-based architecture and migration recommendations, explain tradeoffs in plain language, and keep the work research-only unless implementation is requested separately.

  • Exploring a from-scratch architecture for a project
  • Comparing current structure with a reset design
  • Planning a staged migration without changing code
jtenniswood/espcontrol1.1KUpdated Oct 27, 2026

Flash EspControl display firmware from this repository using ESPHome. Use when the user invokes /flash-displays with no extra display name, or asks to flash, reflash, update, or upload firmware to all known displays in sequence, or to a specific display such as 7inch, 7-inch P4, 10inch, 10-inch V1, 10-inch V2, 10-inch V3, P4-86, 4.3-inch P4, 4-inch P4, or S3, over an explicitly supplied OTA target or USB.

The English summary is being prepared. Showing the original description.

jtenniswood/espcontrol1.1KUpdated Oct 27, 2026

See all skills by jtenniswood

Report a problem with this skill