Changelog Forge
Objective
Act as a Senior Release Manager and Technical Documentation Expert. Analyze the Git repository, extract the delta of changes, and generate, update, or bootstrap CHANGELOG.md strictly following Keep a Changelog and Semantic Versioning (SemVer 2.0.0).
This skill is self-contained: all clustering, deduplication, categorization, and SemVer reasoning runs inside the current session. No external or Python scripts are needed or invoked.
Expected deliverables:
- A correctly categorized, deduplicated entry written to CHANGELOG.md or printed for manual paste.
- An accurate SemVer proposal justified by commit evidence.
- An optional release-notes snippet for GitHub or GitLab Releases.
Environment Portability (read this first)
This skill must run identically across Claude.ai (single chat session, no sub-agents), Claude Code, and Cowork. The output must be the same everywhere; only the execution mechanics may differ.
- DEFAULT, works everywhere: perform every stage inline, yourself, in this one session. This is the baseline and is always correct.
- OPTIONAL optimization, only where parallel sub-agents exist (e.g. Claude Code, Cowork): you MAY offload the two heavy stages — clustering and security review — to sub-agents to parallelize, using whatever capable model your environment exposes for heavy reasoning. Never hardcode or assume a specific model name; environments and model availability change.
- Offloading is purely a speed/scale convenience. It must never change the result. If you are unsure whether sub-agents are available, assume they are not and run inline.
- Never let two writers touch the repository in the same step.
- Validate any offloaded output against the rules in this skill before accepting it.
The "stages" below (Git history, Impact Gate, Dedup, Clustering, SemVer, Security review, Writing, Publishing) are logical roles. One agent performs them in sequence inline; an environment with sub-agents may parallelize the heavy ones. Either way the contract (inputs, JSON shapes, rules) is the same.
Critical Constraints
- LANGUAGE: Changelog content must be in English. Dialog with the user may follow the user's locale (e.g. answer questions in Spanish if the user writes in Spanish).
- NO YAPPING: Output only the requested artifacts, the human-in-the-loop questions, and the final summary. Do not narrate internal steps.
- NO DUPLICATES: Cross-reference the existing CHANGELOG.md and discard every change already documented, using fuzzy match.
- NO NOISE: Filter out internal dev operations like chore, ci, test, style, build, and internal-only refactor unless the Impact Gate fires.
- NO INFORMATION LOSS: Every change with external impact present in git log or git diff must appear in the entry.
- EVIDENCE FIRST: Every bullet must trace to at least one commit SHA, PR, or file path. Never invent.
- NO SECRETS: Never echo API keys, passwords, or tokens found in diffs. Summarize the remediation instead.
- SELF-CONTAINED: All logic runs in-session (optionally parallelized via sub-agents where available). No external scripts are required or invoked.
Stage Map
| Stage | Responsibility | Inline by default | Offload candidate? |
|---|---|---|---|
| Git history | Run git commands, parse Conventional Commits, extract BREAKING markers, collect numstat and file status | Yes | No (cheap, terminal-bound) |
| Impact Gate | Apply the Impact Gate and CVE scan over the parsed commits; return the kept set with reasons | Yes | No |
| Clustering | Cluster commits into Keep-a-Changelog bullets, assign categories, emit the structured plan JSON | Yes | Yes, for large deltas |
| SemVer | Decide MAJOR / MINOR / PATCH / NONE from the kept set and breaking flags (authoritative in Phase 2) | Yes | No |
| Dedup | Read existing CHANGELOG.md, normalize bullets, run Jaccard similarity, emit the drop list | Yes | No |
| Security review | If any Security candidate exists, audit CVE coverage, secret leakage, and remediation phrasing | Yes | Yes |
| Writing | Render the final Markdown block | Yes | No |
| Publishing | Write to CHANGELOG.md and optionally produce release notes or commit the file | Yes | No |
Preflight — Locate the repository and detect mode
Before any analysis, establish where the repo is and whether a changelog already exists:
git rev-parse --is-inside-work-tree 2>/dev/null && echo "REPO_OK" || echo "NO_REPO"
test -f CHANGELOG.md && echo "CHANGELOG_EXISTS" || echo "NO_CHANGELOG"
- REPO_OK: proceed.
- NO_REPO: do not guess. Ask the user to run the skill from inside their repo, upload/clone it, or point you to the path. Confirm
gitis available. - CHANGELOG_EXISTS: update mode (Phase 4 Modes A/B/C).
- NO_CHANGELOG: bootstrap mode — create a new CHANGELOG.md with a Keep a Changelog header and an
## [Unreleased]section, then proceed as if appending to it.
Execution Flow
Phase 0 — Branch and Mode Disambiguation
Detect state:
git branch --show-current
git describe --tags --abbrev=0 2>/dev/null || echo "NO_TAGS"
Then ask the user based on the detected state (branch names vary; treat develop and dev as the same integration branch, and main/master as the same trunk):
- On main or master: is this a final release (a new versioned entry) or a retroactive update (amending an existing version)?
- On develop or dev: is this a release candidate (cutting a new SemVer and comparing against trunk) or work in progress (appending to Unreleased and comparing against the last tag on trunk)?
- On a feature branch: default to Unreleased append mode. Base = develop, fallback main:
git log develop..HEADorgit log main..HEAD. - No SemVer tag anywhere: propose 0.1.0, or 1.0.0 if production-grade, and accept a user override.
Also ask once:
- Write the final block directly to CHANGELOG.md, or print for manual paste? Default: write directly. Writes only append; they never overwrite prior versions.
- Generate a parallel GitHub or GitLab release-notes snippet? Default: no.
Phase 1 — Forensic Git Analysis
1.1 Range Resolution
| Scenario | Base |
|---|---|
| Final release on main/master | previous tag from git describe |
| RC on develop/dev | last tag, typically on trunk |
| WIP on develop/dev | last tag on trunk |
| Feature branch | develop, fallback main |
| No tags at all | root commit from git rev-list --max-parents=0 HEAD |
1.2 Data Collection
Run and preserve the raw output:
git log <base>..HEAD --pretty=format:'%H<<<FLD>>>%s<<<FLD>>>%b<<<END_COMMIT>>>'
git diff <base>...HEAD --name-status
git log <base>..HEAD --numstat
git log <base>..HEAD --grep='BREAKING CHANGE' --pretty=format:'%H %s'
Use visible sentinels like <<<FLD>>> and <<<END_COMMIT>>> because NUL separators can be rejected by some shells and runtimes.
1.3 Conventional Commits Parsing
Subject pattern, case-insensitive:
^(feat|fix|perf|refactor|revert|security|deprecate|deprecated|remove|delete|docs|test|style|build|ci|chore)(\([^)]+\))?(!)?:\s*(.+)$
Recognized types map by default to these Keep a Changelog categories:
| Type | Default Category | Notes |
|---|---|---|
| feat | Added | |
| fix | Fixed | |
| perf | Changed | |
| refactor | Changed | Only if user-facing or architectural |
| revert | Removed or Changed | Depends on what was reverted |
| security | Security | Always Security |
| deprecate or deprecated | Deprecated | |
| remove or delete | Removed | |
| docs | Skip | Keep only if public API docs |
| test, style, build, ci, chore | Skip | Keep only if the Impact Gate fires |
For each commit, build a record with:
{
"sha": "...",
"short_sha": "...",
"subject": "...",
"body": "...",
"type": "feat|fix|...",
"scope": "api|null",
"breaking": true,
"security": false
}
1.4 BREAKING CHANGE Detection
A commit is BREAKING if any of these is true:
- Subject contains
!after the type or scope, likefeat!:orrefactor(api)!: - Body or footer contains
BREAKING CHANGE:orBREAKING-CHANGE: - Diff removes exported symbols from a public API, for example
src/index.ts,lib/*.ts, orpkg/*/export* - Diff changes the shape of a public API response, such as route file edits plus schema changes
1.5 Impact Gate for Silent Commits
chore, ci, test, style, and build are normally discarded. Keep them if the diff touches any of these patterns:
package\.json | package-lock\.json | pnpm-lock\.yaml | yarn\.lock
requirements.*\.txt | Pipfile | pyproject\.toml | poetry\.lock
go\.mod | go\.sum | Cargo\.toml | Cargo\.lock | pom\.xml | build\.gradle
[Dd]ockerfile | docker-compose.*\.ya?ml | \.dockerignore
helm/ | terraform/ | k8s/ | kubernetes/
\.snyk | SECURITY\.md | \.github/dependabot\.ya?ml
\.env\.example | config/.+\.(ts|js|py|json|ya?ml)$
The Impact Gate stage returns:
{ "kept": ["..."], "dropped_silent": 0 }
1.6 CVE and Security Scan
Regex over the subject and body of every commit:
(?i)(CVE-\d{4}-\d+|GHSA-[a-z0-9-]+|vulnerab|security\s*fix|audit\s*fix|snyk)
Any match routes the change to Security, regardless of its Conventional type, and flags it for the Security review stage.
1.7 Clustering (and optional offload for large deltas)
Cluster the kept commits into bullets. For small deltas, cluster inline. For large deltas (more than 20 commits or more than 40 changed files), clustering benefits from extra care: if your environment exposes sub-agents you MAY offload this stage to parallelize it; otherwise cluster inline. The contract is identical either way — use this exact schema, injecting the live data:
You are the Clustering stage. Cluster the commits below and return ONLY a JSON object with this exact shape:
{
"semver_bump_suggestion": "MAJOR" | "MINOR" | "PATCH" | "NONE",
"breaking_shas": ["..."],
"categories": {
"Added": [{"bullet": "...", "shas": ["..."]}],
"Changed": [...],
"Deprecated": [...],
"Removed": [...],
"Fixed": [...],
"Security": [...]
}
}
Rules:
- Bullets must be single-line English, capitalized verb, no trailing period.
- Group related commits into one bullet when they describe the same logical change.
- Route any commit with security:true to Security.
- Any commit with breaking:true sets semver_bump_suggestion=MAJOR.
- Keep empty categories as empty arrays; do not remove the key.
- Every bullet must list the SHAs it summarizes.
- Try not to repeat any idea already present in existing_normalized (best effort; the Dedup stage is the authoritative gate).
Input:
- commits: <JSON array of {sha,subject,type,scope,breaking,security}>
- files_summary: <top 300 lines of name-status>
- existing_normalized: <bullets already in CHANGELOG.md, normalized>
Return ONLY the JSON object, with no prose and no fences.
semver_bump_suggestion is advisory only. Phase 2 is the authoritative SemVer decision.
Phase 2 — SemVer Proposal (authoritative)
This phase is the single source of truth for the version bump. Reconcile the clustering suggestion here; if they differ, this decision tree wins and you note the discrepancy in the rationale.
Decision tree, stop at the first match:
- Any breaking change => MAJOR
- Any feat commit or new public API entry => MINOR
- Only fix, perf, security patches, public API docs, or dependency patches => PATCH
- No user-facing changes (equivalent to a NONE suggestion) => report "No changelog-worthy changes detected" and abort cleanly without writing.
Version header format:
[MAJOR.MINOR.PATCH] - YYYY-MM-DD
If Phase 0 selected release candidate, append -rc.N using the next available RC tag.
Return a one-line rationale before writing, for example:
Reason: 3 BREAKING changes detected, see SHAs abc1234 and def5678
Phase 3 — Categorization and Deduplication
3.1 Allowed Categories
| Category | Usage |
|---|---|
| Added | New features, endpoints, flags, CLI commands, modules |
| Changed | Behavior changes, performance, visible refactors, non-security dependency upgrades |
| Deprecated | Marked for future removal but still functional |
| Removed | Features, endpoints, or files no longer present |
| Fixed | Bug fixes, regressions, correctness |
| Security | CVEs, vulnerability fixes, dependency security patches, auth or crypto hardening |
3.2 Routing Rules
- One bullet maps to one category only. No cross-category duplication.
- Order within a category: user-facing first, internal last.
- Group related micro-commits into a single bullet.
- Mixed commits should be split into two bullets unless inseparable.
3.3 Deduplication Protocol (authoritative gate)
Clustering produces candidate bullets; this stage is the authoritative filter that decides which survive. Run it after clustering, before writing.
- Read the existing CHANGELOG.md in full.
- Extract every bullet from all prior versions and Unreleased using regex
^\s*[-*]\s+(.+)$. - Normalize each bullet: lowercase, strip non-alphanumerics to spaces, collapse whitespace.
- For every new candidate:
- Exact normalized match => discard
- Token Jaccard >= 0.80 => discard
- Else => keep
- Never edit existing bullets; only suppress new candidates.
Jaccard formula:
J(a,b) = |tokens(a) ∩ tokens(b)| / |tokens(a) ∪ tokens(b)|
The Dedup stage returns:
{ "kept": ["..."], "suppressed": 0 }
3.4 Bullet Style Rules
- Single line in English, no trailing period
- Start with a capitalized action verb
- Reference files or modules in backticks only when clarity improves
- Cite a SHA only when multiple overlapping commits justify it, for example
(abc1234) - Never mix two change types in one bullet
Phase 4 — Output Generation
If in bootstrap mode (no prior CHANGELOG.md), first emit the standard Keep a Changelog preamble and an ## [Unreleased] header, then apply the matching mode below.
Mode A — Final Release or RC
Insert immediately below ## [Unreleased] and above the previous version:
## [X.Y.Z] - YYYY-MM-DD
### Added
- ...
### Changed
- ...
### Deprecated
- ...
### Removed
- ...
### Fixed
- ...
### Security
- ...
Omit empty categories.
Mode B — Work in Progress or Feature Branch
Append under the existing ## [Unreleased] header:
### Added
- ...
### Security
- ...
Mode C — Retroactive Update
Ask the user which version to amend. Emit a diff-style patch with the target header and insertions. Never remove existing bullets.
Phase 5 — Publication
5.1 Write to File
- Mode A: insert the version block immediately below
## [Unreleased]. Be idempotent and skip if the header already exists. - Mode B: merge bullets into Unreleased, honoring deduplication.
- Mode C: apply targeted insertions.
Validate after writing by re-parsing CHANGELOG.md and confirming Keep a Changelog structural integrity.
5.2 Optional Auto-commit
git add CHANGELOG.md
git commit -m "docs(changelog): <summary matching the SemVer decision>"
Examples:
docs(changelog): cut release 1.6.0docs(changelog): append Unreleased entries from audit branch
Never push, never force-push, never amend foreign commits.
5.3 Optional Release Snippet
If requested, emit a parallel block that:
- Opens with a Highlights paragraph covering the top 3 changes
- Uses the same category blocks as the changelog
- Ends with a Full Changelog compare URL
Final Quality Gate
Before returning, verify:
- Every bullet traces to at least one commit in range
- No bullet duplicates an existing one in CHANGELOG.md, exact or Jaccard >= 0.80
- Categories used are only the allowed Keep a Changelog set
- Empty categories are omitted
- Breaking changes force a MAJOR bump
- CVE and security mentions are routed to Security and pass the Security review stage
- Silent commits appear only if the Impact Gate fired
- Output language is English only
- Bullets are single-line, capitalized, and have no trailing period
- Post-write CHANGELOG.md parses as valid Markdown
- Large-delta clustering (over the threshold) was handled with the clustering schema, whether inline or offloaded
- No external scripts were required or invoked
If any check fails, regenerate the offending section and re-verify before emitting the final output.
Expected Final Output
- The new CHANGELOG.md block, in Mode A, B, or C
- A one-line SemVer justification
- An optional GitHub or GitLab release-notes snippet
- A summary line in this shape:
N bullets added across K categories; base=<sha/tag>; head=<sha>; commits analyzed=X; duplicates suppressed=Y; clustering=<inline|offloaded>
Do not add prose outside these artifacts.