new-branch

Creates git worktree feature branches by auto-detecting project branch scripts.

Updated Jun 2, 2026
One-click install
npx skills add https://github.com/lfuuu/claude-rules --skill new-branch-lfuuu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-branch
Source: https://github.com/lfuuu/claude-rules/tree/main/global-skills/new-branch
Command: npx skills add https://github.com/lfuuu/claude-rules --skill new-branch-lfuuu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Starting a new task often requires repetitive manual git work: pulling master, creating a properly named feature branch, setting up a worktree, and restoring symlinks to git-ignored config files. This Skill automates that routine by delegating to a project-specific branch script, or scaffolding one from a template when none exists. ## Core Features & Use Cases - Auto-detection of project branch scripts: Searches for scripts/<project>-branch.sh (cmdb, respoolman, paasfabric, ai-plant, and others) based on the current working directory. - Template scaffolding: If no branch script exists, copies templates/branch.sh into the project, adapts it to the project name, and makes it executable. - Standard subcommand contract: Supports new <type/name> to create a worktree from fresh master, list to show active worktrees, and cleanup <type/name> for post-merge teardown of worktrees and branches. - Use Case: You start a new feature in the cmdb project. Invoke the skill with feature/async-delete; it pulls master, creates .worktrees/feature/async-delete, symlinks CLAUDE.md and .claude, and prints the working directory. ## Quick Start Ask the assistant to create a new feature branch named feature/async-delete using the new-branch skill.

Frequently Asked Questions about new-branch

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

FAQPage Schema
How do I create a git worktree feature branch automatically?

Invoke the skill with a branch name in the format type/name, such as feature/async-delete. It locates the project's branch script, pulls master with git pull --ff-only, creates a worktree under .worktrees/, and symlinks CLAUDE.md and .claude into it.

What branch naming convention does the script enforce?

Branch names must match the pattern type/name where type is one of feature, fix, docs, refactor, or test, followed by a lowercase hyphenated Latin name. Names failing this regex are rejected with an error before any git operation runs.

What happens if my project has no branch script?

The skill scaffolds one from templates/branch.sh, copying it to scripts/<project>-branch.sh and replacing the reference project name with yours via sed. If templates are unavailable, it fails with a clear error instead of running raw git commands.

How do I clean up a worktree after merging a pull request?

Run the cleanup subcommand with the branch name, for example cleanup feature/async-delete. It removes the worktree, deletes the local and origin branches, prunes remotes, optionally cleans KVM servers, and pulls master. Merge itself is not performed.

Why do project skills disappear inside a worktree?

Relative tracked symlinks for .claude and CLAUDE.md break because worktrees sit deeper in the directory tree, so ../.. no longer reaches the target. Keep these files out of git and let the branch script create absolute symlinks in each worktree.