AgentSkillsCN

commit-classification

根据常规提交规范对提交进行分类,并将其映射至变更日志类别。在为变更日志分类变更内容,或了解提交类型时,可使用此技能。

SKILL.md
--- frontmatter
name: commit-classification
description: Classifies commits according to conventional commits specification and maps them to changelog categories. Use when categorizing changes for changelogs or understanding commit types.
allowed-tools: Read, Grep, Bash
model: haiku
user-invocable: true

Commit Classification Skill

Classify git commits according to the Conventional Commits specification (v1.0.0) and map them to appropriate changelog categories.

Conventional Commits Format

code
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Commit Types and Changelog Mapping

TypeDescriptionChangelog Category
featNew featureAdded
fixBug fixFixed
docsDocumentation onlyDocumentation
styleFormatting, no code change(usually omitted)
refactorCode change, no feature/fixChanged
perfPerformance improvementChanged
testAdding/correcting tests(usually omitted)
buildBuild system changesChanged
ciCI configuration(usually omitted)
choreMaintenance tasks(usually omitted)
revertReverts a commitRemoved

Breaking Changes

Breaking changes are indicated by:

  1. ! after type/scope: feat!: remove deprecated API
  2. BREAKING CHANGE: footer in commit body
  3. BREAKING-CHANGE: footer (alternative format)

Breaking changes always go to Changed with special notation.

Scope Examples

Common scopes for release-agent:

  • feat(cli): - CLI changes
  • fix(workflow): - Workflow fixes
  • docs(readme): - README updates
  • refactor(actions): - Action refactoring

Classification Process

Using schangelog (Recommended)

bash
# Parses commits and suggests categories
schangelog parse-commits --since=<tag>

Manual Classification

bash
# Get commit subjects
git log <tag>..HEAD --format="%s"

# Parse each commit:
# 1. Extract type (before colon)
# 2. Check for ! (breaking)
# 3. Extract scope (in parentheses)
# 4. Map to changelog category

Output Format

When classifying commits, output:

code
Commit: <hash>
Subject: <subject>
Type: <type>
Scope: <scope or none>
Breaking: <yes/no>
Category: <changelog category>

Example Classifications

code
Commit: abc1234
Subject: feat(api): add new endpoint for releases
Type: feat
Scope: api
Breaking: no
Category: Added

Commit: def5678
Subject: fix!: correct version parsing
Type: fix
Scope: none
Breaking: yes
Category: Changed (Breaking)

Commit: ghi9012
Subject: docs: update installation guide
Type: docs
Scope: none
Breaking: no
Category: Documentation