Skip to content

Add worktree skill with stale detection#42

Open
tomasfejfar wants to merge 2 commits intomainfrom
tomasfejfar-worktree-skill-with-stale-detection
Open

Add worktree skill with stale detection#42
tomasfejfar wants to merge 2 commits intomainfrom
tomasfejfar-worktree-skill-with-stale-detection

Conversation

@tomasfejfar
Copy link
Contributor

Summary

  • Adds a new worktree skill for creating git worktrees with proper setup
  • Includes stale worktree detection to identify worktrees whose remote branches no longer exist
  • Provides purge functionality to clean up stale worktrees

Scripts

  • create-worktree.sh: Creates worktrees in <repo-parent>/worktrees/<repo-name>/<branch-name>, copies env files, runs yarn install
  • detect-stale-worktrees.sh: Finds worktrees without corresponding remote branches (merged/deleted PRs)
  • purge-worktree.sh: Removes worktree and deletes local branch

Workflow

After creating a worktree, Claude will automatically check for stale worktrees and offer to clean them up.

Test plan

  • Create a worktree using /worktree branch-name
  • Verify stale worktree detection works after creation
  • Test purging a stale worktree

🤖 Generated with Claude Code

tomasfejfar and others added 2 commits February 5, 2026 12:24
Add skill for creating git worktrees with:
- create-worktree.sh: Creates worktrees with env file copying and yarn install
- detect-stale-worktrees.sh: Finds worktrees without remote branches
- purge-worktree.sh: Removes worktree and local branch

Instructions guide Claude to check for stale worktrees after creating
new ones and offer to clean them up.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace hardcoded env file copying and yarn install with support for
optional bin/worktree-init.sh script. The init script runs inside the
new worktree with $1 set to the source repo root, allowing repos to
customize their worktree setup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant