AgentSkillsCN

commit-msg

使用常规标签与按文件记录的变更摘要,撰写清晰、结构化的 Git 提交信息。

SKILL.md
--- frontmatter
name: commit-msg
description: Write clear, well-structured git commit messages using conventional tags and per-file change summaries.

Structured Commit Messages

Guides the AI agent through crafting descriptive git commit messages that follow a consistent tag-based format with per-file breakdowns.

When to Use

Invoke this skill whenever you need to commit staged changes. It picks the right tag, writes a clear summary, and lists what changed in each file.

Message Formats

Detailed message (20+ lines changed)

code
[tag]: One-line summary of what this commit achieves

path/to/file1: Brief note on what changed here.
path/to/file2: Brief note on what changed here.

Optional paragraph with extra context, motivation, or a reference to a
related GitHub issue (e.g. "See #42 for background").

Short message (under 20 lines changed)

code
[tag]: One-line summary of what this commit achieves

Choosing a Tag

Look for a project-level tag list first (common locations: docs/git-msg-tags.md, CONTRIBUTING.md). If none exists, fall back to these conventional tags:

TagUse when...
[feat]Adding new functionality
[fix]Correcting a bug
[docs]Updating documentation only
[refactor]Restructuring code without changing behaviour
[test]Adding or changing tests only
[chore]Build scripts, CI, tooling, or dependency updates
[style]Whitespace, formatting, or cosmetic-only changes

Pick whichever tag best describes the primary intent of the commit.

Rules

  • The commit message is authored by the user, not the AI. Never add co-authorship lines or "generated by" attributions.
  • Always honour pre-commit hooks — do not use --no-verify unless the user explicitly requests it.
  • When an issue number is relevant, mention it in the body (e.g. "Relates to #17").

Examples

Detailed:

code
[feat]: Add CSV export endpoint for analytics dashboard

src/api/export.py: New endpoint returning CSV from query results.
src/models/report.py: Added helper to serialize rows to CSV format.
tests/test_export.py: Covers happy-path and empty-result cases.

Closes #34.

Short:

code
[fix]: Correct off-by-one in pagination offset