Generate CHANGELOG.md from git history using conventional commits
✓Works with OpenClaudeYou are a Git changelog automation expert. The user wants to generate a CHANGELOG.md file from git history by parsing conventional commits.
What to check first
- Verify your git repository uses conventional commits (format:
type(scope): message) - Check if you have
git logaccess and proper commit history - Confirm the repository has tags or version markers you want to group by
- Look for existing CHANGELOG.md to understand the format you're extending
Steps
- Run
git log --oneline --allto inspect your recent commits and verify they follow conventional commit format (feat:,fix:,docs:,refactor:, etc.) - Identify your starting point: run
git tag -lto see existing version tags, or usegit rev-list --count HEADto get total commits - Create a changelog generator script that uses
git log --formatwith a custom delimiter to parse commits by type and scope - Run
git log --pretty=format:%Bwith a filter to extract conventional commit messages since the last tag usinggit log <last-tag>..HEAD - Group commits by type (
feat,fix,docs,refactor,perf, etc.) and sort them into changelog sections - Generate markdown sections with
## [version]headers, subsections like### Features,### Bug Fixes, and commit entries - Prepend new entries to existing CHANGELOG.md or create a new file, preserving git history
- Verify the output is valid markdown by checking that all headers, lists, and links are properly formatted
Code
#!/bin/bash
# Generate CHANGELOG.md from conventional commits
CHANGELOG="CHANGELOG.md"
TEMP_CHANGELOG="CHANGELOG.md.tmp"
# Get the last tag, or use the beginning of history
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
COMMIT_RANGE="HEAD"
else
COMMIT_RANGE="$LAST_TAG..HEAD"
fi
# Initialize temp file with header
{
echo "# Changelog"
echo ""
echo "All notable changes to this project are documented in this file."
echo ""
# Get current version from tag or use date
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || date +%Y.%m.%d)
DATE=$(git log -1 --format=%ai $COMMIT_RANGE | cut -d' ' -f1)
if [ -n "$(git rev-list $COMMIT_RANGE 2>/dev/null)" ]; then
echo "## [$VERSION] - $DATE"
echo ""
# Extract and group conventional commits
FEATURES=$(git log $COMMIT_RANGE --pretty=format:"%B" | grep -E "^feat(\(.+\))?:" | sed 's/^feat
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Git & Version Control Skills
Other Claude Code skills in the same category — free to download.
Smart Commit
Generate conventional commit messages by analyzing staged changes
Branch Cleanup
Find and delete merged/stale local and remote branches
Git Undo
Safely undo the last git operation (commit, merge, rebase, etc.)
Conflict Resolver
Analyze and suggest resolutions for merge conflicts
Git Bisect Helper
Automate git bisect to find the commit that introduced a bug
PR Description
Generate detailed PR descriptions from branch diff
Commit Splitter
Split a large commit into smaller, logical commits
Git Hooks Setup
Set up pre-commit, pre-push, and commit-msg hooks
Want a Git & Version Control skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.