AgentSkillsCN

sdlc:checkpoint

以提交与推送的方式保存正在进行的工作(无需创建 PR)

SKILL.md
--- frontmatter
name: sdlc:checkpoint
description: Save work in progress with commit and push (no PR)
argument-hint: [optional commit message]
allowed-tools:
  - Bash(git:*)
  - Grep
  - Read

Checkpoint

Save current work in progress to remote. This creates a commit and pushes but does NOT create a PR.

Workflow

  1. Verify branch state - Must be on a feature branch, not main
  2. Analyze changes - Review what will be committed
  3. Stage all changes - Add all modified and untracked files
  4. Generate commit message - Create informative message from changes
  5. Commit and push - Save to remote

Step 1: Verify Branch State

bash
BASE_BRANCH=$(../../scripts/get-base-branch.sh)
CURRENT_BRANCH=$(git branch --show-current)

if [[ "$CURRENT_BRANCH" == "$BASE_BRANCH" ]]; then
  echo "ERROR: Cannot checkpoint on default branch ($BASE_BRANCH)"
  echo "Create a feature branch first with: git checkout -b <branch-name>"
  exit 1
fi

Step 2: Check for Changes

bash
if [ -z "$(git status --porcelain)" ]; then
  echo "No changes to checkpoint. Working directory is clean."
  exit 0
fi

git status
git diff --stat

Step 3: Stage All Changes

bash
git add -A

Step 4: Generate Commit Message

If the user provided a message via $ARGUMENTS, use it as the commit message prefix.

Otherwise, analyze the staged changes to generate an appropriate message:

  • Look at modified files to understand the scope
  • Create a concise summary of changes
  • Follow conventional commit format when appropriate

Step 5: Commit and Push

bash
git commit -m "$(cat <<'EOF'
<commit message here>

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"

git push -u origin HEAD

Output

Confirm the checkpoint was successful:

code
Checkpoint saved to <branch-name>
Commit: <short-hash> <message>