Skip to content
Back to skills

Spin Worktree

ASecurity

Create an isolated Git worktree for issue, pull-request, branch, or parallel agent work without editing the control checkout. Use when starting task work from fresh remote state, avoiding a dirty or shared checkout, or preparing a dedicated worktree for another agent.

  • 21 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 4, 2026
ai-agentspythonrailsgit

Works with

  • cli

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add ConnorGriffin/skills --skill spin-worktree --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spin Worktree?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Spin Worktree
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/connorgriffin-spin-worktree/badge)](https://www.skillsdirectory.com/skills/connorgriffin-spin-worktree)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: spin-worktree
description: Create an isolated Git worktree for issue, pull-request, branch, or parallel agent work without editing the control checkout. Use when starting task work from fresh remote state, avoiding a dirty or shared checkout, or preparing a dedicated worktree for another agent.
---

# Spin an isolated worktree

Keep the ordinary checkout as the control checkout and create one worktree per
task. Dirty files in the control checkout are preserved and do not block the
helper: it updates Git refs and shared worktree metadata, creates the destination,
and never switches, stashes, or edits files in the control checkout.

By default worktrees live under `${AGENT_WORKTREE_ROOT:-~/worktrees}`:

```text
~/worktrees/<repository>/<task>
```

## Workflow

1. Resolve the ordinary checkout and pass it explicitly with `--repo`. Never
   substitute another task's linked worktree just because it is clean. If a
   linked worktree is passed accidentally, the helper resolves Git's primary
   worktree before deriving `<repository>` or running commands.
2. Resolve this installed skill's directory.
3. Run one of the commands below.
4. Report the exact path and use it as the working directory.
5. Do not remove the worktree automatically. Cleanup belongs to task closeout
   after merge.

New issue branch:

```sh
python3 <spin-worktree-skill-directory>/scripts/spin-worktree.py \
  --repo /path/to/repository \
  --issue 317 \
  --slug rescue-context
```

Existing pull-request branch, discovered with GitHub CLI:

```sh
python3 <spin-worktree-skill-directory>/scripts/spin-worktree.py \
  --repo /path/to/repository \
  --pr 321
```

Existing branch:

```sh
python3 <spin-worktree-skill-directory>/scripts/spin-worktree.py \
  --repo /path/to/repository \
  --branch issue-316 \
  --name pr321
```

Use `--dry-run` to inspect commands. Override defaults with
`--worktree-root`, `--remote`, `--base`, or `--branch-prefix`.

## Branch prefix

New issue branches resolve their prefix in this order: an explicitly supplied
`--branch-prefix` flag, then the string `branchPrefix` in
`~/.config/spin-worktree/config.json`, then no prefix. For example:

```json
{"branchPrefix": "my-prefix"}
```

With no resolved prefix, issue branches are `issue-317` or
`317-rescue-context`; they never begin with `/`. Pass `--branch-prefix ''` to
request that bare form for one invocation. Missing, unreadable, malformed, or
otherwise unsuitable config files silently resolve to no prefix.

## Guardrails

- Use one worktree path and branch per task.
- Never switch branches in another agent's active worktree.
- Do not reuse an existing target path unless inspection proves it belongs to
  the same task.
- New issue work updates the remote and starts from its current default branch
  unless `--base` is supplied.
- Existing local branches do not require a remote.
- Pull-request discovery requires authenticated `gh`. A same-repository head
  is fetched when needed. A fork head fails with the exact fork and branch to
  configure, rather than pretending it exists under `origin`.
- `--name` accepts one relative directory leaf, never a path.

Files in this skill

  • SKILL.md3.1 KB
  • agents/openai.yaml191 B
  • scripts/spin-worktree.py9.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.