kevmoo/kevmoo_skills/new-worktree
Claude Code and agent skill by kevmoo/kevmoo_skills
- community
Checking that the SKILL.md file is still in the repository.
Creates and initializes a new Git worktree as a sibling directory with automated branching and naming rules based on the latest remote default branch. Use when invoking /new-worktree or requesting a new Git worktree for parallel development, feature work, or bug fixes in external repositories under ~/github. Don't use for the Dart SDK (~/github/dart-sdk), non-Git repositories, or repositories outside ~/github.
Install
npx vskill@latest install kevmoo/kevmoo_skills/new-worktreeSKILL.md
Pre-Flight & Hard Boundaries
Before creating any branch or worktree, verify the current working repository against the following boundaries:
- Git Exclusivity:
- Must be a Git repository (
git rev-parse --is-inside-work-tree). - If not using Git, stop immediately and alert the user.
- Repository Location (Must be under `~/github`):
- Check the absolute file path of the repository root.
- Repositories must reside under
~/github(arbitrarily deep, such as
~/github/kevmoo/kevmoo_skills or ~/github/repo).
- Hard Block: If the repository is located anywhere else, stop and issue
a warning asking for explicit human confirmation before proceeding. This prevents mutating internal corporate repositories or bare-repo dotfiles.
- Dart SDK Exception:
- Check if the repository maps to the Dart SDK
(https://github.com/dart-lang/sdk, e.g., located at ~/github/dart-sdk).
- Hard Block: If operating in the Dart SDK repository, stop immediately
and ask if the user wants to use their specialized Dart SDK flow instead (e.g., dart-sdk-bootstrap). Do not proceed without clarification. The Dart SDK relies on specialized toolchains, gclient checkouts, and dedicated bootstrap workflows that standard Git worktree operations break.
Location & Naming Conventions
When creating a worktree, observe strict placement and naming rules:
- Location: Place the new worktree directory right next to the source
repository directory (as a direct sibling in the parent folder).
- Worktree Naming: Format the folder name as
_[original repo folder name]-[branch-name].
- Branch Naming: Derive a clean, hyphen-separated branch name from the user
request (e.g., issue-12345 or fix-auth-crash).
Examples
- In
~/github/flutter, invoking/new-worktree to fix flutter issue #12345: - Creates branch:
issue-12345 - Creates worktree at:
~/github/_flutter-issue-12345 - In
~/github/kevmoo/kevmoo_skills, invoking/new-worktree add lint check: - Creates branch:
add-lint-check - Creates worktree at:
~/github/kevmoo/_kevmoo_skills-add-lint-check
Execution Steps
- Verify Pre-Flight Boundaries: Confirm location under
~/github, confirm
Git repository status, and ensure the repo is not the Dart SDK. Do not require a clean working directory; worktrees allow branching safely from a dirty tree.
- Fetch Latest Remote State & Resolve Base Branch: Prefer
originon
standalone personal repositories and forks under ~/github/<owner>/<repo> (unless remote.upstream.gh-resolved is base), and prefer upstream on external contribution checkouts at ~/github/<repo> so branches never start from a lagging origin/main, then resolve <remote>/HEAD, <remote>/main, or <remote>/master: ``bash REPO_ROOT=$(git rev-parse --show-toplevel) REMOTE="origin" if git remote | grep -qx upstream; then case "${REPO_ROOT}" in "${HOME}"/github/*/*/*) REMOTE="upstream" ;; "${HOME}"/github/*/*) if [ "$(git config --get remote.upstream.gh-resolved || true)" = "base" ]; then REMOTE="upstream" fi ;; *) REMOTE="upstream" ;; esac fi git fetch "${REMOTE}" TARGET_BASE=$(git symbolic-ref "refs/remotes/${REMOTE}/HEAD" 2>/dev/null || (git show-ref --verify --quiet "refs/remotes/${REMOTE}/main" && echo "${REMOTE}/main") || echo "${REMOTE}/master") ``
- Formulate Target Names: Determine
{branch_name}and sibling directory
path {sibling_worktree_path} based on naming rules.
- Collision Pre-Flight & Stale Worktree Pruning:
- Check if
{sibling_worktree_path}or local{branch_name}already exists. - If previous worktrees were removed manually, run
git worktree pruneto
clear stale metadata.
- Execute Worktree Creation:
``bash git worktree add -b {branch_name} {sibling_worktree_path} ${TARGET_BASE} ``
- Configure Default GitHub Repository (`gh repo set-default`):
- Inside the newly created worktree directory (
{sibling_worktree_path}),
configure gh to use the origin remote as the default repository so subsequent gh pr and gh run commands work without requiring -R: ``bash cd {sibling_worktree_path} && gh repo set-default origin ``
- Output Clickable Link: Provide the user with a clickable link to the new
worktree using the precise scheme [link text](file:///absolute/path/to/worktree). Never wrap link text or syntax in backticks.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/new-worktree/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kevmoo/kevmoo_skills/new-worktree)