worktree-ops

worktree-ops is a skill for Claude Code from krzysztofsurdy/code-virtuoso. It costs 61 tokens per session (1,956 once invoked), scanned A, original, MIT.

A tool for managing Git worktrees, which are separate working folders for different branches of the same repository. They let you work on several branches at once without making extra full clones.

In plain words
What is it for?
Use it to create, list, switch between, and safely remove worktrees when working on multiple branches or coding sessions.
Why use it?
It keeps parallel tasks, code reviews, and experiments isolated, while checking for uncommitted work or unpushed commits before cleanup.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the playbooks-virtuoso plugin — 5 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/krzysztofsurdy/code-virtuoso/worktree-ops
Any agent
npx skills add krzysztofsurdy/code-virtuoso --skill worktree-ops
Clone the repo
git clone --depth 1 https://github.com/krzysztofsurdy/code-virtuoso

Made for: Claude Code.

Or install playbooks-virtuoso, the plugin that ships this one along with the rest of its 5 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for worktree-ops

README.md
[![agentmods](https://agentmods.dev/badge/skills/krzysztofsurdy/code-virtuoso/worktree-ops.svg)](https://agentmods.dev/skills/krzysztofsurdy/code-virtuoso/worktree-ops)
Your own site
<a href="https://agentmods.dev/skills/krzysztofsurdy/code-virtuoso/worktree-ops"><img src="https://agentmods.dev/badge/skills/krzysztofsurdy/code-virtuoso/worktree-ops.svg" alt="Measured on agentmods" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,956 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00061 $0.01956
Opus 5 $0.00030 $0.00978
Sonnet 5 $0.00012 $0.00391
Haiku 4.5 $0.00006 $0.00196

Measured 6d ago against content hash cb1d0e2569a8, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

worktree-ops scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/playbooks/worktree-ops/SKILL.md · 181 lines

How it starts

The opening of the file, as written. The whole thing — 181 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Worktree Management

Git worktrees let you check out multiple branches of the same repository into separate directories simultaneously. Each worktree has its own working directory and index while sharing the same .git object store and history. This is useful for running parallel development sessions, reviewing a PR while mid-feature, or isolating experimental changes without stashing or committing half-finished work.

Core Principles

Principle Meaning
Isolation without duplication Worktrees share git history but keep working directories separate - no need to clone the repo again
Safety first Always check for uncommitted changes and unpushed commits before removing a worktree
Clean up after yourself Stale worktree entries and orphaned branches accumulate - prune regularly
Convention over configuration Use a consistent directory layout (.worktrees/<name>/) and branch naming (worktree-<name>)

Quick Reference

Command What it does When to use
git worktree add <path> -b <branch> Create a new worktree with a new branch Starting parallel work on a new task
git worktree list Show all worktrees with their branches and paths Checking what is active
git worktree list --porcelain Machine-readable worktree listing Scripting or enriching with status info
git worktree remove <path> Remove a worktree directory and its admin files Done with a parallel task
git worktree remove <path> --force Force-remove even with uncommitted changes After explicit user confirmation
git worktree prune Clean up stale worktree entries After manual directory deletion or errors
git branch -D worktree-<name> Delete the orphaned branch after worktree removal Keeping branches clean

Create

Create a new worktree for an isolated parallel development session.

Workflow

  1. Confirm the current directory is a git repository.
  2. Confirm the current session is NOT already inside a worktree:
    git rev-parse --is-inside-work-tree && git worktree list
    
    If the current working directory is already a worktree (not the main working tree), warn the user and stop.
  3. If a name was provided as an argument, use it. Otherwise, present an interactive prompt (or the platform's equivalent): "What name should I use for this worktree? (e.g., feature-auth, bugfix-123)"
  4. Create the worktree:
    git worktree add .worktrees/<name> -b worktree-<name>
    
  5. Change your working directory to the new worktree path.
  6. Report to the user:
    Worktree created:
      Directory: .worktrees/<name>/
      Branch: worktree-<name>
      Based on: <current HEAD>
    
  7. Remind the user:
    • Run your stack's dependency installation command (e.g., composer install, npm install, pip install -r requirements.txt)
    • The worktree shares git history with the main repo but has its own working directory
    • Use the list command to see all active worktrees
    • Use the remove command to clean up when done

Read the full file on GitHub · 181 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 181 lines · 61 tokens per session scan A cb1d0e2569a8

Subscribe to this mod's changes

worktree-ops is a skill published in the GitHub repository krzysztofsurdy/code-virtuoso (20 stars, last pushed 3mo ago), licensed MIT. It adds 61 tokens to every session and 1,956 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

code-history

Trace the git history of specific code — when a function, pattern, or file was added, modified, or removed, and the intent behind each change. Use when the user asks when or why a piece of code changed, wants the evolution of a function, or needs the commit or PR that introduced a behavior. Read-only; not for plain…

2ykwang/agent-skills · 82 tokens

quick-pr

Split a minor change from the current work into a separate worktree and open a PR without interrupting your flow. Use when an unrelated small fix (typo, lint rule, config tweak) is sitting in a feature branch and the user wants it shipped on its own — "quick PR", "split this out", "ship this separately". Requires…

2ykwang/agent-skills · 89 tokens

openclaw-parallels-smoke

End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip…

SafeAI-Lab-X/ClawKeeper · 85 tokens

openclaw-ghsa-maintainer

Maintainer workflow for OpenClaw GitHub Security Advisories (GHSA). Use when Codex needs to inspect, patch, validate, or publish a repo advisory, verify private-fork state, prepare advisory Markdown or JSON payloads safely, handle GHSA API-specific publish constraints, or confirm advisory publish success.

SafeAI-Lab-X/ClawKeeper · 71 tokens

openclaw-release-maintainer

Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.

SafeAI-Lab-X/ClawKeeper · 64 tokens

write-pr

Draft a pull request title and body from the current branch's diff and commit history, following the project's PR template and title conventions. Use when the user is about to open a PR and wants ready-to-paste content, or asks to write, draft, or fill in a PR description. Read-only — never opens or pushes the PR.

2ykwang/agent-skills · 71 tokens