worktree-cwd-auto-detection

Detect repository and worktree names from the current directory using the /workspace/repos path convention.

Updated Nov 9, 2025
One-click install
npx skills add https://github.com/manifoldlogic/claude-code-plugins --skill worktree-cwd-auto-detection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree-cwd-auto-detection
Source: https://github.com/manifoldlogic/claude-code-plugins/tree/main/plugins/worktree/skills/worktree-cwd-auto-detection
Command: npx skills add https://github.com/manifoldlogic/claude-code-plugins --skill worktree-cwd-auto-detection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill solves the problem of manually detecting the repository and worktree names from a user's current directory in worktree lifecycle scripts, streamlining the process for users.

Core Features & Use Cases

  • Auto-Detection: Automatically detects the repository and worktree names from the current directory using the /workspace/repos path convention.
  • Validation: Includes critical validation to reject the main worktree and handle deeply nested subdirectories.
  • Use Case: Enables worktree scripts to provide a frictionless user experience by inferring the target of the operation without requiring explicit arguments.

Quick Start

Run the script within a feature worktree directory.

Frequently Asked Questions about worktree-cwd-auto-detection

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

FAQPage Schema
How do I automatically detect repository and worktree names from the current directory in lifecycle scripts?

You can automatically detect repository and worktree names by parsing the current directory path using the /workspace/repos convention, inferring the target worktree without requiring explicit arguments.

Do I need a specific directory structure for worktree auto-detection to work?

Yes, worktree auto-detection requires the /workspace/repos path convention to be present in your environment to successfully parse and validate the repository and worktree names.

Can I run worktree scripts from deeply nested subdirectories within a feature worktree?

Yes, the auto-detection script handles deeply nested subdirectories by parsing the path structure to correctly identify the parent repository and the specific feature worktree names.

Why does the worktree auto-detection script reject the main worktree?

The script includes validation to reject the main worktree because it is designed for scripts that operate within single feature worktrees, preventing accidental operations on the main branch.

What is the best way to streamline worktree lifecycle scripts without passing explicit arguments?

Using auto-detection scripts that infer the target worktree from the current directory path provides a frictionless user experience by eliminating the need to manually pass repository and worktree arguments.