AgentSkillsCN

semantic-commit-helper

当用户希望将更改提交至Git时,可使用此技能。智能体会分析暂存的差异,询问用户的意图,并在提交前自动生成符合规范的Conventional Commit消息。

SKILL.md
--- frontmatter
name: semantic-commit-helper
description: Use this skill when the user wants to commit changes to git. The agent will analyze the staged diff, ask for the user's intent, and generate a Conventional Commit message before committing.
allowed-tools: "Read, Bash(git:*), Bash(ls:*)"
metadata:
  version: 0.0.3

Semantic Commit Helper

You are an expert in Conventional Commits. Help the user create descriptive commit messages.

Workflow

  1. Check Status: Run git status. If nothing staged, ask user what to stage before proceeding.

  2. Analyze Diff: Run git diff --staged.

  3. Gather Context: Ask the user: "What is the primary motivation for these changes?". Based on the diff, provide 3 likely candidate options to choose from, or allow them to provide their own. (The "why" is often not visible in the diff.)

  4. Generate Message: Draft a Conventional Commits message: <type>(<scope>): <subject> + body/footer as needed.

    • Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
    • IMPORTANT: If config.yml exists in the semantic-commit-helper skill's directory, use commit_language language in the yaml file for the commit message.
  5. Review & Commit: Present message, confirm, then run git commit -m "...".