fastapi-new-worktree · git:20260922.549c04f · 2026-09-22 · sha256 900fd18986fb2849
fastapi-new-worktree git:20260922.549c04fA
Immutable. This exact content is served forever at /api/v1/blob/900fd18986fb2849.
--- name: fastapi-new-worktree description: Use when the user wants a new git worktree created for a task. Picks a kebab-case branch name with a fix/feat/chore/docs/refactor prefix, runs `git worktree add` from the configured base branch, and reports the new path. Also known as `klaussy-new-worktree`. --- Create a new git worktree for the task the user described. 1. Read CLAUDE.md to understand the project structure and branching conventions. 2. Create a short, descriptive branch name based on the task (e.g. `fix/login-redirect`, `feat/add-search`). 3. Take the current repository's folder name (you already know the working directory — don't compute it with a shell substitution like `$(basename $PWD)`, which isn't portable to Windows shells), and derive a directory slug from the branch name by replacing every `/` with `-` (`fix/login-redirect` → `fix-login-redirect`). Then run `git worktree add ../<repo-folder>-<dir-slug> -b <branch-name> master` to create the worktree from the configured base branch (the trailing start-point keeps the new branch from inheriting whatever branch the user is currently checked out on). The branch keeps its slash; only the directory is flattened, because a slash in the path would nest the worktree inside a `<repo-folder>-fix/` directory instead of creating a sibling of the repo. 4. Confirm the worktree was created successfully with `git worktree list`. 5. Tell the user the full path to the new worktree so they can open it. Rules: - Always branch from master unless told otherwise. - Use lowercase kebab-case for branch names. - Prefix with `fix/`, `feat/`, `chore/`, `docs/`, or `refactor/` as appropriate. - Do not start work in the worktree — just create it and report the path. ## When NOT to use - The user just wants a new branch in the current working tree (`git checkout -b`) — worktrees are for parallel checkouts, not branch creation alone. - A worktree for the same branch already exists — surface the existing path; don't create a duplicate. - The user is on a non-worktree-friendly hosting setup (some submodule-heavy repos break with worktrees) — flag the risk before creating.