using-git-worktrees
Use when starting new feature work to create isolated git worktrees with smart directory selection and safety verification. Keeps main branch clean while developing.
What this skill does
# Using Git Worktrees ## Core Principle **Isolate feature work. Keep main clean.** Git worktrees let you work on multiple branches simultaneously in separate directories. ## When to Use - Starting a new feature - Working on a bugfix while main development continues - Need to context-switch without stashing - Want clean separation between work streams ## Setup Process ### Step 1: Check for Existing Worktree Directory ```bash # Check in priority order ls -d .worktrees 2>/dev/null # Preferred (hidden) ls -d worktrees 2>/dev/null # Alternative ``` If found: Use that directory. If both exist: `.worktrees` wins. ### Step 2: Check CLAUDE.md for Preferences ```bash grep -i "worktree.*director" CLAUDE.md 2>/dev/null ``` If preference specified: Use it without asking. ### Step 3: If No Directory Exists Ask the user: ``` No worktree directory found. Where should I create worktrees? 1. .worktrees/ (project-local, hidden) 2. worktrees/ (project-local, visible) 3. ~/.config/superpowers/worktrees/<project-name>/ (global location) Which would you prefer? ``` ### Step 4: Verify .gitignore ```bash # Check if directory pattern in .gitignore grep -q "^\.worktrees/$" .gitignore || grep -q "^worktrees/$" .gitignore ``` If not present, add it: ```bash echo ".worktrees/" >> .gitignore # or echo "worktrees/" >> .gitignore ``` ## Creating a Worktree ### Standard Creation ```bash # Determine branch name from feature BRANCH_NAME="feature/descriptive-name" # Create worktree with new branch git worktree add ".worktrees/$BRANCH_NAME" -b "$BRANCH_NAME" # Navigate to worktree cd ".worktrees/$BRANCH_NAME" ``` ### From Existing Branch ```bash git worktree add ".worktrees/$BRANCH_NAME" "$BRANCH_NAME" ``` ## Post-Creation Setup ### Install Dependencies ```bash # Node.js if [ -f package.json ]; then npm install; fi # Rust if [ -f Cargo.toml ]; then cargo build; fi # Python if [ -f requirements.txt ]; then pip install -r requirements.txt; fi if [ -f pyproject.toml ]; then poetry install; fi # Go if [ -f go.mod ]; then go mod download; fi ``` ### Run Initial Tests ```bash # Run test suite npm test # or appropriate command # Report status ``` If tests fail: Report failures, ask whether to proceed or investigate. If tests pass: Report ready. ## Worktree Management ### List Worktrees ```bash git worktree list ``` ### Remove Worktree ```bash # After merging feature branch git worktree remove ".worktrees/feature/branch-name" # Force remove (if needed) git worktree remove --force ".worktrees/feature/branch-name" ``` ### Prune Stale Worktrees ```bash git worktree prune ``` ## Best Practices ### Naming Convention - `feature/descriptive-name` for features - `bugfix/issue-number-description` for bugs - `hotfix/critical-issue` for urgent fixes ### Keep Worktrees Focused - One feature per worktree - Merge and remove when done - Don't let worktrees accumulate ### Sync Regularly ```bash # In worktree, get latest from main git fetch origin git rebase origin/main ``` ## Completion Checklist When feature is complete: 1. [ ] All tests pass 2. [ ] Code reviewed 3. [ ] Merged to main 4. [ ] Worktree removed 5. [ ] Branch deleted (if desired) ```bash # Full cleanup git checkout main git pull git worktree remove ".worktrees/feature/name" git branch -d feature/name ``` ## Announcement Template At start of worktree creation: ``` "I'm using the using-git-worktrees skill to set up an isolated workspace for [feature name]." ``` On completion: ``` "Worktree ready at [full-path] Tests passing ([N] tests, 0 failures) Ready to implement [feature-name]" ```
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.