AgentSkillsCN

changelog

从Git历史中生成变更日志。当用户输入“/changelog”,或希望生成变更日志、获取标签/提交/分支间变更的概要,或需要创建或更新CHANGELOG.md文件时,可使用此功能。触发条件:changelog、自上次以来的变更、Git发布的说明、发生了哪些变化。

SKILL.md
--- frontmatter
name: changelog
description: "Generate a changelog from git history. Use when the user says /changelog, asks to generate a changelog, wants a summary of changes between tags/commits/branches, or needs a CHANGELOG.md file created or updated. Triggers: changelog, changes since, release notes from git, what changed."

Changelog Generator

Generate a well-structured changelog from git history.

Workflow

  1. Detect the repository root via git rev-parse --show-toplevel.
  2. Determine the range:
    • If the user specifies two refs (tags, branches, SHAs), use that range.
    • Otherwise, find the latest tag with git describe --tags --abbrev=0 and use <latest-tag>..HEAD.
    • If no tags exist, use the full history.
  3. Collect commits with git log --pretty=format:"%H|%s|%an|%ad" --date=short <range>.
  4. Categorize each commit by its conventional-commit prefix or keywords:
    • Addedfeat, add
    • Fixedfix, bugfix, patch
    • Changedrefactor, update, change
    • Deprecateddeprecate
    • Removedremove, delete
    • Securitysecurity, vuln
    • Performanceperf
    • Documentationdocs
    • Other — anything that doesn't match
  5. Format output following Keep a Changelog conventions.
  6. If a CHANGELOG.md already exists, prepend the new section below the title. Otherwise create a new file.

Output Format

markdown
# Changelog

## [<version-or-range>] - YYYY-MM-DD

### Added
- Description of feature (SHA short)

### Fixed
- Description of fix (SHA short)

...

Guidelines

  • Use imperative mood in descriptions ("Add feature" not "Added feature").
  • Include short SHA (7 chars) for traceability.
  • Group by category, then sort chronologically within each group.
  • Omit empty categories.
  • If the user requests a specific format (e.g., plain text, JSON), adapt accordingly.
  • For monorepos, offer to scope by directory path using git log -- <path>.