worktree-context

Centralize Git worktree handling and generate Task() agent context blocks.

91|10|Updated Oct 4, 2025
One-click install
npx skills add https://github.com/marcusgoll/Spec-Flow --skill worktree-context
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-context
Source: https://github.com/marcusgoll/Spec-Flow/tree/main/.claude/skills/worktree-context
Command: npx skills add https://github.com/marcusgoll/Spec-Flow --skill worktree-context

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Streamlines worktree handling and context generation for Task() agents across feature/epic worktrees.

Core Features & Use Cases

  • Detect in-worktree state
  • Generate worktree context blocks for prompts
  • Create and manage worktree-specific paths
  • Provide compact prompts for Worker Agent contexts

Quick Start

Use the worktree-context.sh suite to generate context blocks and manage worktrees.

Frequently Asked Questions about worktree-context

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

FAQPage Schema
How do I centralize Git worktree handling across multiple feature branches?

Worktree-context centralizes worktree logic by detecting in-worktree status, retrieving worktree info (path, branch, type), and generating context blocks for agents. This eliminates duplicative inline worktree commands across your multi-branch workflow, exposing unified JSON output with fields like is_worktree, worktree_path, branch, and worktree_slug.

Can I automate worktree creation and context generation for feature and epic branches?

Yes. Worktree-context supports create, info, and context commands to automatically set up worktrees for features or epics and generate Task() agent prompts with standardized context blocks, reducing manual setup and ensuring consistent worktree metadata across your automation workflows.

What information does worktree-context extract and expose as JSON output?

Worktree-context outputs JSON with is_worktree status, worktree_path, root_path, branch name, worktree_type, and worktree_slug. It also supports commands to retrieve relative paths, extract slugs, and generate formatted context blocks for agent prompts.

How do I integrate worktree context into my Task() agent workflows?

Use the context command to generate compact prompt blocks containing worktree metadata. These blocks embed current worktree state—path, branch, type—directly into agent instructions, enabling agents to make branch-aware decisions without querying Git separately.

Does worktree-context work with existing Git workflows and multi-worktree setups?

Yes. Worktree-context is designed for multi-branch Git workflows and integrates with existing worktree structures. It detects current worktree state, manages worktree-specific paths, and provides state persistence integration without requiring changes to your existing Git setup.

What commands are available in the worktree-context suite?

Worktree-context includes in-worktree, info, create, path, context, relative-path, and extract-slug commands. These handle worktree detection, metadata retrieval, creation, path resolution, and context block generation for agent integration.