ck:worktree

Create isolated Git worktrees for parallel feature development.

Updated Apr 2, 2026
One-click install
npx skills add https://github.com/hidonguyen/trade-ops --skill ck-worktree-hidonguyen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ck:worktree
Source: https://github.com/hidonguyen/trade-ops/tree/main/.opencode/skills/worktree
Command: npx skills add https://github.com/hidonguyen/trade-ops --skill ck-worktree-hidonguyen

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Create isolated git worktrees so developers can work on parallel features without impacting the main repository, avoiding branch conflicts, preserving uncommitted work, and keeping monorepo projects organized.

Core Features & Use Cases

  • Smart repo detection: auto-detects monorepo vs standalone, submodules, and topmost superproject to choose the correct worktree root.
  • Branch name handling: automatic prefix detection, slug sanitization, optional --no-prefix mode that preserves slashes and case for Jira or multi-segment branches.
  • Safe worktree creation & removal: dry-run previews, branch existence checks, fetch handling for remote branches, path validation, and clear warnings for dirty state.
  • Environment template support: auto-copy .env*.example templates and optional explicit env file copying with traversal safety checks.
  • Use Case: create a feature worktree for a monorepo project, install dependencies in that isolated folder, and later remove the worktree without touching the main repo.

Quick Start

Create or preview an isolated worktree by running the worktree script to create a feature branch and directory, for example use the create command with --dry-run to preview the branch name and target path.

Frequently Asked Questions about ck:worktree

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

FAQPage Schema
How do I create isolated git worktrees for parallel feature development?

You create isolated git worktrees by running a command that auto-detects monorepo structures, sanitizes branch names, and sets up a separate directory. This enables parallel feature development without modifying your main repository.

What is the best way to manage git worktrees in a monorepo?

The best way to manage git worktrees in a monorepo is using smart root detection that identifies the topmost superproject and submodules. This ensures worktrees are created at the correct root path for organized branch management.

Can I preview a worktree creation path before making changes in git?

Yes, you can preview worktree creation by using the dry-run feature. This shows the target path and sanitized branch name without actually modifying your repository, ensuring safe branch management before execution.

Does git worktree creation preserve uncommitted work and copy environment templates?

Yes, git worktree creation preserves uncommitted work and supports environment template copying. It automatically copies .env*.example files to your new worktree, with traversal safety checks to prevent incorrect file overwrites.

How do I handle complex branch names with slashes when creating a git worktree?

To handle complex branch names with slashes, use the optional --no-prefix mode. This preserves slashes and case for Jira or multi-segment branches, overriding the default slug sanitization during worktree creation.

What are the limitations of removing a git worktree with a dirty state?

When removing a git worktree with a dirty state, the script provides clear warnings about uncommitted changes. Path validation and robust error reporting ensure you do not accidentally lose uncommitted work during worktree removal.