# Worktree

> Use when starting new feature work that should happen in an isolated git worktree on its own branch.

- **Type:** Skill
- **Install:** `agentstack add skill-jhostalek-dotclaude-worktree`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [JHostalek](https://agentstack.voostack.com/s/jhostalek)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** CC0-1.0
- **Upstream author:** [JHostalek](https://github.com/JHostalek)
- **Source:** https://github.com/JHostalek/dotclaude/tree/main/skills/worktree
- **Website:** https://jhostalek.github.io/dotclaude/

## Install

```sh
agentstack add skill-jhostalek-dotclaude-worktree
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

input = $ARGUMENTS

## Branch Name

Derive from input; ask if missing. Default: `/`, conventional commit types (`feat` when ambiguous). Check `git branch` first — if repo uses different convention (e.g., `feature/JIRA-123-desc`), match it.

Show derived name before proceeding.

## Worktree Location

- `{repo_root}/.claude/worktrees/{branch_slug}` where `branch_slug` replaces `/` with `-`
- `repo_root` = `git rev-parse --show-toplevel`
- Ensure `.claude/worktrees/` exists and is in `.gitignore`

## Base Branch

Branch from latest remote default, not `HEAD` — `HEAD` can be stale or on an unrelated branch, silently seeding the worktree with wrong history.

Detect default: `git symbolic-ref refs/remotes/origin/HEAD | sed 's|refs/remotes/origin/||'` (fallback: try `main`, then `master`). Fetch: `git fetch origin {default_branch}`. Create: `git worktree add -b {branch} {directory} origin/{default_branch}`.

Branch already exists → `git worktree add {directory} {branch}` (no `-b`).

After creation, symlink gitignored files so worktree runs without reinstall:
```
bash ~/.claude/skills/worktree/scripts/symlink-gitignored.sh {repo_root} {directory}
```

## Output

Show: worktree path, `claude --cwd {directory}` command, reminder to use `/worktree-clean` when done, and `git worktree list`.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [JHostalek](https://github.com/JHostalek)
- **Source:** [JHostalek/dotclaude](https://github.com/JHostalek/dotclaude)
- **License:** CC0-1.0
- **Homepage:** https://jhostalek.github.io/dotclaude/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-jhostalek-dotclaude-worktree
- Seller: https://agentstack.voostack.com/s/jhostalek
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
