AgentSkillsCN

conventional-commits

编写并校验符合Conventional Commits规范的提交信息。适用于以下场景:(1) 按照Conventional Commits规范撰写提交信息;(2) 将现有提交信息转换为Conventional Commits格式;(3) 校验提交信息是否符合规范;(4) 解释或传授Conventional Commits的使用模式;(5) 在项目中为Conventional Commits配置相关工具链。

SKILL.md
--- frontmatter
name: conventional-commits
description: Write and validate Conventional Commits formatted commit messages. Use when needs to (1) Write commit messages following Conventional Commits specification, (2) Convert existing commit messages to Conventional Commits format, (3) Validate if a commit message follows the specification, (4) Explain or teach Conventional Commits patterns, or (5) Set up tooling for Conventional Commits in a project.

Conventional Commits

A specification for adding human and machine readable meaning to commit messages.

Quick Reference

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

[optional body]

[optional footer(s)]

Types (Required)

TypeDescriptionExample
featNew featurefeat: add user authentication
fixBug fixfix: resolve null pointer exception
docsDocumentation onlydocs: update API reference
styleCode style (formatting)style: fix indentation
refactorCode restructuringrefactor: simplify login logic
perfPerformance improvementperf: optimize database queries
testAdding/correcting teststest: add unit tests for auth
buildBuild system changesbuild: update webpack config
ciCI/CD changesci: add GitHub Actions workflow
choreMaintenance taskschore: update dependencies
revertRevert previous commitrevert: feat: user auth

Scopes (Optional)

  • Use to specify which component is affected
  • Can be any noun describing a section of the codebase
  • Examples: feat(api):, fix(auth):, docs(readme):

Breaking Changes

Append ! after type/scope, or use BREAKING CHANGE: in footer:

code
feat(api)!: remove deprecated endpoints

BREAKING CHANGE: The /v1/users endpoint has been removed.
Use /v2/users instead.

Writing Guidelines

  1. Use imperative mood: "add feature" not "added feature" or "adds feature"
  2. Don't capitalize first letter: feat: add feature not feat: Add feature
  3. No trailing period in description
  4. Keep subject under 50 characters when possible
  5. Use body to explain what and why, not how

Common Patterns

Simple commit

code
fix: correct typo in README

With scope

code
feat(auth): implement JWT token refresh

With body

code
feat: add user profile page

Add a new page for users to view and edit their profile.
Includes avatar upload and bio editing.

With footer (referencing issues)

code
fix: resolve memory leak in data parser

The parser was not releasing buffer memory after processing
large files. Added explicit cleanup in finally block.

Fixes #123
Closes #456

Breaking change

code
feat(api)!: change response format for /users

BREAKING CHANGE: Response now returns `users` array instead
of direct array at root level.

Migration:
- Old: `data[0].name`
- New: `data.users[0].name`

Validation

A valid Conventional Commit message:

  • Has a valid type prefix
  • Has a colon and space after type/scope
  • Has a non-empty description
  • (Optional) Body and footer follow blank line separation

References