AGENT SKILL

Git 提交信息生成

Git Commit Helper

通过分析 git diff 生成描述性的提交信息。当用户请求帮助编写提交信息或审查暂存的更改时使用。

License 许可
MIT
最近更新
2025-12-20
Stars
★ 2
Forks
2

01 前言 Front Matter

name
Git Commit Helper
description
Generate descriptive commit messages by analyzing git diffs. Use when the user asks for help writing commit messages or reviewing staged changes.

03 SKILL.md 正文

Git Commit Helper

Quick start

Analyze staged changes and generate commit message:

# View staged changes
git diff --staged

# Generate commit message based on changes
# (Claude will analyze the diff and suggest a message)

Commit message format

Follow conventional commits format:

<type>(<scope>): <description>

[optional body]

[optional footer]

Types

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style changes (formatting, missing semicolons)
  • refactor: Code refactoring
  • test: Adding or updating tests
  • chore: Maintenance tasks

Examples

Feature commit:

feat(auth): add JWT authentication

Implement JWT-based authentication system with:
- Login endpoint with token generation
- Token validation middleware
- Refresh token support

Bug fix:

fix(api): handle null values in user profile

Prevent crashes when user profile fields are null.
Add null checks before accessing nested properties.

Refactor:

refactor(database): simplify query builder

Extract common query patterns into reusable functions.
Reduce code duplication in database layer.

Analyzing changes

Review what's being committed:

# Show files changed
git status

# Show detailed changes
git diff --staged

# Show statistics
git diff --staged --stat

# Show changes for specific file
git diff --staged path/to/file

Commit message guidelines

DO:

  • Use imperative mood ("add feature" not "added feature")
  • Keep first line under 50 characters
  • Capitalize first letter
  • No period at end of summary
  • Explain WHY not just WHAT in body

DON'T:

  • Use vague messages like "update" or "fix stuff"
  • Include technical implementation details in summary
  • Write paragraphs in summary line
  • Use past tense

Multi-file commits

When committing multiple related changes:

refactor(core): restructure authentication module

- Move auth logic from controllers to service layer
- Extract validation into separate validators
- Update tests to use new structure
- Add integration tests for auth flow

Breaking change: Auth service now requires config object

Scope examples

Frontend:

  • feat(ui): add loading spinner to dashboard
  • fix(form): validate email format

Backend:

  • feat(api): add user profile endpoint
  • fix(db): resolve connection pool leak

Infrastructure:

  • chore(ci): update Node version to 20
  • feat(docker): add multi-stage build

Breaking changes

Indicate breaking changes clearly:

feat(api)!: restructure API response format

BREAKING CHANGE: All API responses now follow JSON:API spec

Previous format:
{ "data": {...}, "status": "ok" }

New format:
{ "data": {...}, "meta": {...} }

Migration guide: Update client code to handle new response structure

Template workflow

  1. Review changes: git diff --staged
  2. Identify type: Is it feat, fix, refactor, etc.?
  3. Determine scope: What part of the codebase?
  4. Write summary: Brief, imperative description
  5. Add body: Explain why and what impact
  6. Note breaking changes: If applicable

Interactive commit helper

Use git add -p for selective staging:

# Stage changes interactively
git add -p

# Review what's staged
git diff --staged

# Commit with message
git commit -m "type(scope): description"

Amending commits

Fix the last commit message:

# Amend commit message only
git commit --amend

# Amend and add more changes
git add forgotten-file.js
git commit --amend --no-edit

Best practices

  1. Atomic commits - One logical change per commit
  2. Test before commit - Ensure code works
  3. Reference issues - Include issue numbers if applicable
  4. Keep it focused - Don't mix unrelated changes
  5. Write for humans - Future you will read this

Commit message checklist

  • [ ] Type is appropriate (feat/fix/docs/etc.)
  • [ ] Scope is specific and clear
  • [ ] Summary is under 50 characters
  • [ ] Summary uses imperative mood
  • [ ] Body explains WHY not just WHAT
  • [ ] Breaking changes are clearly marked
  • [ ] Related issue numbers are included

04 同仓库更多 Skills

swesmith
swesmith/davila7__claude-code-templates.734b8a50

技能模板

template-skill

替换为对该技能的描述,以及 Claude 应在何时使用它。

AI 工程师示例与演示技能
★ 2
swesmith
swesmith/davila7__claude-code-templates.734b8a50

域名创意生成

domain-name-brainstormer

为你的项目生成富有创意的域名创意,并检查多个顶级域名(.com、.io、.dev、.ai 等)的可用性。节省数小时的头脑风暴和手动查询时间。

软件开发工程师DNS 与域名管理
★ 2
swesmith
swesmith/davila7__claude-code-templates.734b8a50

抽奖获奖者抽取

raffle-winner-picker

从列表、电子表格或 Google Sheets 中为赠品发放、抽奖和竞赛随机抽取获奖者。确保选择公平、无偏见且透明。

营销专员抽奖活动与随机抽取
★ 2
swesmith
swesmith/davila7__claude-code-templates.734b8a50

会议洞察分析

meeting-insights-analyzer

分析会议记录和录音,发现行为模式、沟通洞察以及可操作的反馈。识别你何时回避冲突、使用填充词、主导对话或错失倾听机会。非常适合希望提升沟通能力和领导力的专业人士。

知识工作者会议洞察分析
★ 2
swesmith
swesmith/davila7__claude-code-templates.734b8a50

发票收据整理

invoice-organizer

通过读取杂乱的文件、提取关键信息、统一重命名并分类到合理的文件夹中,自动整理发票和收据以备报税。将数小时的手工记账工作缩短为几分钟的自动化整理。

会计计费与发票管理
★ 2
swesmith
swesmith/davila7__claude-code-templates.734b8a50

智能文件整理

file-organizer

通过理解上下文、查找重复文件、建议更优的文件结构并自动执行清理任务,智能地整理电脑中的文件和文件夹。减少认知负担,无需手动操作即可保持数字工作空间整洁。

普通用户文件系统操作与管理
★ 2