AgentSkillsCN

worktree

使用 gwq 创建并切换 Git 工作树。 适用于“创建工作树”、“切换分支”、“审阅此 PR”等场景——这些任务均无需进行代码变更,属于非开发类事务。 切勿用于涉及代码变更的开发工作(如实现、修复等)——此类任务应由 tdd 技能负责处理。 同样,也不宜用于调查研究或解答疑问。

SKILL.md
--- frontmatter
name: worktree
description: |
  Create and switch Git worktrees using gwq.
  Use for "create worktree", "switch to branch", "review this PR", etc.
  — non-development tasks that require branch switching.
  Do not use for development work involving code changes (implementation, fixes, etc.) — the tdd skill handles that.
  Do not use for investigations or answering questions.
user-invocable: true

gwq-worktree Skill

A skill for creating and managing Git worktrees using gwq, based on the user's task intent.

Purpose

  • Prepare worktrees for non-development tasks such as code reviews and PR checks
  • Create or select the appropriate worktree using gwq
  • Follow the project's Git branch naming conventions

This skill only prepares the worktree. The actual review or investigation is done afterward.


Prerequisites

  • gwq is installed and available in PATH
  • The current directory is within a Git repository managed by gwq
  • gwq list --json is the source of truth for existing worktrees
  • Follow the branch naming conventions defined in the Git Guidelines

Workflow

1. Understand the Task

Determine the following from the user's request:

  • The intent of the task (what they want to do)
  • The appropriate branch type
  • The branch summary

If any of these are unclear, confirm with AskUserQuestion.


2. Check Existing Worktrees

Run:

bash
gwq list --json

If a worktree for the same branch already exists:

  • Notify the user
  • Explicitly confirm whether to reuse it
  • Do not proceed without confirmation

3. Create the Worktree

If creating a new one is confirmed:

bash
gwq add <branch-name>

Do not run git commands directly.


4. Completion

After the worktree is created or selected:

  • Notify the user of the branch name
  • Notify the user of the worktree path
  • Stop execution

Do not do any of the following:

  • Modify files
  • Run tests
  • Automatically start implementation