# Changelog Credit

> Changelog Credit is an Agent Skill for general use published in the CMB2/CMB2 repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Adds CHANGELOG.md entries for CMB2 pull requests, crediting contributors with Props links and linking the PR, following the repo's existing changelog conventions. Takes an explicit PR number/URL, or scans recent commits to find merged PRs not yet credited.

- Skill name: `changelog-credit`
- Category: [Others](https://www.openparable.com/skill/others/1)
- Source: https://github.com/CMB2/CMB2/blob/HEAD/.claude/skills/changelog-credit/SKILL.md
- Repository: CMB2/CMB2 (3,015 GitHub stars when collected)

## SKILL.md

# changelog-credit

Add a `CHANGELOG.md` entry for a CMB2 pull request, in the repo's house style.

## Modes

Two entry points:

- **Explicit PR** — the user gives a PR number or URL. Use it directly.
- **Discovery** — no PR given (e.g. "log any uncredited PRs", "catch up the
  changelog"). Scan recent commits for merged PRs **not yet in CHANGELOG.md** and
  process each.

### Discovery

1. **List recent PR-referencing commits.** Most CMB2 merges put `(#N)` in the
   subject (squash merges) or `Merge pull request #N`:
   ```bash
   git log --max-count=40 --pretty='%H%x09%s'
   ```
   Extract every `#N` from the subjects.

2. **Filter to uncredited.** For each PR number, check whether it already appears
   in `CHANGELOG.md` (the changelog links PRs as `pull/N)`):
   ```bash
   grep -q "pull/N)" CHANGELOG.md   # if found → already credited, skip
   ```
   Keep only PR numbers with no changelog hit.

3. **Confirm the list** with the user before writing — show the candidate PRs
   (number + subject) so they can drop any that shouldn't be logged (reverts,
   internal noise, already-released-but-unlinked work). Then process each through
   the per-PR steps below. Skip commits with no PR reference unless the user asks
   to log a bare commit.

## Per-PR steps

1. **Fetch PR metadata** — title, body, author login, merge state:
   ```bash
   gh pr view <N> --json title,body,number,mergedAt,author,url
   ```
   The `author.login` is the GitHub handle for the Props link. Read the title and
   body to write an accurate, user-facing summary (what changed and why it
   matters), not a verbatim copy of the title.

2. **Read `CHANGELOG.md`** to match current conventions before editing.

## House style (match exactly)

- The top section is `## Unreleased`. Add new entries there. Released sections
  are dated headers like `## [2.12.0 - 2026-05-30](...releases/tag/v2.12.0)` —
  never edit a released section.
- Entries are grouped under `### Enhancements` and `### Bug Fixes` (`###` H3).
  Pick the right group from the PR's nature. Create the subheading if Unreleased
  doesn't have it yet. If `## Unreleased` holds only a placeholder `*`, replace
  the placeholder rather than leaving an empty bullet.
- Each entry is a single `*` bullet, past tense, ending with a period:
  - **Props** the contributor: `Props [@login](https://github.com/login)`. Omit
    Props only when the author is a core maintainer landing their own routine
    work and the existing nearby entries also omit it (e.g. internal
    `[Development]` lines often have no Props).
  - Link the PR: `([#N](https://github.com/CMB2/CMB2/pull/N))`.
  - For tooling/build/CI work, prefix the summary with `[Development]`.
  - When the PR fixes a tracked issue, also link it: `Fixes [#M](...issues/M)`.

Reference template:
```
* <What changed, user-facing.> Props [@login](https://github.com/login) ([#N](https://github.com/CMB2/CMB2/pull/N)).
```

Example (from PR #1559):
```
* Sanitized the `field_id` input (with an `isset()` guard) and escaped the `rel`
  attribute in the oEmbed AJAX handler, addressing a reflected XSS vector flagged
  by WordPress Plugin Check. Props [@thisismyurl](https://github.com/thisismyurl)
  ([#1559](https://github.com/CMB2/CMB2/pull/1559)).
```

3. **Edit `CHANGELOG.md`** with the new bullet under the correct subheading in
   `## Unreleased`. In discovery mode, add a bullet per uncredited PR (newest
   last, to match chronological order within a group).

4. **Report** the added line(s) back to the user. Do not commit or push unless asked.

---

Source: https://www.openparable.com/skill/others/changelog-credit (OpenParable). Cite the canonical URL above.
