agentsclimarketplace

Setup worktree

Skill mauriciovieira/skills/skills/engineering/setup-worktree

Skills for real engineers - not vibe coding

Install
npx -y skills add mauriciovieira/skills --skill setup-worktree

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

One thing to look at

  • 1 stars1 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 the user is in a linked git worktree and needs to bootstrap it from the main repo - symlinks language-agnostic dependency directories (node_modules, .venv, vendor, target, deps) and copies env files. Trigger phrases include "setup worktree", "/setup-worktree", "bootstrap worktree", or when the user just created a worktree and wants to install/run dev.

SKILL.md

3.5 KB, as published. Nobody here has run it

setup-worktree

Bootstrap a linked git worktree from its main repo without re-installing dependencies. Language-agnostic: detects manifests (package.json, pyproject.toml, requirements.txt, Pipfile, setup.py, Gemfile, go.mod, Cargo.toml, composer.json, mix.exs) and symlinks the matching deps dir from main if it exists.

What it does

For each manifest found in the main repo, symlinks the corresponding deps dir into the worktree at the same relative path:

ManifestDeps dir candidates (every one that exists in main is linked)
package.jsonnode_modules
pyproject.toml / requirements.txt / Pipfile / setup.py.venv, venv, env
Gemfilevendor/bundle, .bundle
go.modvendor
Cargo.tomltarget
composer.jsonvendor
mix.exsdeps, _build

Env files copied (not linked, since they may diverge per branch): .env, .env.local, .env.development, .env.test.

When to use

  • User just ran git worktree add .worktrees/<name> and wants to start working without npm ci / bundle install / pip install again.
  • User says "set up the worktree", "/setup-worktree", "bootstrap this worktree".
  • Worktree is missing .env / node_modules / .venv / vendor and the main repo has them.

When NOT to use

  • Inside the main repo (script refuses — exits with error).
  • When deps in main repo are stale or for a different branch's lockfile. In that case, install fresh in the worktree instead.
  • For deps that the language prefers per-checkout (e.g., Rust's target may bloat — user can rm the symlink if they want isolation).

How to invoke

~/.claude/skills/setup-worktree/setup-worktree.sh

Or via slash command: /setup-worktree (alias defined in ~/.claude/commands/setup-worktree.md).

Run from inside the worktree (any subdirectory works — script resolves the worktree root via git rev-parse --show-toplevel).

Safety

  • Refuses to run outside a linked worktree (compares git rev-parse --git-common-dir against --git-dir).
  • Never overwrites existing files or symlinks in the worktree.
  • Skips deps dirs that don't exist in main (no broken symlinks).
  • Idempotent: rerunning is a no-op when everything is already linked/copied.

Repo-level Makefile integration

Repos that previously had a hand-rolled setup-worktree Make target should replace it with a thin wrapper:

setup-worktree:
	@~/.claude/skills/setup-worktree/setup-worktree.sh

If the script isn't installed (other contributors not using this skill), the Make target should fall back to a clear error message pointing at the skill repo.

Common mistakes

  • Running from main repo: Script refuses with not in a linked worktree. Run from inside .worktrees/<name>/ instead.
  • Expecting deps to be copied: They're symlinked. Modifying them affects main. To isolate, replace the symlink with a real install.
  • Stale lockfile: Symlinked node_modules reflects main's last install. If your branch changes package.json, run a fresh install in the worktree (which will replace the symlink with a real dir).

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.