AgentSkillsCN

git-commit

按照常规提交格式生成提交信息。

SKILL.md
--- frontmatter
name: git-commit
description: Generate commit messages following conventional commits format

Git Commit Skill

Generate consistent, descriptive commit messages following the Conventional Commits specification.

Commit Message Format

code
<type>(<scope>): <subject>

<body>

<footer>

Components

PartRequiredDescription
typeYesCategory of change
scopeNoModule/component affected
subjectYesBrief description (imperative mood)
bodyNoDetailed explanation
footerNoBreaking changes, issue refs

Commit Types

TypeWhen to UseExample
featNew featurefeat(auth): add password reset flow
fixBug fixfix(cart): correct total calculation
refactorCode restructuringrefactor(api): extract validation logic
docsDocumentation onlydocs: update API examples
styleFormatting changesstyle: fix indentation
testAdding/updating teststest(user): add signup edge cases
choreMaintenance taskschore: update dependencies
perfPerformance improvementperf(query): add index for user lookup
ciCI/CD changesci: add deployment workflow
buildBuild system changesbuild: configure webpack splitting

Writing Guidelines

Subject Line

  • Max 50 characters
  • Imperative mood ("Add" not "Added" or "Adds")
  • No period at the end
  • Capitalize first letter

Body

  • Wrap at 72 characters
  • Explain what and why, not how
  • Separate from subject with blank line

Footer

  • Reference issues: Fixes #123, Closes #456
  • Note breaking changes: BREAKING CHANGE: description

Process

  1. Check staged changes

    bash
    git diff --staged
    
  2. Analyze the changes

    • What files were modified?
    • What functionality changed?
    • Is this a feature, fix, or refactor?
  3. Determine scope

    • What module/component is affected?
    • Use lowercase, hyphenated if needed
  4. Write the subject

    • Start with imperative verb
    • Be specific but concise
  5. Add body if needed

    • Complex changes need explanation
    • Bug fixes should mention root cause
  6. Add footer if applicable

    • Link to issues
    • Note breaking changes

Examples

Simple Feature

code
feat(user): add email verification on signup

Bug Fix with Context

code
fix(checkout): prevent double submission

Users could click the submit button multiple times before
the form disabled, causing duplicate orders.

Added loading state and disabled button during submission.

Fixes #234

Breaking Change

code
feat(api): change authentication to use JWT

Migrate from session-based auth to JWT tokens.
Client applications need to update their auth handling.

BREAKING CHANGE: Authentication now requires Bearer token
in Authorization header instead of session cookie.

Migration guide: docs/migration/jwt-auth.md

Refactoring

code
refactor(validation): extract form validation to shared util

Move repeated validation logic from multiple form components
into a shared validation utility for consistency.

No functional changes.

Anti-Patterns

Don'tDo
fix stufffix(auth): handle expired token gracefully
wipfeat(dashboard): add chart component (partial)
changesrefactor(utils): simplify date formatting
Update file.tsfix(user): correct email validation regex
Mixed changesSeparate commits for separate concerns

Quick Reference

code
feat:     New feature
fix:      Bug fix
refactor: Code restructuring (no behavior change)
docs:     Documentation
style:    Formatting (no code change)
test:     Tests
chore:    Maintenance
perf:     Performance