worktree-context

worktree-context is a skill for Claude Code from marcusgoll/Spec-Flow. It costs 0 tokens per session (1,490 once invoked), scanned A, original, MIT.

A reusable Git worktree helper for workflow commands. A Git worktree is a separate working folder connected to the same repository, allowing branches to be worked on side by side.

In plain words
What is it for?
It helps create feature worktrees, check the current worktree, and provide branch and folder details to other coding agents.
Why use it?
It gives commands one consistent way to detect, create, and describe worktrees instead of repeating that logic.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is bash .spec-flow/scripts/bash/worktree-context.sh in-worktree && echo "yes" || echo "no".

Good fit It helps create feature worktrees, check the current worktree, and provide branch and folder details to other coding agents.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/marcusgoll/Spec-Flow
agentmods
npx agentmods add skills/marcusgoll/spec-flow/worktree-context

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/marcusgoll/spec-flow/worktree-context/github.svg)](https://agentmods.dev/skills/marcusgoll/spec-flow/worktree-context)
Your own site
<a href="https://agentmods.dev/skills/marcusgoll/spec-flow/worktree-context"><img src="https://agentmods.dev/badge/skills/marcusgoll/spec-flow/worktree-context/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for worktree-context

Your own site · 80×15
<a href="https://agentmods.dev/skills/marcusgoll/spec-flow/worktree-context"><img src="https://agentmods.dev/badge/skills/marcusgoll/spec-flow/worktree-context.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,490 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00000 $0.01490
Opus 5.5 $0.00000 $0.00596
Sonnet 5.5 $0.00000 $0.00298
Haiku 4.5 $0.00000 $0.00149

Measured 1mo ago against content hash 596d490d18e8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

worktree-context 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 1mo 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.

.claude/skills/worktree-context/SKILL.md · 198 lines

How it starts

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

Worktree Context Skill

Provides centralized worktree handling for workflow commands, eliminating ~50 lines of inline code per command.

Purpose

Git worktrees enable parallel development by allowing multiple branches to be checked out simultaneously. This skill provides a single source of truth for worktree detection, creation, and context generation.

Quick Reference

# Check if in worktree
bash .spec-flow/scripts/bash/worktree-context.sh in-worktree && echo "yes" || echo "no"

# Get worktree info (JSON)
bash .spec-flow/scripts/bash/worktree-context.sh info

# Create worktree for feature
bash .spec-flow/scripts/bash/worktree-context.sh create "feature" "001-auth" "feature/001-auth"

# Generate Task() agent context block
bash .spec-flow/scripts/bash/worktree-context.sh context "/path/to/worktree"

Output Format

Info Command

Returns JSON with worktree details:

{
  "is_worktree": true,
  "worktree_path": "/path/to/worktrees/feature/001-auth",
  "root_path": "/path/to/main/repo",
  "branch": "feature/001-auth",
  "worktree_type": "feature",
  "worktree_slug": "001-auth"
}

Fields

Field Values Description
is_worktree boolean Whether currently in a worktree
worktree_path string Absolute path to worktree
root_path string Absolute path to main repository
branch string Current git branch
worktree_type feature, epic Type of worktree
worktree_slug string Feature/epic slug

Compact Pattern (v11.2)

In Command Process Section

Replace 50+ lines of inline worktree detection with this compact reference:

### Step N: Worktree Context (Optional)

**Check worktree using centralized skill** (see `.claude/skills/worktree-context/SKILL.md`):

1. Check preference: `bash .spec-flow/scripts/utils/load-preferences.sh --key "worktrees.auto_create" --default "true"`
2. Check if already in worktree: `bash .spec-flow/scripts/bash/worktree-context.sh in-worktree`
3. If NOT in worktree AND auto_create is true:
   - Create: `bash .spec-flow/scripts/bash/worktree-context.sh create "feature" "$SLUG" "$BRANCH"`
   - Store path in state.yaml: `yq eval ".git.worktree_path = \"$PATH\"" -i state.yaml`
4. For Task() agents, generate context: `bash .spec-flow/scripts/bash/worktree-context.sh context "$PATH"`

Read the full file on GitHub · 198 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. 1mo ago First seen · 198 lines · 0 tokens per session scan A 596d490d18e8

Subscribe to this mod's changes

worktree-context is a skill published in the GitHub repository marcusgoll/Spec-Flow (96 stars, last pushed 23d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,490 tokens. 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-09-03.

Related

Other skills, from other repositories

changelog

Auto-generate a changelog from git commits and sprint data. Internal and player-facing versions.

Donchitos/Claude-Code-Game-Studios · 22 tokens

antigravity-maintainer-batch-release

Run protected AAS maintainer sweeps, PR merge batches, canonical sync, Core preview checks, and scripted releases. Use for repository maintenance, main alignment, CLI/MCP/Workbench changes, or release work; not ordinary contribution tasks.

sickn33/agentic-awesome-skills · 57 tokens

resolve-conflicts

Use this skill immediately when the user mentions merge conflicts that need to be resolved. Do not attempt to resolve conflicts directly - invoke this skill first. This skill specializes in providing a structured framework for merging imports, tests, lock files (regeneration), configuration files, and handling…

tailcallhq/forgecode · 68 tokens

team-release

Orchestrate the release team — release-manager, qa-lead, devops-engineer, producer — to execute a release from candidate to deployment.

Donchitos/Claude-Code-Game-Studios · 33 tokens

write-release-notes

Generate engaging, high-energy release notes for a given version tag. Fetches the release from GitHub, retrieves every linked PR's title and description, then synthesizes all changes into a polished, user-facing release note with an enthusiastic tone. Use when the user asks to write, generate, or create release notes…

tailcallhq/forgecode · 105 tokens

create-github-issue

Create GitHub issues using GitHub CLI with support for templates, labels, assignees, milestones, and draft issues. Use when the user asks to create a GitHub issue, file a bug report, submit a feature request, or open an issue in a GitHub repository.

tailcallhq/forgecode · 63 tokens