wt

Set up git worktrees with automatic env file copying, shared service linking, env patching, baseline test verification, and dependency installation. Use when the user wants to create a .wtsetup config for their project, install the wt shell function, or manage worktree workflows. Triggers on mentions of worktrees, .wtsetup, or requests to configure worktree setup for a repo.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "wt" with this command: npx skills add data-diego/worktree-setup-skill/data-diego-worktree-setup-skill-wt

wt — Git Worktree Setup

Generate a .wtsetup config and provide a wt shell function so new worktrees get env files copied, values patched to avoid conflicts, shared resources symlinked, dependencies installed, and baseline tests verified.

.wtsetup Format

copy=(                    # Files copied to each new worktree
  ".env.local"
  "config/master.key"
)
link=(                    # Symlinked (shared across worktrees, e.g. Docker volumes)
  "pgdata"
)
patch_keys=(              # Env keys that get branch suffix appended to avoid conflicts
  "DATABASE_URL"          # e.g. myapp_dev → myapp_dev_my-feature
  "DB_NAME"
)
install="bundle install"  # Dependency install command
post_setup="bundle exec rspec"  # Baseline verification after setup
# dev="bin/dev"           # Informational hint

Workflow

1. Generate .wtsetup

Run the analysis script against the project root:

bash <skill-path>/scripts/analyze-project.sh <project-root>

Detects:

  • .env*, master.key, credentials.yml.enc, .secret*copy=()
  • Docker Compose volume mounts → link=()
  • DATABASE_URL, DB_NAME, DB_DATABASE, REDIS_URL, PORT, APP_PORT in env files → patch_keys=()
  • Lockfiles → install="" (supports: bundler, pnpm, npm, yarn, bun, pip, poetry, go, cargo, mix, composer)
  • Test commands → post_setup="" (supports: rspec, rails test, pytest, go test, cargo test, mix test, phpunit, pnpm/npm/yarn/bun test)
  • Dev commands (Procfile.dev, bin/dev, Procfile) → commented dev="" hint
  • Warns if .wtsetup is not in the global gitignore

After running, show the generated .wtsetup and ask the user to review. Common adjustments:

  • Add custom files to copy=() (e.g. config/database.yml, .tool-versions)
  • Add shared dirs to link=() (e.g. Docker volumes, large asset dirs)
  • Add/remove keys from patch_keys=() depending on what needs isolation per worktree
  • Comment out post_setup if tests are slow or not needed every time

If .wtsetup is not in the user's global gitignore, offer to add it:

echo '.wtsetup' >> ~/.config/git/ignore
git config --global core.excludesfile ~/.config/git/ignore

This is preferred over per-repo .gitignore since .wtsetup is a local concern like .env.local.

2. Install the wt shell function

Detect the user's shell from $SHELL and install the matching function:

ShellSource fileInstall to
zshreferences/wt.bashAppend to ~/.zshrc
bashreferences/wt.bashAppend to ~/.bashrc
fishreferences/wt.fishWrite to ~/.config/fish/functions/wt.fish

Only install if wt is not already defined in the target file.

The function:

  • Takes a branch name and optional target directory: wt <branch> [target-dir]
  • Auto-detects the main worktree
  • Creates <repo>-<branch> next to the main worktree (or inside target-dir if provided)
  • Copies files from copy=(), creating intermediate directories
  • Appends a sanitized branch slug to values of patch_keys=() in copied env files
  • Symlinks paths from link=()
  • Runs the install command
  • Runs post_setup to verify clean baseline (warns but doesn't abort on failure)
  • Errors clearly if no .wtsetup exists

3. Verify

Suggest the user test with:

source ~/.zshrc  # or: source ~/.bashrc / restart fish
wt test-branch

Then clean up: git worktree remove <path>.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

wt

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

clinic-visit-prep

帮助患者整理就诊前问题、既往记录、检查清单与时间线,不提供诊断。;use for healthcare, intake, prep workflows;do not use for 给诊断结论, 替代医生意见.

Archived SourceRecently Updated
Automation

changelog-curator

从变更记录、提交摘要或发布说明中整理对外 changelog,并区分用户价值与内部改动。;use for changelog, release-notes, docs workflows;do not use for 捏造未发布功能, 替代正式合规审批.

Archived SourceRecently Updated