← ClaudeAtlas

worktree-bootstraplisted

Use immediately after `git worktree add` or `git gtr new` creates a fresh worktree for any repo (a web/Next app, a Node/TypeScript backend, a Python data/ETL project, an Android/Gradle app, or anything else) and it won't run or build because .gitignored env files and installed dependencies weren't carried over. Fire when the user says "set up the worktree", "the new worktree won't build/run", "missing .env in the worktree", "node_modules is missing", "gradle can't find the SDK / local.properties", or a dev server errors on missing env vars right after a worktree is created. Skip when the repo ships its own bootstrap skill — that one knows its extra credential files and hooks. Skip if the worktree has already run once.
damson/hard-won-skills · ★ 1 · Data & Documents · score 67
Install: claude install-skill damson/hard-won-skills
# Bootstrap a fresh worktree (generic) A new worktree shares the repo's git history but is a **separate working tree** on disk. Two classes of thing do NOT come across, and both cause confusing first-run failures: 1. **.gitignored config** — `.env`, `.env.local`, service credentials, local settings. The app boots, then errors on a missing variable that "works on the other branch". 2. **Installed dependencies and generated artifacts** — `node_modules/`, a Python `.venv/`, Prisma/codegen output. These are gitignored or per-tree, so a fresh worktree has none. This skill copies the first from a donor worktree and rebuilds the second for the detected stack, so the next `dev`/`build`/`test` works on the first try. It covers what any repo needs; where a repo ships its own bootstrap skill, defer to that instead — it will know the extra credential files, submodules and hooks this one deliberately omits. ## Procedure ### 1. Detect the stack From the worktree root: ```bash ls package.json pnpm-lock.yaml yarn.lock package-lock.json \ pyproject.toml poetry.lock requirements.txt go.mod \ settings.gradle settings.gradle.kts build.gradle gradlew 2>/dev/null ``` | Signal | Stack | Dep install | Common gitignored config | |---|---|---|---| | `pnpm-lock.yaml` | Node (pnpm) | `pnpm install` | `.env`, `.env.local`, `.env.*.local` | | `package-lock.json` | Node (npm) | `npm ci` | `.env`, `.env.local` | | `yarn.lock` | Node (yarn) | `yarn install --immutable` | `.env`, `.env.local` |