---
name: "changelog-generator"
description: "Transform raw git commit history into a polished CHANGELOG entry in Keep a Changelog format. Categorizes, rewrites, and suggests the correct semver bump."
metadata:
  version: "1.0.0"
---

# Changelog Generator

> **Purpose:** Transform raw git commit history into a human-readable, user-facing CHANGELOG entry in Keep a Changelog format. Categorizes commits, rewrites them in plain language, and recommends the correct semver version bump.

---

## Invocation

```
/changelog [since-tag]
```

Internally runs:
```bash
git log $(git describe --tags --abbrev=0)..HEAD --format="%H %s" --no-merges
```

If `since-tag` is provided, uses that as the baseline instead of auto-detecting the last tag.

---

## Process

### Step 1: Collect Commits

```bash
git log [since-tag]..HEAD --format="%H|||%s|||%b" --no-merges
```

If no commits found: output "No changes since last release."

---

### Step 2: Categorize by Conventional Commit Prefix

| Prefix | Changelog Section |
|--------|-------------------|
| `feat:` / `feature:` | ### Added |
| `fix:` / `bugfix:` | ### Fixed |
| `perf:` | ### Changed |
| `refactor:` | ### Changed |
| `docs:` | ### Changed |
| `remove:` / `deprecate:` | ### Removed |
| `security:` | ### Security |
| `BREAKING CHANGE` in body | ### Breaking Changes |
| `chore:` / `test:` / `ci:` | **omit** (internal, not user-facing) |

Non-conventional commits: use judgment based on commit message content.

---

### Step 3: Rewrite for Humans

Transform commit messages into user-facing language:
- `fix(auth): resolve JWT expiry edge case` → "Fixed a login session expiry bug that logged users out unexpectedly"
- `feat(dashboard): add export button` → "Added CSV export to the analytics dashboard"
- Group related commits into a single entry if they're part of the same feature

---

### Step 4: Recommend Version Bump

| Condition | Bump |
|-----------|------|
| Only `fix:` commits | Patch (1.0.X) |
| Any `feat:` commit | Minor (1.X.0) |
| Any `BREAKING CHANGE` | Major (X.0.0) |

---

## Output Format

```markdown
## [VERSION] — YYYY-MM-DD

### Breaking Changes
> ⚠️ Migration required: [what users need to change]
- [Breaking change with migration guide]

### Added
- [New feature in plain language] (#PR or commit hash)

### Fixed
- [Bug fixed and user impact explained]

### Changed
- [Improvement with context]

### Removed
- [What was removed and what to use instead]

### Security
- [Vulnerability addressed — always list, never omit]
```

---

## Rules

- Security section must always be listed if any security commit exists — never bury it
- Breaking changes section comes first, always
- Omit `chore:`, `test:`, `ci:` commits — they are not user-facing
- Every entry should explain user impact, not just code change
- If a breaking change has no migration guide: write "Migration guide: [TODO]" — don't omit the section
- Suggest the version number explicitly in the output header

## Playground

<!DOCTYPE html><html><head><meta charset='utf-8'><style>*{box-sizing:border-box;margin:0;padding:0}body{background:#0d1117;color:#e6edf3;font-family:monospace;font-size:12px;height:100vh;display:flex;flex-direction:column;overflow:hidden}.header{background:#161b22;border-bottom:1px solid #30363d;padding:8px 14px;font-size:11px;color:#8b949e;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.title{color:#58a6ff;font-weight:bold;font-size:13px}.panels{display:flex;flex:1;overflow:hidden}.panel{flex:1;overflow:auto;padding:12px;border-right:1px solid #30363d}.panel:last-child{border-right:none}.label{font-size:10px;color:#8b949e;text-transform:uppercase;letter-spacing:.08em;margin-bottom:6px}pre{white-space:pre-wrap;word-break:break-word;line-height:1.5}</style></head><body><div class='header'><span class='title'>Changelog Generator</span><span>Example · SkillSlap</span></div><div class='panels'><div class='panel'><div class='label'>Input: Commit log</div><pre><span style='color:#8b949e'>feat(search): add fuzzy matching</span>
<span style='color:#8b949e'>fix(auth): handle expired tokens</span>
<span style='color:#8b949e'>fix(ui): button overflow on mobile</span>
<span style='color:#8b949e'>chore: upgrade Next.js 15→16</span>
<span style='color:#8b949e'>perf(db): add index on skills.author_id</span></pre></div><div class='panel'><div class='label'>Output: CHANGELOG entry</div><pre><span style='color:#58a6ff'>## [1.4.0] — 2026-03-11</span>

<span style='color:#58a6ff'>### Added</span>
<span style='color:#8b949e'>- Fuzzy search matching for skill</span>
<span style='color:#8b949e'>  names and descriptions</span>

<span style='color:#58a6ff'>### Fixed</span>
<span style='color:#8b949e'>- Auth: expired token now returns 401</span>
<span style='color:#8b949e'>  instead of crashing middleware</span>
<span style='color:#8b949e'>- UI: action button no longer overflows</span>
<span style='color:#8b949e'>  on narrow mobile screens</span>

<span style='color:#58a6ff'>### Performance</span>
<span style='color:#8b949e'>- Added index on skills.author_id;</span>
<span style='color:#8b949e'>  author profile pages 4x faster</span>

<span style='color:#58a6ff'>### Dependencies</span>
<span style='color:#8b949e'>- Next.js 15 → 16</span></pre></div></div></body></html>