isolate
Use when starting task work that needs branch isolation, before planning or coding — creates a worktree branching from current remote main with freshness verification and project setup
What this skill does
# Isolate
Create a worktree branched from the latest `origin/main` so task work never starts on stale code.
**Announce:** "Setting up an isolated worktree for this task."
## Inputs
- **Branch name:** from `/orient` Step 1 (e.g., `feat/auth`, `fix/login-crash`). Ask if not provided.
- **Base ref:** the current branch's parent (detected via reflog, default `main`). Override only when explicitly stacking on a different branch.
## Detect parent branch
The parent branch (what this branch will eventually merge into) is determined from the reflog:
```bash
PARENT_BRANCH=$(
git reflog show HEAD --pretty=format:'%gs' \
| grep "^branch: Created from" \
| head -1 \
| sed 's/branch: Created from //' \
| sed 's|^origin/||'
)
PARENT_BRANCH=${PARENT_BRANCH:-main}
```
Returns empty when the branch was created from a detached HEAD or in a web session with no reflog — falls back to `main`. Correct 99% of the time for normal local development.
## Already in a Worktree?
If the session CWD is already inside a linked worktree (not the primary), freshen the branch instead of creating a new one:
```bash
WORKTREE="<absolute-path-to-current-worktree>"
git -C "$WORKTREE" fetch origin "$PARENT_BRANCH"
git -C "$WORKTREE" merge "origin/$PARENT_BRANCH"
```
If conflicts arise, stop and present them to the user. Do not auto-resolve.
After freshening, skip ahead to **Baseline test**.
## Step 1: Select directory
| Priority | Check | Action |
|----------|-------|--------|
| 1 | `.worktrees/` exists | Use it |
| 2 | `worktrees/` exists | Use it |
| 3 | Both exist | `.worktrees/` wins |
| 4 | CLAUDE.md specifies | Follow preference |
| 5 | None found | Ask user (`.worktrees/` recommended) |
## Step 2: Verify gitignored
```bash
git check-ignore -q .worktrees
```
If NOT ignored, fix before proceeding:
```bash
echo ".worktrees" >> .gitignore
git add .gitignore
git commit -m "chore: gitignore worktree directory"
```
## Step 3: Fetch and create
A worktree branched from a stale local parent means baked-in merge conflicts. Always fetch first, always branch from `origin/$PARENT_BRANCH` (not the local copy).
```bash
REPO_ROOT="$(git rev-parse --show-toplevel)"
WORKTREE_DIR="$REPO_ROOT/.worktrees/<name>"
git fetch origin "$PARENT_BRANCH"
git worktree add "$WORKTREE_DIR" -b <prefix>/<name> "origin/$PARENT_BRANCH"
```
Lock the worktree immediately so `git worktree prune` doesn't sweep it during long-running agent sessions. Run from the **main repo context** (not the worktree):
```bash
git -C "$REPO_ROOT" worktree lock --reason "Agent session in progress" "$WORKTREE_DIR"
```
`/ship` will unlock before removing the worktree at the end of the task.
Claude Code: optionally call `EnterWorktree({path})` to move session CWD into the new worktree.
## Step 4: Install dependencies
Auto-detect from manifest files:
| File | Command |
|------|---------|
| `pnpm-lock.yaml` | `pnpm install` |
| `yarn.lock` | `yarn install` |
| `package-lock.json` | `npm install` |
| `package.json` (no lockfile) | Ask before installing |
| `Cargo.toml` | `cargo build` |
| `requirements.txt` | `pip install -r requirements.txt` |
| `pyproject.toml` | `poetry install` |
| `go.mod` | `go mod download` |
Run from the worktree path: `pnpm --dir "$WORKTREE_DIR" install`
## Step 5: Baseline test
Run the project's test suite. If tests fail, report failures and ask whether to proceed. Do not silently continue.
## Report
```
Worktree ready at <absolute-path>
Branch: <prefix>/<name> (from origin/main @ <short-sha>)
Tests: <N> passing
```
## Path Discipline
`cd` does not persist between Claude Code Bash calls. Use absolute paths for all file operations and `git -C <abs-path>` for git commands.
## Integration
**Called by:** /task (Step 2), /brainstorming, /build
**Pairs with:** /ship (cleans up worktree after work is done)
Related in Productivity
gitea-workflow
IncludedOrchestrate agile development workflows for Gitea repositories using the tea CLI. Use when working with Gitea-hosted repos and asking to 'run the workflow', 'continue working', 'what's next', 'complete the task cycle', 'start my day', 'end the sprint', 'implement the next task', or wanting guided step-by-step development assistance. Keywords: workflow, orchestrate, agile, task cycle, sprint, daily, implement, review, PR, standup, retrospective, gitea, tea.
microsoft-graph-gateway
IncludedRoute Microsoft Graph work in this workspace. Use when users want to read or write Outlook mail, calendar events, contacts, OneDrive or SharePoint files, Teams, Planner, To Do, users, groups, directory data, or arbitrary Microsoft Graph endpoints from VS Code. Prefer WorkIQ for common read scenarios. Use Microsoft Graph for write actions and gap-read scenarios that need exact Graph properties, filters, permissions, or endpoints.
copilotkit
IncludedUse when building with CopilotKit — setup, development, integrations, debugging, upgrading, or contributing. Routes to the appropriate specialized skill based on the task.
wordly-wisdom
IncludedProvides calibrated decision analysis using Charlie Munger-style multiple mental models, inversion, incentive mapping, circle-of-competence checks, misjudgment audits, second-order effects, and forecast updates. Use when the user asks for an oracle take, a hard call, a decision memo, a premortem, an outside view, a red-team, a sanity-check, what am I missing, think this through, or wants a strategy, hire, investment, plan, product, partnership, or major life choice analysed. Avoid for simple factual lookups or time-sensitive legal, medical, or market questions without fresh evidence.
swain-session
IncludedSession management and project status dashboard. Owns the full session lifecycle (start/work/close/resume), focus lane, bookmarks, worktree detection, and tab naming. Also serves as the project status dashboard — shows active epics, progress, actionable next steps, blocked items, tasks, GitHub issues, and recommendations. Worktree creation is deferred to swain-do task dispatch (SPEC-195). Triggers on: 'session', 'status', 'what's next', 'dashboard', 'overview', 'where are we', 'what should I work on', 'show me priorities', 'bookmark', 'focus on', 'session info'.
gandi
IncludedComprehensive Gandi domain registrar integration for domain and DNS management. Register and manage domains, create/update/delete DNS records (A, AAAA, CNAME, MX, TXT, SRV, and more), configure email forwarding and aliases, check SSL certificate status, create DNS snapshots for safe rollback, bulk update zone files, and monitor domain expiration. Supports multi-domain management, zone file import/export, and automated DNS backups. Includes both read-only and destructive operations with safety controls.