home / skills / kadel / claude-plugins / worktree-feature

This skill helps you start a new git worktree for feature isolation by creating a dedicated feature branch and directory.

npx playbooks add skill kadel/claude-plugins --skill worktree-feature

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.1 KB
---
name: Worktree Feature Development
description: This skill should be used when the user asks to "start a new feature", "create feature branch in worktree", "set up isolated feature development", "work on feature in separate directory", or mentions git worktree for feature isolation.
version: 0.1.0
---

## Purpose

Create a new git worktree for isolated feature development with a dedicated branch. This allows working on features in parallel without stashing or switching branches in the main repository.

## Workflow

1. Prompt user for feature name if not provided
2. Create feature branch from current branch (or specified base)
3. Create git worktree in sibling directory: `../<repo>-<feature-name>`
4. Navigate (cd) into the new worktree directory

## Instructions

When the user wants to start a new feature in a worktree:

### Step 1: Gather Information
Ask the user for the feature name if not already provided. Optionally ask which branch to base the feature on (default: current branch).

### Step 2: Create the Worktree
Execute the following commands:

```bash
# Determine values
FEATURE_NAME="<user-provided-name>"
BASE_BRANCH=$(git branch --show-current)
REPO_NAME=$(basename $(git rev-parse --show-toplevel))
WORKTREE_PATH="../${REPO_NAME}-${FEATURE_NAME}"

# Create worktree with new feature branch
git worktree add -b "feature/${FEATURE_NAME}" "${WORKTREE_PATH}" "${BASE_BRANCH}"
```

### Step 3: Navigate to Worktree
Change to the new worktree directory:

```bash
cd "${WORKTREE_PATH}"
```

### Step 4: Confirm Success
Inform the user that the worktree has been created and they are now working in the isolated feature directory.

## User Prompts

- **Feature name**: Required. Ask "What would you like to name this feature?" if not provided.
- **Base branch**: Optional. Default to current branch. Ask "Which branch should this feature be based on?" only if the user seems uncertain.

## Example Usage

User: "Start a new feature called user-auth"

Result:
- Creates branch `feature/user-auth` based on current branch
- Creates worktree at `../repo-name-user-auth`
- Changes directory to the new worktree

Overview

This skill creates a new git worktree and a dedicated feature branch so you can develop a feature in an isolated sibling directory. It automates branch creation from a chosen base and opens a worktree at ../<repo>-<feature-name>, then moves you into that directory. Use it to avoid stashing, switching branches, or interfering with ongoing work in the main checkout.

How this skill works

The skill asks for a feature name (and optionally a base branch) then runs git commands to create a new branch named feature/<feature-name> from the chosen base. It computes the repository name, builds a sibling path ../<repo>-<feature-name>, and runs git worktree add -b to create the worktree there. Finally it cd's into the new worktree and confirms success.

When to use it

  • Starting a new feature without disrupting the current working tree
  • Working on multiple features or PRs in parallel
  • Testing experimental changes while keeping the main branch clean
  • When you prefer each feature to live in its own directory for easier tooling or editor instances
  • Avoiding repeated stashing or branch switching during multitasking

Best practices

  • Provide a concise, descriptive feature name (e.g., user-auth, add-payment-flow)
  • Base the feature on a stable branch (default: current branch) to avoid merge surprises
  • Keep worktree directories outside the repo root (the skill uses ../repo-feature by default)
  • Commit frequently in the worktree and push the feature branch to remote when ready
  • Clean up worktrees and delete merged feature branches to avoid clutter

Example use cases

  • User asks: "Start a new feature called user-auth" — creates feature/user-auth and opens ../repo-user-auth
  • Create an isolated worktree to debug a regression while keeping the main tree on a release branch
  • Open the same repo in two editor windows: one for mainline work, one for a feature branch
  • Develop a large refactor in a separate directory so CI runs and local builds don’t conflict

FAQ

What if I don't provide a feature name?

The skill will prompt: "What would you like to name this feature?" and will not proceed until a name is given.

Which branch is used as the base?

By default it uses the current branch. You can specify another branch when asked: "Which branch should this feature be based on?"