Skip to content
Back to skills

Worktree Closeout

ASecurity

Finish work in a git worktree of this repository and remove it safely. Use after your change is pushed or abandoned, before ending a session, or when asked to clean up worktrees.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 9, 2026
ai-agentsshellgit

Security analysis

A100/100

Scanned October 9, 2026

npx -y skills add tedix-hq/tedix --skill worktree-closeout --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Worktree Closeout?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Worktree Closeout
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tedix-hq-worktree-closeout/badge)](https://www.skillsdirectory.com/skills/tedix-hq-worktree-closeout)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: worktree-closeout
description: Finish work in a git worktree of this repository and remove it safely. Use after your change is pushed or abandoned, before ending a session, or when asked to clean up worktrees.
---

# Close out a worktree

Parallel sessions share one repository and many worktrees. Leave only what
another session still needs.

1. **Confirm the work is landed.** `git status --short` is empty and
   `git merge-base --is-ancestor HEAD origin/main` succeeds after
   `git fetch origin main`. If either fails, push or record the work first; do
   not discard changes to make a worktree removable.
2. **Discard generated state, not work.** Changes to `wrangler.jsonc` or
   `cloudflare.config.ts` that rewrite a whole Worker config are a materialized
   deployment overlay. Restore them with `git restore <path>`; never commit
   them (see the deployment boundary in `AGENTS.md`).
3. **Leave the worktree.** `cd` to the main checkout so no shell of yours is
   inside it.
4. **Remove only your own.** `git worktree remove <path>` (no `--force`), then
   `git branch -d <branch>` for a merged branch. Delete your scratch files.
5. **Sweep the rest only when asked.** `bun run worktree:gc` reports every
   worktree of this repo; `--apply` removes only the `merged` rows: clean, in
   `origin/main`, unlocked, idle for two hours and with no process inside.
   `dirty`, `unmerged`, `recent`, `in-use` and `locked` rows belong to someone;
   report them instead of removing them.

Never remove the main checkout, a locked worktree, or a worktree with commits
that are not in `origin/main`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.