AgentSkillsCN

git-conventions

对于学习目的,逐步解释证明过程或Lean代码的每一步。可通过“解释”“这是如何工作的”“教我”“这到底是什么意思”“带我一起走一遍”“我不明白”等指令触发。

SKILL.md
--- frontmatter
name: git-conventions
description: Reference for Git best practices — Conventional Commits, branch naming, PR standards

Git Conventions

A comprehensive reference for Git best practices. Use this skill when you need to follow or enforce Git conventions.

Conventional Commits

Format:

code
type(scope): subject

[optional body]

[optional footer]

Types

TypeEmojiDescriptionExample
featNew featurefeat(auth): add password reset
fix🐛Bug fixfix(cart): prevent negative quantity
docs📝Documentationdocs(readme): add installation steps
style💄Formatting, no code changestyle: fix indentation
refactor♻️Code change, no behavior changerefactor(api): extract validation logic
perfPerformance improvementperf(query): add index on user_id
testAdding/updating teststest(auth): add login edge cases
build📦Build system, dependenciesbuild: upgrade webpack to v5
ci👷CI configurationci: add GitHub Actions workflow
chore🔧Maintenance taskschore: update .gitignore
revertRevert a commitrevert: feat(auth): add password reset
security🔒Security fixsecurity(deps): patch vulnerable package

Subject Rules

  • Use imperative mood: "add" not "added" or "adds"
  • Maximum 50 characters
  • Lowercase (no capitalization)
  • No period at the end

Body Rules

  • Explain the "why", not the "what"
  • Wrap at 72 characters
  • Separate from subject with blank line
  • Plain text only — no markdown, no bullets, no headers
  • Use blank lines to separate paragraphs if needed

Footer Rules

  • Reference issues: Closes #123, Fixes #456, Refs #789
  • Breaking changes: BREAKING CHANGE: description

Breaking Changes

Two ways to indicate:

code
feat(api)!: change response format

BREAKING CHANGE: The API now returns data in a nested structure.

Or just the footer:

code
feat(api): change response format

BREAKING CHANGE: The API now returns data in a nested structure.

Branch Naming

Format: type/short-description

Patterns

TypePatternExample
Featurefeat/descriptionfeat/user-authentication
Bug fixfix/descriptionfix/login-redirect
Hotfixhotfix/descriptionhotfix/payment-crash
Releaserelease/versionrelease/1.2.0
Docsdocs/descriptiondocs/api-reference
Refactorrefactor/descriptionrefactor/database-layer
Testtest/descriptiontest/e2e-checkout

Rules

  • Lowercase only
  • Use hyphens, not underscores
  • Keep it short but descriptive
  • Include ticket number if applicable: feat/AUTH-123-password-reset

Pull Request Standards

Title

Same format as commits:

code
✨ feat(auth): add password reset flow
🐛 fix(orders): prevent duplicate submission

Description Structure

markdown
## What
[Brief description — what this PR does]

## Why
[Context — why is this change needed]

## Changes
- [Key change 1]
- [Key change 2]

## How to Test
1. [Step 1]
2. [Step 2]
3. [Expected result]

## Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No breaking changes (or documented)

## Related
Closes #123

Release Versioning (SemVer)

Format: MAJOR.MINOR.PATCH

IncrementWhenExample
MAJORBreaking changes1.0.02.0.0
MINORNew features (backward compatible)1.0.01.1.0
PATCHBug fixes (backward compatible)1.0.01.0.1

Pre-release Tags

  • Alpha: 1.0.0-alpha.1
  • Beta: 1.0.0-beta.1
  • Release candidate: 1.0.0-rc.1

Changelog Format (Keep a Changelog)

markdown
## [1.2.0] - 2025-01-10

### Added
- New feature description

### Changed
- Change description

### Deprecated
- Deprecated feature

### Removed
- Removed feature

### Fixed
- Bug fix description

### Security
- Security fix description

Mapping from Commits

Commit TypeChangelog Section
featAdded
fixFixed
perfChanged
refactorChanged (if notable)
securitySecurity
deprecateDeprecated
removeRemoved