agentsclimarketplace

Use worktree

Skill atomgunlk/skills/skills/engineering/use-worktree

Battle-tested agent skills for engineering workflows — worktrees, task implementation, PR review, Jira/Confluence. For Claude Code, Kiro, and any skill-aware agent.

Install
npx -y skills add atomgunlk/skills --skill use-worktree

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 22 days oldThe repository was created 22 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when working with Git worktrees — triggers include "create worktree", "add worktree", "sibling worktree", or a plan file path. ALWAYS use for managing Git worktrees.

SKILL.md

2.1 KB, 514 tokens by cl100k_base, as published. Nobody here has run it

use-worktree

Create a sibling Git worktree for a new branch, without polluting the main checkout.

Running the script

The script is bundled with this skill at scripts/create-worktree.sh — resolve it relative to the directory containing this SKILL.md (do NOT reconstruct the git commands inline, and do NOT resolve it relative to your current working directory):

WT=$(<skill-dir>/scripts/create-worktree.sh <branch> [base] [slug])
cd "$WT"
  • branch — new branch, e.g. feat/abc-1234-foo (required)
  • base — fork point (optional; default: origin's default branch)
  • slug — worktree dir name (optional; default: branch with /-)

Detached mode — no new branch, checkout at a commit (e.g. a PR head SHA; fetch it first):

WT=$(<skill-dir>/scripts/create-worktree.sh --detach <commitish> [slug])

The script fetches origin, creates the worktree as a sibling of the main checkout (<repo>.worktrees/<slug>), and prints the worktree path to stdout (diagnostics go to stderr), so cd "$(…)" lands you in it. It works even when invoked from inside another worktree — it anchors on the shared git dir.

Examples

# New feature branch from origin's default branch
WT=$(<skill-dir>/scripts/create-worktree.sh feat/abc-1234-foo)

# Fork from a specific base
WT=$(<skill-dir>/scripts/create-worktree.sh fix/hotfix-login origin/release/1.2)

# Custom directory name for the worktree
WT=$(<skill-dir>/scripts/create-worktree.sh feat/abc-1234-foo "" abc-1234)

# Detached checkout of a PR head for review (no branch created)
WT=$(<skill-dir>/scripts/create-worktree.sh --detach "$HEAD_SHA" review-pr-42)

Optional: direnv users

direnv only fires in interactive shells. If the repo uses direnv, tooling run in the new worktree from a non-interactive shell (e.g. an agent's Bash tool) won't have env files loaded — prefix with:

direnv exec "$WT" <command>

What ships with it: 1 file

2.7 KB alongside SKILL.md, 1 of them executable

scripts/

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.