AgentSkillsCN

sdlc:plan

以分支设置与自动规划模式,开启某项问题的开发工作。

SKILL.md
--- frontmatter
name: sdlc:plan
description: Start work on an issue with branch setup and automatic plan mode
argument-hint: <issue-id>
allowed-tools:
  - Bash(git:*)
  - Bash(linearis:*)
  - TodoWrite
  - ExitPlanMode
  - AskUserQuestion

Start Planning

Starting work on issue $ARGUMENTS. Setting up git branch and fetching issue details.

Workflow

  1. Fetch issue details (if using Linear)
  2. Set up git branch
  3. Enter plan mode for implementation design

Step 1: Fetch Issue Details (Optional Linear Integration)

If the argument looks like a Linear issue ID (e.g., ATE-123) and Linearis CLI is available, fetch issue details:

bash
# Check if linearis is available and argument looks like a Linear issue
ISSUE_ID=$(echo "$ARGUMENTS" | grep -oE '^[A-Z]+-[0-9]+')
if [ -n "$ISSUE_ID" ] && command -v linearis &> /dev/null; then
  # Try to fetch issue details
  linearis issues read "$ISSUE_ID"
fi

If the fetch fails or Linearis is not installed, continue with just the issue ID as the branch name. The user can provide additional context manually.

Step 2: Set Up Git Branch

First, check if there are uncommitted changes:

bash
if [ -n "$(git status --porcelain)" ]; then
  echo "You have uncommitted changes or untracked files in your working directory."
fi

If uncommitted changes exist, use AskUserQuestion to prompt the user:

  • Stash changes - Save changes and continue
  • Commit changes - Create a quick commit first
  • Abort - Stop and let user handle manually

After handling uncommitted changes, prepare the repository:

bash
BASE_BRANCH=$(../../scripts/get-base-branch.sh)
git checkout "$BASE_BRANCH"
git pull origin "$BASE_BRANCH"

# Sanitize arguments for valid branch name
BRANCH_NAME=$(echo "$ARGUMENTS" | tr -s '[:space:]' '-' | tr -cd '[:alnum:]-./_')
if [ -z "$BRANCH_NAME" ] || ! git check-ref-format --branch "$BRANCH_NAME" >/dev/null 2>&1; then
  echo "ERROR: Could not create a valid branch name from '$ARGUMENTS'. Please provide a valid name."
  exit 1
fi
git checkout -b "$BRANCH_NAME"

Step 3: Fetch and Display Issue Details

Parse the issue response and display:

  • Issue ID and Title
  • Description (full text)
  • Current Status
  • Labels (if any)
  • Suggested Branch Name (from Linear)

Step 4: Create Implementation Plan

You are now in plan mode. Your task is to:

  1. Understand the requirement from the issue description
  2. Explore the codebase to understand relevant files and patterns
  3. Design the implementation approach
  4. Create a detailed plan using TodoWrite with specific tasks
  5. Present the plan to the user for approval

Do NOT start implementing until the user approves the plan.

When the plan is ready, use ExitPlanMode to request user approval.

After user approves, if using Linear integration, update the issue status (reusing ISSUE_ID from Step 1):

bash
# Reuse ISSUE_ID from Step 1 - only update if it was a valid Linear issue
if [ -n "$ISSUE_ID" ] && command -v linearis &> /dev/null; then
  linearis issues update "$ISSUE_ID" --state "In Progress"
fi