worktrees

Orchestrates Git worktrees as isolated coding lanes for parallel and risky development work.

1|Updated Jul 23, 2026
One-click install
npx skills add https://github.com/sanjanb/my-agent-harness --skill worktrees-sanjanb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktrees
Source: https://github.com/sanjanb/my-agent-harness/tree/main/skills/worktrees
Command: npx skills add https://github.com/sanjanb/my-agent-harness --skill worktrees-sanjanb

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing parallel branches, risky refactors, or background agent tasks in a single Git checkout leads to context switching, half-committed work, and broken working environments. This Skill provides a safe, structured protocol for creating and managing Git worktrees as isolated coding lanes. ## Core Features & Use Cases - Isolated Lane Management: Creates worktrees under .slim/worktrees/<slug>/ with tracked metadata in .slim/worktrees.json for structural lane tracking. - Safety Guardrails: Enforces pre-flight checks, mandatory user confirmation before destructive Git operations, and managed .gitignore/.ignore blocks. - Full Lifecycle Workflow: Covers planning, delegation to sub-agents, diff validation, integration, and cleanup across four defined phases. - Use Case: You need to refactor an authentication flow while keeping your main checkout stable. The Orchestrator creates a worktree lane, assigns a sub-agent to work inside it, validates the diff against the base branch, and merges only after your approval. ## Quick Start Ask the agent to create a worktree lane for your next risky refactor or parallel task using the worktrees skill.

Frequently Asked Questions about worktrees

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Git worktrees for parallel development?

Create a worktree with `git worktree add -b <branch> .slim/worktrees/<slug> <base>` to get an isolated checkout on a new branch. Each lane gets its own working directory, so agents can work in parallel without touching the main checkout.

When should I use Git worktrees instead of branches?

Use worktrees for risky refactors, parallel tasks, background agents, or exploratory spikes that need isolated working directories. Skip them for simple single-file changes, documentation updates, or minor bug fixes where a normal branch suffices.

Can multiple agents work in separate Git worktrees safely?

Yes, each sub-agent runs with its working directory set to its own worktree path, keeping builds and edits isolated. Track file ownership per lane to avoid merge conflicts between parallel agents.

Why does git worktree remove fail on my lane?

Removal fails when the worktree has uncommitted changes or untracked files. Commit or stash changes first, verify the lane is clean, then run `git worktree remove` after confirming the operation.

How do I clean up stale Git worktrees?

Confirm all changes are merged or archived, verify no uncommitted changes remain, then run `git worktree remove <path>` and update the tracking manifest. Use `git worktree prune` only with explicit approval for stale administrative entries.