# Create Isolated Git Worktrees Safely

Concurrent branch work can disrupt the current workspace and hide baseline failures. This skill creates an isolated worktree with directory checks, setup guidance, and test verification.

## Install

```bash
npx skillstore add davila7/using-git-worktrees
```

## Metadata

- Status: approved
- Slug: davila7-using-git-worktrees
- Skillstore revision: r2
- Version status: missing
- Tree hash: bf75dcef5c4b52c658bb01daa007230c271b3f72fadc75423f007f887d62cdfc
- Author: davila7
- GitHub username: davila7
- License: MIT
- Repository: https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/development/using-git-worktrees
- Ref: c43861a65bb95efcae259cd161c9d6f4dc7eec6f
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: confirmation\_required
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, filesystem
- Quality score: 38
- Quality tier: warning
- Public page: https://skillstore.pages.dev/skills/davila7-using-git-worktrees
- Manifest: https://skillstore.pages.dev/api/skills/davila7-using-git-worktrees/manifest

## Capabilities

- Selects an existing project worktree directory using a defined priority.
- Checks CLAUDE.md for a documented worktree directory preference.
- Verifies that project-local worktree directories are ignored by Git.
- Creates a new branch and linked worktree at the selected location.
- Detects common Node.js, Rust, Python, and Go project manifests.
- Runs a project-appropriate baseline test and reports the result.

## Use Cases

- Isolate Feature Development: Create a separate workspace for a feature while preserving the current branch and working tree.
- Run Parallel Agent Tasks: Give each coding agent a separate branch workspace to reduce file and branch interference.
- Verify a Clean Starting Point: Install approved dependencies and run baseline tests before implementing a planned change.

## Prompt Templates

### Create a Basic Worktree

```
Create an isolated Git worktree for branch <branch-name>. Show the selected location and ask before running setup commands.
```

### Follow Repository Conventions

```
Prepare a worktree for <feature>. Check existing worktree directories and CLAUDE.md, verify ignore rules, then propose the creation command.
```

### Establish a Trusted Baseline

```
Create a worktree for <branch-name>. Identify setup and test commands, explain their effects, request approval, and report baseline results.
```

### Coordinate Parallel Worktrees

```
Plan isolated worktrees for <task-list>. Avoid branch and path conflicts, validate each destination, and provide a status summary for every task.
```

## Limitations

- Requires Git and a repository that supports worktrees.
- Uses POSIX shell examples that may need adaptation on Windows.
- Setup and test commands require review for each project and trust boundary.
- Does not define worktree cleanup, branch integration, or conflict resolution.

## Best Practices

- Confirm the worktree destination and branch name before creation.
- Verify project-local worktree directories are ignored before adding files.
- Review and approve repository setup and test commands before execution.

## Anti Patterns

- Do not create a project-local worktree inside a tracked directory.
- Do not run package installation or tests from an untrusted repository without isolation.
- Do not continue after baseline failures without explicit user approval.

## Security Audit

- Audited at: 2026-07-23T15:48:06.19\+00:00
- Summary: The static findings are false positives caused by Markdown formatting, documented Git commands, dedicated worktree paths, and standard error redirection. However, the skill automatically runs repository-controlled setup and test commands, and it may commit a .gitignore change without explicit approval.

## Stats

- Views: 310
- Downloads: 7
- Favorites: 0
- Popularity score: 0
