Agent skill
git-worktree
Create, inspect, and clean up Git worktrees for parallel TermLink branch development. Use when starting isolated feature or bugfix work in a separate directory, checking which branches already have attached worktrees, removing stale worktrees after merge, or pruning orphaned worktree metadata.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/git-worktree-kongxiangning-termlink-2
SKILL.md
Git Worktree
Overview
Use this skill to run multiple TermLink tasks in parallel without stashing or mixing local changes in one checkout.
Run commands from repository root:
E:\coding\TermLink
Quick Checks
- List active worktrees before creating or removing anything:
git worktree list
- Confirm whether a branch already exists:
git branch --list feat/my-topic
Create A Worktree
Preferred helper for a new branch worktree:
powershell -ExecutionPolicy Bypass -File .\skills\git-worktree\scripts\new-worktree.ps1 -Branch feat/my-topic -Base main
Behavior:
- Resolve the current repository root.
- Create a sibling directory such as
E:\coding\TermLink-feat-my-topic. - Run
git worktree add -b <branch> <path> <base>. - Print the created path for follow-up work.
Optional variants:
# Reuse an existing branch instead of creating a new one
powershell -ExecutionPolicy Bypass -File .\skills\git-worktree\scripts\new-worktree.ps1 -Branch feat/my-topic -CheckoutExisting
# Override the default path
powershell -ExecutionPolicy Bypass -File .\skills\git-worktree\scripts\new-worktree.ps1 -Branch feat/my-topic -Base main -Path E:\coding\TermLink-wt\feat-my-topic
Remove And Prune
Remove a worktree after merge or abandonment:
git worktree remove E:\coding\TermLink-feat-my-topic
git worktree prune
Use force only when the user explicitly wants to discard uncommitted changes:
git worktree remove --force E:\coding\TermLink-feat-my-topic
git worktree prune
Rules
- Check
git worktree listbefore creating a new worktree to avoid path or branch collisions. - Prefer an explicit base branch such as
mainfor new feature worktrees. - Keep worktrees outside the repository root as sibling directories; do not create nested worktrees inside tracked folders.
- Do not remove a worktree with uncommitted changes unless the user explicitly asks to discard them.
- Run
git worktree pruneafter removal so stale metadata does not block later reuse.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?