AGENT SKILL

git-wt

Creates a Git worktree with `git wt` and implements changes in an isolated directory. After the work is done, removes the worktree pending user confirmation. Use when the user explicitly says "worktree", "branch off", "wt", "git-wt", etc.

License 许可
MIT
所属仓库
to4iki/skills
最近更新
2026-10-06
Stars
★ 0
Forks
0

01 前言 Front Matter

name
git-wt
description
Creates a Git worktree with `git wt` and implements changes in an isolated directory. After the work is done, removes the worktree pending user confirmation. Use when the user explicitly says "worktree", "branch off", "wt", "git-wt", etc.

02 资源文件 1

03 SKILL.md 正文

Git Wt

Workflow

Step 1: Create the worktree

Pick a branch name from the task description and create the worktree.

git wt <branch-name> --nocd

--nocd keeps the current directory in place after creation and only prints the new worktree path to stdout. The worktree is created under .wt/<branch-name>/. Hold on to the printed path as a logical variable WORKTREE_PATH in the agent's context — this is a name used to reference the path in later steps, not a shell environment variable.

Step 2: Work inside the worktree

Every subsequent operation must happen under WORKTREE_PATH.

  • Read/Edit/Write tools: pass absolute paths like $WORKTREE_PATH/src/...
  • Bash: cd $WORKTREE_PATH && <command>

Step 3: Report completion

After the work is done, tell the user:

  • The list of changed files and a brief summary
  • The worktree path
  • How to merge (e.g. cd $WORKTREE_PATH && git push -u origin <branch-name> → open a PR)

Step 4: Cleanup

Branch cleanup based on whether there are changes.

No changes (nothing committed, nothing modified)

Automatically delete the worktree and branch. No user confirmation needed.

git wt -d <branch-name>

Changes or commits exist

Ask the user whether to keep or delete:

  • Keep: leave the worktree and branch in place. Tell the user they can return later via cd $WORKTREE_PATH.
  • Delete: warn that all uncommitted changes and commits will be lost, then delete.
# Normal delete (branch already merged)
git wt -d <branch-name>

# Force delete (unmerged changes; only when the user explicitly authorizes)
git wt -D <branch-name>

Branch naming

Worktrees are created under .wt/<branch-name>/. A / in the branch name nests the filesystem path further and makes references and operations like git wt -d harder to track. Therefore, use a flat, single-segment name — do not use slashes (avoid feat/...).

Use hyphenated prefixes for the kind of work. Do not name branches after an agent (e.g. codex-); match the task instead (e.g. feat-auth-module, not codex-auth-module).

Kind Prefix Example
New feature feat- feat-add-dark-mode
Bug fix fix- fix-image-upload-error
Refactoring refactor- refactor-auth-module
Documentation docs- docs-update-readme
Config / chores chore- chore-update-deps

Parallel sub-agents

When spawning multiple sub-agents in parallel, create a separate worktree per branch name. Pass each worktree path explicitly to its agent.

git wt feat-feature-a --nocd  # → .wt/feat-feature-a
git wt feat-feature-b --nocd  # → .wt/feat-feature-b

Gotchas

  • If git wt is missing, stop and tell the user to install k1LoW/git-wt — do not fall back to raw git worktree unless the user asks

04 同仓库更多 Skills

to4iki
to4iki/skills

use-claude-artifact

When the user asks for HTML output for code review materials, explanations of plans or discussions, or design verification, create the HTML as a Claude artifact instead of a file in the repository. Use when the user says things like "create it as HTML", "as an artifact", "HTML for review", or "HTML for design check".

★ 0
to4iki
to4iki/skills

eli5

Explain a topic like I'm a 5 year old. Use when the user types /eli5 or asks for a dead-simple picture explainer of how something works.

★ 0
to4iki
to4iki/skills

cursor-edit

Delegate file edits to Cursor through the headless cursor-agent CLI instead of editing files directly in the calling AI agent. The calling AI agent analyzes the change, writes precise edit instructions, and verifies the result; cursor-agent performs the actual file modifications. Use when the user says things like "let Cursor edit this", "fix it with cursor", or "have Cursor handle the file edits". Best for offloading large edits to Cursor to reduce token usage and speed up the overall workflow.

★ 0
to4iki
to4iki/skills

implementation-notes

Implement a spec while keeping a running implementation-notes.html with decisions, deviations, tradeoffs, and open questions. Use for /implementation-notes, @implementation-notes, implementation-notes.html, or when the user wants a spec implemented with a work log.

★ 0
to4iki
to4iki/skills

hunk-session

Drive a live Hunk terminal diff review via `hunk session *`. Use when the user has a Hunk session running or wants to review diffs interactively.

★ 0
to4iki
to4iki/skills

git-commit

Analyze changes, stage files, and commit with Conventional Commits. Use when the user asks to commit or run git commit.

★ 0