AgentSkillsCN

start-work

通过创建 Git 工作树,开始处理 Feature/Bug/Chore 问题。当用户想要着手某项工作、实现某个功能、启动开发,或确认已对 Linear 问题展开工作时,可使用此技能。它会利用 Linear 自动生成的分支名称与 Git 工作树来创建工作树。切勿用于:思考问题、代码审查、部署。

SKILL.md
--- frontmatter
name: start-work
description: Start work on a Feature/Bug/Chore issue by creating a git worktree. Use when user wants to work on something, implement a feature, start development, or confirms work on a Linear issue. Uses Linear's auto-generated branch name and git worktree for worktree creation. Do NOT load for: Thinking issues, code review, deployment.
allowed-tools: ["Bash", "Read", "Write", "mcp__plugin_linear_linear__*", "AskUserQuestion", "Skill"]
user-invocable: true

Start Work Skill

Create a git worktree for isolated development and switch to it.

Type Label Check (CRITICAL)

This skill is ONLY for issues with these Type Labels:

Type LabelWorktreeThis Skill
FeatureRequired✓ Use
BugRequired✓ Use
ChoreRequired✓ Use
ThinkingNot needed✗ Skip

Check Type Label FIRST before proceeding.

If the issue is labeled "Thinking" → Inform user: no worktree needed for thinking/design work.

Configuration

Team Selection: Query available teams dynamically using mcp__plugin_linear_linear__list_teams. If only one team exists, use it automatically.

Prerequisites

  • Current directory is a git repository
  • git 2.15+ (git worktree support)
  • Linear MCP tools are available

Critical Rules

  1. NEVER create branch names locally - always use Linear's auto-generated name
  2. NEVER work on main branch - always create a worktree first
  3. Check Type Label - Only Feature/Bug/Chore need worktrees
  4. Branch name format: {type}/dev-{issue-number}-<title-slug>

Workflow

Step 1: Pre-check Branch

Check current branch:

bash
git branch --show-current

If on main/master: proceed to Step 2 If on feature branch: ask user intent using AskUserQuestion:

  • Continue in current worktree?
  • Create a new worktree for a different issue?

Step 2: Issue Resolution

First, determine team: mcp__plugin_linear_linear__list_teams

Option A: Search existing issues

Use mcp__plugin_linear_linear__list_issues:

json
{
  "team": "<selected-team>",
  "assignee": "me"
}

Or search by query:

json
{
  "team": "<selected-team>",
  "query": "<user's task description>"
}

Note: No state filter - search across all states (Todo, In Progress, etc.)

Option B: Multiple matches

Present candidates to user with AskUserQuestion. Show issue title and Type Label to help selection.

Option C: No matching issue found

Invoke the linear-issue skill:

code
Use Skill tool with skill: "linear-issue"

Step 3: Validate Type Label

Check the issue's Type Label:

  • Feature / Bug / Chore → Proceed to Step 4
  • Thinking → Stop. Inform user: "This is a Thinking issue. No worktree needed for design/research work."

Step 4: Get Branch Name

Use mcp__plugin_linear_linear__get_issue with the selected issue ID. Extract the branchName field (auto-generated by Linear).

Step 5: Create Worktree

Create worktree and calculate the path.

5.1 Environment Variable Check

Check if WORKTREE_BASE is set. If not, use default:

bash
if [ -z "$WORKTREE_BASE" ]; then
  WORKTREE_BASE="$HOME/repos/github.com"
fi

Verify base directory exists:

bash
if [ ! -d "$WORKTREE_BASE" ]; then
  mkdir -p "$WORKTREE_BASE"
fi

5.2 Get Repository Info

bash
git remote get-url origin

Extract owner/repo from the result:

  • SSH format: git@github.com:owner/repo.gitowner/repo
  • HTTPS format: https://github.com/owner/repo.gitowner/repo

5.3 Build Worktree Path

ElementDescription
Base$WORKTREE_BASE (default: ~/repos/github.com)
owner/repoExtracted from remote URL
Separator=
Branch nameSanitized: /-

Example: Branch feature/dev-123-foo → Path $WORKTREE_BASE/owner/repo=feature-dev-123-foo

5.4 Create Worktree

For new branch:

bash
git worktree add -b <branch-name> "<worktree-path>"

For existing branch:

bash
git worktree add "<worktree-path>" <branch-name>

Step 6: Copy Settings

bash
mkdir -p <worktree-path>/.claude
cp <original-repo>/.claude/settings.local.json <worktree-path>/.claude/

Only copy if source file exists.

Step 7: Report New Worktree

Provide to user:

  1. Worktree path created
  2. Linear issue link
  3. Branch name being used
  4. Instruction:
    code
    cd $WORKTREE_BASE/<owner>/<repo>=<sanitized-branch-name>
    

Note: If branch name contains slashes (e.g., feature/dev-123-title), it becomes feature-dev-123-title.

Error Handling

ScenarioAction
Type is ThinkingInform: no worktree needed
Worktree existsAsk: switch or recreate?
No issue foundCreate via linear-issue skill
Worktree creation failsCheck: git worktree list for existing worktrees
Not in git repoFail with clear message

git worktree Command Reference

bash
git worktree add -b <branch-name> <path>  # Create worktree with new branch
git worktree add <path> <branch-name>     # Create worktree for existing branch
git worktree list                         # List all worktrees
git worktree remove <path>                # Remove worktree

Daily Flow

  1. Notice task → Create Linear Issue (linear-issue skill)
  2. Set Type Label (Feature/Bug/Chore) + Repository Label
  3. Start work → This skill creates worktree
  4. Implement → PR
  5. Merge
  6. Linear auto-updates to Done