worktree
Parallel development using git worktrees — work on multiple branches simultaneously
What this skill does
# Worktree Command
You manage parallel development using git worktrees. Worktrees let you work on multiple branches simultaneously without stashing or switching — each worktree is an independent checkout of the repo.
**Arguments:** $ARGUMENTS
## Phase 1: Parse Arguments & Detect Intent
```bash
ARGS="$ARGUMENTS"
# Detect subcommand
case "$ARGS" in
list|ls)
SUBCOMMAND="list"
;;
clean|prune)
SUBCOMMAND="clean"
;;
remove\ *|rm\ *)
SUBCOMMAND="remove"
TARGET=$(echo "$ARGS" | sed 's/^remove //;s/^rm //')
;;
*)
SUBCOMMAND="create"
TARGET="$ARGS"
;;
esac
echo "Subcommand: $SUBCOMMAND"
echo "Target: ${TARGET:-N/A}"
```
## Phase 2: Execute
### If `list`:
```bash
echo "=== Active Worktrees ==="
git worktree list
echo ""
echo "=== Branches in Worktrees ==="
git worktree list --porcelain | grep "^branch" | sed 's/branch refs\/heads\// /'
```
### If `clean`:
```bash
echo "=== Pruning stale worktrees ==="
git worktree prune --verbose
echo ""
echo "=== Remaining worktrees ==="
git worktree list
```
### If `remove`:
```bash
echo "=== Removing worktree: $TARGET ==="
# Find the worktree path
WORKTREE_PATH=$(git worktree list | grep "$TARGET" | awk '{print $1}')
if [ -z "$WORKTREE_PATH" ]; then
echo "Worktree '$TARGET' not found. Available worktrees:"
git worktree list
exit 1
fi
# Check for uncommitted changes
if [ -d "$WORKTREE_PATH" ]; then
cd "$WORKTREE_PATH"
if ! git diff --quiet 2>/dev/null || ! git diff --cached --quiet 2>/dev/null; then
echo "WARNING: Worktree has uncommitted changes!"
echo "Use AskUserQuestion to confirm before removing."
fi
cd -
fi
```
Use AskUserQuestion to confirm removal if there are uncommitted changes. Then:
```bash
git worktree remove "$WORKTREE_PATH"
echo "Worktree removed."
```
### If `create`:
```bash
# Parse target — could be "issue-number" or "branch-name" with optional base
if [[ "$TARGET" =~ ^[0-9]+$ ]]; then
# Issue number — create branch from issue
ISSUE_NUMBER="$TARGET"
ISSUE_TITLE=$(gh issue view "$ISSUE_NUMBER" --json title --jq '.title' 2>/dev/null | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | cut -c1-40)
BRANCH_NAME="feature/${ISSUE_NUMBER}-${ISSUE_TITLE}"
echo "Creating worktree for issue #$ISSUE_NUMBER"
else
BRANCH_NAME="$TARGET"
echo "Creating worktree for branch: $BRANCH_NAME"
fi
# Determine base branch
DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name' 2>/dev/null || echo "main")
BASE_BRANCH="${2:-$DEFAULT_BRANCH}"
# Create worktree directory
WORKTREE_DIR=".worktrees/$(basename "$BRANCH_NAME")"
mkdir -p "$(dirname "$WORKTREE_DIR")"
echo "Branch: $BRANCH_NAME"
echo "Base: $BASE_BRANCH"
echo "Path: $WORKTREE_DIR"
git worktree add -b "$BRANCH_NAME" "$WORKTREE_DIR" "$BASE_BRANCH" 2>/dev/null || \
git worktree add "$WORKTREE_DIR" "$BRANCH_NAME" 2>/dev/null
echo ""
echo "=== Worktree created ==="
echo "Path: $(pwd)/$WORKTREE_DIR"
echo "Branch: $BRANCH_NAME"
echo ""
echo "To work in this worktree:"
echo " cd $WORKTREE_DIR"
echo ""
echo "Active worktrees:"
git worktree list
```
## Phase 3: Summary
Present the result clearly:
```markdown
### Worktree [Action]
- **Path:** [worktree path]
- **Branch:** [branch name]
- **Base:** [base branch]
- **Status:** [created / listed / removed / pruned]
**Tip:** Each worktree is a full checkout. You can run `/work`, `/test`, or any other command inside it independently.
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.