AgentStack
SKILL verified MIT Self-run

Worktrees

skill-hnikoloski-imlazy-imlazy-worktrees · by hnikoloski

Use when starting feature work that needs isolation from current workspace or before executing implementation plans — ensures an isolated workspace exists via native tools or git worktree fallback

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-hnikoloski-imlazy-imlazy-worktrees

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README — it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-hnikoloski-imlazy-imlazy-worktrees)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
today

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming — see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps — measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Worktrees? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

worktrees

Overview

Ensure work happens in an isolated workspace. Prefer your platform's native worktree tools. Fall back to manual git worktrees only when no native tool is available.

Core principle: Detect existing isolation first. Then use native tools. Then fall back to git. Never fight the harness.

Step 0: Detect existing isolation

Before creating anything, check if you are already in an isolated workspace.

GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)

Submodule guard: GIT_DIR != GIT_COMMON is also true inside git submodules. Verify you're not in one:

git rev-parse --show-superproject-working-tree 2>/dev/null

If that returns a path, you are in a submodule — treat as normal repo.

If GIT_DIR != GIT_COMMON (and not a submodule): Already in a linked worktree. Skip to Step 3 (Project Setup). Do NOT create another worktree.

If GIT_DIR == GIT_COMMON: Normal repo checkout. Ask for consent before creating a worktree: "Would you like me to set up an isolated worktree? It protects your current branch from changes." If declined, work in place.

Step 1: Create isolated workspace

Try in this order:

1a. Native worktree tools (preferred)

Check if your harness provides a native worktree tool (names like EnterWorktree, WorktreeCreate, /worktree, or a --worktree flag). If yes, use it and skip to Step 3. Native tools handle directory placement, branch creation, and cleanup automatically.

1b. Git worktree fallback (only if 1a does not apply)

Directory selection (priority order):

  1. Declared user preference in your instructions
  2. Existing project-local .worktrees/ or worktrees/ directory
  3. Existing global ~/.config/imlazy/worktrees//
  4. Default: .worktrees/ at project root

Safety verification (project-local directories only):

git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null

If NOT ignored: add to .gitignore, commit, then proceed.

Create the worktree:

project=$(basename "$(git rev-parse --show-toplevel)")
git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"

If git worktree add fails with a permission error (sandbox denial), tell the user and work in the current directory instead.

Step 3: Project setup

Auto-detect and run appropriate setup:

if [ -f package.json ]; then npm install; fi
if [ -f Cargo.toml ]; then cargo build; fi
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
if [ -f go.mod ]; then go mod download; fi

Step 4: Verify clean baseline

Run the project test suite. If tests fail, report failures and ask whether to proceed or investigate. If tests pass, report ready.

Quick reference

| Situation | Action | |-----------|--------| | Already in linked worktree | Skip creation (Step 0) | | In a submodule | Treat as normal repo | | Native worktree tool available | Use it (Step 1a) | | No native tool | Git worktree fallback (Step 1b) | | .worktrees/ exists | Use it (verify ignored) | | Neither exists | Default .worktrees/ at project root | | Directory not ignored | Add to .gitignore + commit | | Permission error on create | Work in place, tell user | | Tests fail on baseline | Report + ask before proceeding |

Red flags — never

  • Create a worktree when Step 0 detects existing isolation
  • Use git worktree add when you have a native worktree tool
  • Create project-local worktree without verifying it is gitignored
  • Skip baseline test verification
  • Proceed with failing tests without asking

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.