💻

智能 Git 提交

入门开发

基于暂存的更改自动生成有意义的提交消息,遵循约定式提交格式。

gitcommitautomationconventional-commits

Overview

This skill teaches Claude to analyze your staged changes and generate well-structured commit messages that follow the Conventional Commits specification.

SKILL.md Template

---
name: commit
description: Generates meaningful commit messages from staged changes following conventional commits format. Use after staging changes when ready to commit.
disable-model-invocation: true
---

Generate a commit message for the staged changes:

## Steps
1. Run `git diff --staged` to see what's being committed
2. Analyze the nature of changes (feature, fix, refactor, etc.)
3. Generate a commit message following this format:

## Commit Format

    type(scope): subject

    body

    footer

### Types
- **feat**: New feature
- **fix**: Bug fix
- **docs**: Documentation changes
- **style**: Code style (formatting, semicolons)
- **refactor**: Code refactoring
- **perf**: Performance improvements
- **test**: Adding tests
- **chore**: Maintenance tasks

### Rules
- Subject line max 50 characters
- Body wrapped at 72 characters
- Use imperative mood ("Add feature" not "Added feature")
- Reference issues when applicable

## Example Output

    feat(auth): add OAuth2 login support

    - Implement Google OAuth2 provider
    - Add session management for OAuth users
    - Update user model with provider field

    Closes #123

Usage

Simply type /commit after staging your changes:

git add .
# Then in Claude Code
/commit

Why Use This Skill?

  1. Consistency - Every commit follows the same format
  2. Clarity - Messages clearly explain what changed and why
  3. Automation - Saves time writing commit messages
  4. Searchability - Conventional format makes git history searchable

Customization

Add your team's specific conventions:

---
name: commit
description: Generate commit messages following our team conventions
---

Additional rules for our project:
- Always include ticket number (JIRA-XXX)
- Tag breaking changes with BREAKING CHANGE:
- Use scope from: api, ui, db, auth, core

相关技能