Changelog Generator
Tier: POWERFUL
Category: Engineering
Domain: Release Management / Documentation
Overview
Use this skill to produce consistent, auditable release notes from Conventional Commits. It separates commit parsing, semantic bump logic, and changelog rendering so teams can automate releases without losing editorial control.
Core Capabilities
- - Parse commit messages using Conventional Commit rules
- Detect semantic bump (
major, minor, patch) from commit stream - Render Keep a Changelog sections (
Added, Changed, Fixed, etc.) - Generate release entries from git ranges or provided commit input
- Enforce commit format with a dedicated linter script
- Support CI integration via machine-readable JSON output
When to Use
- - Before publishing a release tag
- During CI to generate release notes automatically
- During PR checks to block invalid commit message formats
- In monorepos where package changelogs require scoped filtering
- When converting raw git history into user-facing notes
Key Workflows
1. Generate Changelog Entry From Git
CODEBLOCK0
2. Generate Entry From stdin/File Input
CODEBLOCK1
3. Update CHANGELOG.md
CODEBLOCK2
4. Lint Commits Before Merge
CODEBLOCK3
Or file/stdin:
CODEBLOCK4
Conventional Commit Rules
Supported types:
- -
feat, fix, perf, refactor, docs, test, build, ci, INLINECODE15 - INLINECODE16 ,
deprecated, INLINECODE18
Breaking changes:
- - INLINECODE19
- Footer/body includes INLINECODE20
SemVer mapping:
- - breaking -> INLINECODE21
- non-breaking
feat -> INLINECODE23 - all others -> INLINECODE24
Script Interfaces
- Reads commits from git or stdin/
--input
- Renders markdown or JSON
- Optional in-place changelog prepend
- Validates commit format
- Returns non-zero in
--strict mode on violations
Common Pitfalls
- 1. Mixing merge commit messages with release commit parsing
- Using vague commit summaries that cannot become release notes
- Failing to include migration guidance for breaking changes
- Treating docs/chore changes as user-facing features
- Overwriting historical changelog sections instead of prepending
Best Practices
- 1. Keep commits small and intent-driven.
- Scope commit messages (
feat(api): ...) in multi-package repos. - Enforce linter checks in PR pipelines.
- Review generated markdown before publishing.
- Tag releases only after changelog generation succeeds.
- Keep an
[Unreleased] section for manual curation when needed.
References
Release Governance
Use this release flow for predictability:
- 1. Lint commit history for target release range.
- Generate changelog draft from commits.
- Manually adjust wording for customer clarity.
- Validate semver bump recommendation.
- Tag release only after changelog is approved.
Output Quality Checks
- - Each bullet is user-meaningful, not implementation noise.
- Breaking changes include migration action.
- Security fixes are isolated in
Security section. - Sections with no entries are omitted.
- Duplicate bullets across sections are removed.
CI Policy
- - Run
commit_linter.py --strict on all PRs. - Block merge on invalid conventional commits.
- Auto-generate draft release notes on tag push.
- Require human approval before writing into
CHANGELOG.md on main branch.
Monorepo Guidance
- - Prefer commit scopes aligned to package names.
- Filter commit stream by scope for package-specific releases.
- Keep infra-wide changes in root changelog.
- Store package changelogs near package roots for ownership clarity.
Failure Handling
- - If no valid conventional commits found: fail early, do not generate misleading empty notes.
- If git range invalid: surface explicit range in error output.
- If write target missing: create safe changelog header scaffolding.
变更日志生成器
层级: 强大
类别: 工程
领域: 发布管理/文档
概述
使用此技能可从约定式提交生成一致且可审计的发布说明。它将提交解析、语义版本提升逻辑和变更日志渲染分离,使团队能够在不失去编辑控制权的情况下实现发布自动化。
核心能力
- - 使用约定式提交规则解析提交消息
- 从提交流中检测语义版本提升(major、minor、patch)
- 渲染保持变更日志章节(Added、Changed、Fixed 等)
- 从 Git 范围或提供的提交输入生成发布条目
- 通过专用 lint 脚本强制执行提交格式
- 通过机器可读的 JSON 输出支持 CI 集成
使用时机
- - 发布标签之前
- CI 过程中自动生成发布说明
- PR 检查时阻止无效的提交消息格式
- 在需要按范围过滤包变更日志的单仓库中
- 将原始 Git 历史转换为面向用户的说明时
关键工作流
1. 从 Git 生成变更日志条目
bash
python3 scripts/generate_changelog.py \
--from-tag v1.3.0 \
--to-tag v1.4.0 \
--next-version v1.4.0 \
--format markdown
2. 从标准输入/文件输入生成条目
bash
git log v1.3.0..v1.4.0 --pretty=format:%s | \
python3 scripts/generate_changelog.py --next-version v1.4.0 --format markdown
python3 scripts/generate_changelog.py --input commits.txt --next-version v1.4.0 --format json
3. 更新 CHANGELOG.md
bash
python3 scripts/generate_changelog.py \
--from-tag v1.3.0 \
--to-tag HEAD \
--next-version v1.4.0 \
--write CHANGELOG.md
4. 合并前检查提交
bash
python3 scripts/commit_linter.py --from-ref origin/main --to-ref HEAD --strict --format text
或文件/标准输入:
bash
python3 scripts/commit_linter.py --input commits.txt --strict
cat commits.txt | python3 scripts/commit_linter.py --format json
约定式提交规则
支持的类型:
- - feat、fix、perf、refactor、docs、test、build、ci、chore
- security、deprecated、remove
破坏性变更:
- - type(scope)!: summary
- 页脚/正文包含 BREAKING CHANGE:
语义化版本映射:
- - 破坏性变更 -> major
- 非破坏性 feat -> minor
- 其他所有 -> patch
脚本接口
- - python3 scripts/generate_changelog.py --help
- 从 Git 或标准输入/--input 读取提交
- 渲染 markdown 或 JSON
- 可选的原位变更日志前置
- - python3 scripts/commit_linter.py --help
- 验证提交格式
- 在 --strict 模式下违规时返回非零值
常见陷阱
- 1. 混淆合并提交消息与发布提交解析
- 使用无法成为发布说明的模糊提交摘要
- 未能包含破坏性变更的迁移指南
- 将 docs/chore 变更视为面向用户的功能
- 覆盖历史变更日志章节而非前置
最佳实践
- 1. 保持提交小而精,意图明确。
- 在多包仓库中限定提交消息范围(feat(api): ...)。
- 在 PR 流水线中强制执行 lint 检查。
- 发布前审查生成的 markdown。
- 仅在变更日志生成成功后打标签发布。
- 需要时保留 [Unreleased] 章节用于手动整理。
参考
发布治理
使用此发布流程确保可预测性:
- 1. 检查目标发布范围的提交历史。
- 从提交生成变更日志草稿。
- 手动调整措辞以提升客户清晰度。
- 验证语义化版本提升建议。
- 仅在变更日志获批后打标签发布。
输出质量检查
- - 每个要点对用户有意义,而非实现噪音。
- 破坏性变更包含迁移操作。
- 安全修复隔离在 Security 章节。
- 无条目的章节省略。
- 跨章节的重复要点已移除。
CI 策略
- - 在所有 PR 上运行 commit_linter.py --strict。
- 对无效的约定式提交阻止合并。
- 标签推送时自动生成草稿发布说明。
- 在 main 分支上写入 CHANGELOG.md 前需要人工审批。
单仓库指南
- - 优先使用与包名对齐的提交范围。
- 按范围过滤提交流以生成特定包的发布。
- 将基础设施范围的变更保留在根变更日志中。
- 将包变更日志存储在包根目录附近,以明确所有权。
失败处理
- - 如果未找到有效的约定式提交:提前失败,不生成误导性的空说明。
- 如果 Git 范围无效:在错误输出中明确显示范围。
- 如果写入目标缺失:创建安全的变更日志头部脚手架。