swe-worktree

swe-worktree is a skill for Claude Code from SNIKO/agent-skills. It costs 33 tokens per session (969 once invoked), scanned A, original, MIT.

A tool for creating a separate Git worktree and branch for a software change. A Git worktree is an additional working folder linked to the same repository, allowing work to stay isolated.

In plain words
What is it for?
Use it before implementation when a change has a prepared brief, specification, or plan and should be developed in a dedicated workspace.
Why use it?
Isolation keeps unfinished changes separate from the current working folder and gives implementation its own branch. This reduces the chance of mixing unrelated edits.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

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/sniko/agent-skills/swe-worktree
Any agent
npx skills add SNIKO/agent-skills --skill swe-worktree
Clone the repo
git clone --depth 1 https://github.com/SNIKO/agent-skills

Made for: Claude Code.

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 swe-worktree

README.md
[![agentmods](https://agentmods.dev/badge/skills/sniko/agent-skills/swe-worktree.svg)](https://agentmods.dev/skills/sniko/agent-skills/swe-worktree)
Your own site
<a href="https://agentmods.dev/skills/sniko/agent-skills/swe-worktree"><img src="https://agentmods.dev/badge/skills/sniko/agent-skills/swe-worktree.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 969 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.00033 $0.00969
Opus 5 $0.00016 $0.00485
Sonnet 5 $0.00007 $0.00194
Haiku 4.5 $0.00003 $0.00097

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

Security

Grade A, and why

swe-worktree 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 5d 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/swe-worktree/SKILL.md · 84 lines

How it starts

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

Pipeline

swe-shapeswe-spec → [swe-plan] → [swe-worktree] → swe-executeswe-review, with swe-research available at any point.

Each stage runs in its own session: the user invokes one skill, reviews the result, clears the context, then invokes the next. Assume no memory of other stages beyond the files named below.

  • This stage: optional infrastructure. Isolate the change before implementation.
  • Reads: the change directory produced by earlier stages — brief.md, spec.html, and plan.md when present. Their contents are not needed; only their location.
  • Writes: a git branch and worktree, with the change directory copied into it.
  • Next: the user runs swe-execute inside the new worktree. Do not invoke it.

Purpose

Create a safe isolated branch and git worktree, copy the complete SWE change workspace into it, and report where implementation should continue. Worktrees are optional execution infrastructure, not a required specification stage.

Inputs

Infer from user input or an artifact path:

  • CHANGE_DIR: .swe/<change>/
  • SLUG: kebab-case change label
  • REPO_NAME: repository root basename
  • BRANCH_NAME: repository convention, otherwise <slug>
  • WORKTREE_PARENT: repository convention, otherwise ../worktrees/<repo-name>/
  • WORKTREE_PATH: <worktree-parent>/<slug>

Use the change directory named by the user. If it is ambiguous, ask which one to prepare.

The shared research corpus at .swe/research/ is not change scope. It is repository documentation that outlives any branch, so it is not copied and not branched: research produced during implementation is written to the corpus in the main working tree and committed independently. Copying it would fork the corpus per branch and guarantee divergence.

Workflow

  1. Inspect repository state. Read repository git guidance and inspect git status --short, current branch, existing branches, and worktrees. Preserve unrelated changes.
  2. Resolve names. Follow repository branch and worktree conventions. Fall back to the defaults above only when guidance is absent.
  3. Handle conflicts. If the branch or path already exists, report the exact conflict and ask whether to reuse it or choose another name.
  4. Create the worktree. Run:

Read the full file on GitHub · 84 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. 5d ago First seen · 84 lines · 33 tokens per session scan A ef2973aa1576

Subscribe to this mod's changes

swe-worktree is a skill published in the GitHub repository SNIKO/agent-skills (2 stars, last pushed 13d ago), licensed MIT. It adds 33 tokens to every session and 969 once invoked, about $0.0002 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-31.

Related

Other skills, from other repositories

release-candidate-prep

Preflight and prepare an OpenAI Agents Python release candidate in a dedicated worktree from exact origin/main, gate readiness before branch creation, freeze the released API contract, create or replace the local release branch with one release commit, enforce final release review as a checker, and produce…

openai/openai-agents-python · 87 tokens

final-release-review

Perform pre-release planning or a final release-candidate review for openai-agents-python by comparing the target with the previous remote tag, determining the minimum compatible release type, auditing regressions and contract changes, reviewing open documentation PR coverage, drafting minor-release Key Changes, and…

openai/openai-agents-python · 64 tokens

implementation-strategy

Choose compatibility-aware scope for runtime and API changes in openai-agents-python. Use before initial implementation and each review-feedback batch to decide whether to patch, reset the design, preserve compatibility, or reject unsupported cases.

openai/openai-agents-python · 47 tokens

pr-draft-summary

Create the required PR-ready summary block, branch suggestion, title, and draft description for openai-agents-python. Use before the final response whenever the current task changed runtime code, tests, examples, build/test configuration, or docs with behavior impact, regardless of perceived change size and including…

openai/openai-agents-python · 114 tokens

examples-run-analysis

Analyze artifacts from the latest completed manual examples Make run. Read the main log, every relevant per-example log, and example source; validate every exit-0 example and classify failures, skips, and environment restrictions. Never execute or control examples.

openai/openai-agents-python · 52 tokens

playwright

Use when the task requires capturing or automating a real browser from the terminal.

openai/openai-agents-python · 19 tokens