Changelog from git
Produce an accurate, human-readable changelog section from commits between two refs, then polish it. The bundled script does the mechanical work; you do the editorial pass.
1. Establish the range
git fetch --tags --quiet # tags may be missing in shallow/CI clones
git describe --tags --abbrev=0 # latest tag reachable from HEAD
git log --oneline <last-tag>..HEAD | wc -l
- No tags → the whole history is in range; confirm with the user before generating a huge first changelog (suggest
--from <first-meaningful-commit>). - Shallow clone (
git rev-parse --is-shallow-repositoryprintstrue) → rungit fetch --unshallowfirst or results will be truncated. - Squash-merge repos: plain commits carry
(#123)→ PR links work automatically. - Merge-commit repos ("Merge pull request #12 from ..."): add
--include-mergesso the PR title (first body line) is used.
2. Generate the draft
python <skill-dir>/scripts/changelog.py --version 1.4.0 # print section to stdout
python <skill-dir>/scripts/changelog.py --from v1.3.0 --to HEAD --version 1.4.0 --prepend CHANGELOG.md
python <skill-dir>/scripts/changelog.py --format json # structured data + suggested_bump
Useful flags: --all (include Documentation/Internal), --authors, --repo-url none (no links), --date YYYY-MM-DD, --include-merges.
The script prints suggested_bump=major|minor|patch on stderr (breaking → major, feat/deprecation → minor, else patch).
Classification rules:
- Conventional types map to sections:
feat→Added,fix→Fixed,perf→Performance,refactor/revert→Changed,deps→Dependencies,docs→Documentation,chore|ci|build|test|style→Internal (hidden by default). type!:or aBREAKING CHANGE:footer → also listed under Breaking Changes with the footer text.- Free-form messages are classified by keywords (fix/bug/crash → Fixed, add/implement/support → Added, remove/drop → Removed, bump/upgrade X to Y → Dependencies, security/CVE → Security). Everything else → Changed.
- Commits containing
[skip changelog]or[no changelog]are omitted.
3. Editorial pass (do not skip)
The draft is commit-shaped; a changelog must be user-shaped. For every entry:
- Rewrite for the reader: describe the effect, not the implementation. "Fix NPE in UserSvc" → "Fix crash when opening a profile with no avatar".
- Merge duplicates: several commits for one feature → one bullet listing all PR refs.
- Re-file misclassified items: heuristic output for free-form commits is ~80% right; read each "Changed" bullet and move it if needed.
- Drop noise: reverted-then-reapplied pairs, "address review comments", "wip", formatting.
- Breaking changes need migration steps: what breaks, who is affected, exact replacement code/config. If unknown, ask the user or read the diff (
git show <sha>). - Security entries: mention CVE IDs and affected versions; never include exploit details.
- Keep links (PR/commit) — they are the audit trail.
4. Output template
## [1.4.0] - 2026-01-15
### Breaking Changes
- **api:** `GET /v1/items` now paginates by default (page size 50) — pass `?limit=0` for the old behaviour ([#214](...))
### Added
- CSV export from the reports page ([#201](...), [#209](...))
### Fixed
- Crash when opening a profile without an avatar ([#205](...))
[1.4.0]: https://github.com/OWNER/REPO/compare/v1.3.0...v1.4.0
5. Verify before finishing
- Version number matches the suggested bump (or the user explicitly overrode it).
- No entry references internal-only names (ticket IDs alone, class names) without context.
-
## [Unreleased]section, if present, is preserved above the new release. - Compare link at the bottom points to the right tags.
- Show the final diff of CHANGELOG.md to the user; do not create tags or commits unless asked.