AgentSkillsCN

hotfix

将修复补丁挑选并应用到发布分支,还可选择性地为其打上标签。适用于将 Bug 修复回溯到旧版本的发布分支、快速创建补丁版本,或将修复从主分支移动到发布分支时使用。

SKILL.md
--- frontmatter
name: hotfix
description: Cherry-pick a fix to a release branch and optionally tag it. Use when backporting a bug fix to an older release, creating a patch release quickly, or moving a fix from main to a release branch.

Hotfix

Create a hotfix by cherry-picking a commit to a release branch.

Inputs

InputTypeRequiredPurpose
commitstringyesCommit SHA to cherry-pick (from main)
target_branchstringyesRelease branch (e.g. release/1.2, v1.2-branch)
repostringnoRepo path (default cwd)
tagstringnoRelease tag (e.g. v1.2.3)
pushboolfalsePush to remote after cherry-pick
jira_keystringnoJira issue for context/comment
slack_formatboolfalseSlack link format in report

Workflow

1. Load Persona

  • persona_load("developer")

2. Check Known Issues

  • check_known_issues("git_cherry_pick", "")

3. Resolve Repository

  • Use repo or cwd; verify .git exists

4. Fetch and Verify

  • git_fetch(repo)
  • git_branch_list(repo, all_branches=true) — verify target branch exists

5. Checkout Target

  • git_checkout(repo, target="{target_branch}")

6. Show Commit Details

  • git_diff(repo, ref1="{commit}^", ref2="{commit}", stat=true) — files changed

7. Cherry-pick

  • git_cherry_pick(repo, commit="{commit}")
  • On conflict: report, suggest manual resolve + git cherry-pick --continue

8. Create Tag (if inputs.tag)

  • git_tag(repo, tag_name="{tag}", message="Hotfix release {tag}")

9. Push (if inputs.push)

  • git_push(repo, branch="{target_branch}")
  • If tag: push with --tags

10. Jira Comment (if jira_key)

  • jira_add_comment(issue_key, comment="Hotfix: cherry-picked {commit[:12]} to {target_branch}")

11. Memory & Notify

  • memory_session_log("Created hotfix on {target_branch}", "Cherry-picked {commit[:12]}")
  • If push success: skill_run("notify_team", '{"message": "🔥 Hotfix pushed to {target_branch}", "context": "..."}')

12. Learn from Failures

  • On conflict: learn_tool_fix("git_cherry_pick", "conflict", "Merge conflicts", "Resolve manually, git add, git cherry-pick --continue")
  • On push rejected: learn_tool_fix("git_push", "push rejected", "Remote has changes", "Pull first or --force-with-lease")

MCP Tools

  • persona_load
  • check_known_issues
  • git_fetch
  • git_branch_list
  • git_checkout
  • git_diff
  • git_cherry_pick
  • git_tag
  • git_push
  • jira_add_comment
  • memory_session_log
  • skill_run (notify_team)
  • learn_tool_fix

Output

  • Target branch not found / Checkout failed / Cherry-pick conflict / Success
  • Commit details, files changed, authors
  • Impact analysis if related code found
  • Next steps: push, create MR, return to main