AgentSkillsCN

git-commit

采用 Conventional Commits 格式生成并执行 Git 提交。当用户希望提交代码变更、创建提交记录,或请求提交已暂存或未暂存的工作时,可使用此技能。该工具会分析代码变更,建议按逻辑拆分为多个提交,并在每次提交前等待用户确认。

SKILL.md
--- frontmatter
name: git-commit
description: Generate and execute git commits with Conventional Commits format. Use when the user wants to commit changes, create commits, or asks to commit staged/unstaged work. Analyzes changes, suggests splitting into logical commits, and requires user confirmation before each commit.

Git Commit

Generate commit messages following Conventional Commits and execute commits with user confirmation.

Workflow

  1. Run git status and git diff to view all changes
  2. Analyze changes and determine if they should be split into multiple commits (by feature, type, or scope)
  3. For each commit, generate a message and ask for confirmation before executing
  4. After each commit, display remaining commit count

Commit Message Format

code
type(scope): description

Types

TypeUse for
featAdd, adjust, or remove a feature (API or UI)
fixFix a bug from a previous feat commit
refactorRewrite/restructure code without changing behavior
perfPerformance improvements (special refactor)
styleCode style only (whitespace, formatting, semicolons)
testAdd or correct tests
docsDocumentation only
buildBuild tools, dependencies, project version
opsInfrastructure, deployment, CI/CD, monitoring
choreMisc tasks (initial commit, .gitignore, etc.)

Description Guidelines

  • Clearly explain "what was done" and "why"
  • Use imperative mood ("add feature" not "added feature")
  • Keep under 72 characters
  • No period at the end

Confirmation Flow

For each proposed commit:

  1. Show the commit message
  2. Show which files will be included
  3. Wait for user confirmation (yes/no/edit)
  4. If confirmed, execute git add <files> && git commit -m "message"
  5. Display: "✓ Committed. Remaining commits: N"

Important Rules

  • Never commit without user confirmation
  • Never add auto-generated footers (no "Co-Authored-By", no "Generated with...")
  • Never use git add -A or git add . — always add specific files
  • If user says "no", skip that commit and continue to next
  • If user wants to edit, accept their revised message