Skip to content
Back to skills

New Worktree

ASecurity

Create an isolated git worktree under .claude/worktrees/ for a sub-agent to work in. Use this before dispatching any coder agent so that parallel work cannot collide.

  • 7 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 23, 2026
ai-agentsbashgitfrontendbackendfullstack

Works with

  • cli

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 23, 2026

npx -y skills add mcorbett51090/RavenClaude --skill new-worktree --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of New Worktree?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for New Worktree
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mcorbett51090-new-worktree/badge)](https://www.skillsdirectory.com/skills/mcorbett51090-new-worktree)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: new-worktree
description: Create an isolated git worktree under .claude/worktrees/ for a sub-agent to work in. Use this before dispatching any coder agent so that parallel work cannot collide.
---

# Skill: new-worktree

> **Labeling (Sleipnir):** in user-facing prose, call this "sending **Sleipnir** to that branch" — the worktree-traversal labeling convention (see `ravenclaude-core/CLAUDE.md` → "Sleipnir"). Labeling only; the mechanics below (`git worktree`) are unchanged.

## Inputs
- `role` — one of: `architect`, `backend-coder`, `frontend-coder`, `fullstack-coder`, `tester`.
- `slug` — short kebab-case identifier of the task (e.g. `auth-refresh`, `nav-redesign`).
- `base` — branch to fork from. Default: `main`.

## Procedure
1. **Validate inputs.** Slug must match `^[a-z0-9][a-z0-9-]{1,40}$`. Reject otherwise.
2. **Resolve paths.**
   - Path: `.claude/worktrees/<role>-<slug>/`
   - Branch: `agent/<role>/<slug>`
3. **Refuse if either exists.** If the path or branch already exists, surface it — do not silently reuse. The Team Lead must decide whether to clean up the old one or pick a new slug.
4. **Sync base.** `git fetch origin <base>` so the worktree starts from current upstream.
5. **Create the worktree.**
   ```bash
   git worktree add -b agent/<role>/<slug> .claude/worktrees/<role>-<slug> origin/<base>
   ```
6. **Install dependencies if needed.** If the project requires a per-tree install (e.g. `pnpm install`), run it once in the new worktree before handing off.
7. **Report the path and branch back to the Team Lead.** The Team Lead then briefs the agent and points it at this directory.

## Peer-process / IDE

After create, write the lane stamp (`plugins/ravenclaude-core/scripts/write-lane-stamp.sh <dest> <task> <branch> <created_by>`) and open a **dedicated** VS Code window (`rcwt new` / `code -n <path>`). Never add the new worktree as a second folder in an existing window — multi-root pools Chat context. Do not restyle the sub-agent procedure above.

## Cleanup
Worktrees are NOT auto-removed. Use [`cleanup-worktrees`](../cleanup-worktrees/SKILL.md) when the task is integrated.


## Codex managed worktrees (DOC adapt 2026-09-20 — UNVERIFIED)
This skill creates RavenClaude / Sleipnir agent worktrees under `.claude/worktrees/`. Codex 0.155 **managed** worktrees are owned by the Codex agents overview / app-server daemon lane — different product, different delete path. Do not treat overview-managed trees as Sleipnir stables; prefer overview confirmed-delete for Codex-managed trees (see `knowledge/codex-cli-customization.md`).

## Why this exists
Two parallel coder agents on the same working tree will silently corrupt each other's diffs. Worktrees are cheap; recovery from a stomped diff is not.

## Why a skill, when the Agent tool has built-in `isolation: "worktree"`?
The Agent tool's native worktree isolation is a one-off, ephemeral worktree that gets cleaned up automatically when the sub-agent makes no changes. This skill is for the Team Lead's *managed* worktrees that persist across sub-agent runs: predictable paths under `.claude/worktrees/<role>-<slug>/`, predictable branch names `agent/<role>/<slug>`, and tracked by [`cleanup-worktrees`](../cleanup-worktrees/SKILL.md) so they don't accumulate silently. Use the native isolation for fire-and-forget exploration; use this skill when the worktree is part of a multi-step Team Lead workflow that needs to be visible to subsequent agents.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…