AgentSkillsCN

pr-title

在 Squash-Merge 工作流中,将 PR/MR 标题设为语义化提交,以适应合并操作。当用户说“PR 标题”、“MR 标题”、“修复 PR 标题”、“重命名 PR”或“准备 PR”时,可运用此技巧。

SKILL.md
--- frontmatter
name: pr-title
description: Set or update PR/MR titles as semantic commits for squash-merge workflows. Use when the user says "pr title", "mr title", "fix pr title", "rename pr", or "prepare pr".

PR Title

Format: <type>: <short description in lowercase>

Types: feat, fix, chore, refactor, perf, docs, test, ci, build, style

No scope. No capital after colon.

Steps

  1. Detect platform - run in parallel:

    • gh pr view --json number,title,url 2>/dev/null
    • glab mr view --output json 2>/dev/null
    • Both fail → ask user to create one (and on which platform)
    • Both succeed → ask user which one
  2. Analyze - infer type from branch name, commits, and diff. Branch hints:

    • feature/*, feat/*feat
    • fix/*, bugfix/*, hotfix/*fix
    • refactor/*refactor
    • chore/*, deps/*chore
    • Ambiguous → inspect commits/diff
  3. Propose - present 2-3 title options via AskUserQuestion

  4. Apply:

    • GitHub: gh pr edit --title "…" or gh pr create --title "…" --body ""
    • GitLab: glab mr update --title "…" or glab mr create --title "…" --description ""