- name
- kms-pr-description
- description
- Write or update the description (body) of a GitHub PR so it summarizes the real branch changes: What / How / Why, tests actually run, docs touched. Use when asked to summarize PR changes in the PR description, or after pushing a branch that already has a PR.
# KMS PR Description
Summarizes the PR's actual diff into its description, per `CONTRIBUTING.md` "Pull Requests" (what it accomplishes, how, why). It reads the diff and writes the body; it never edits code, pushes or merges.
## When to Use
- "Summarize the PR changes in the PR description", "update the PR body", "fill in the PR description".
- After the first push of a branch that already has a PR.
- Skip: bot PRs (Dependabot, Nix hash bumps), whose body is generated.
## Step 0 — Anti-hallucination
Read `.github/skills/shared/anti-hallucination.md`. Every sentence of the body must be traceable to the diff, a commit message, the linked issue or a command output you observed. Unobserved = omit or label `not run`.
## Step 1 — Find the PR and the base
```bash
git fetch origin
# `--repo` requires an explicit argument: a PR number or the branch name
GH_PAGER=cat gh pr view "${PR:-$(git branch --show-current)}" --repo Cosmian/kms --json number,title,body,baseRefName,headRefName,author,isDraft,state
```
- No PR for the branch → stop and report. Do not create one here (`/issue-workflow` step 10 does).
- Author is a bot, or state is not `OPEN` → stop.
- Keep the existing `Fixes #<N>` / `Refs #<N>` lines and any human-written text that is still true. Replace only what the diff contradicts.
## Step 2 — Read the change, not the guess
```bash
BASE=origin/<baseRefName>
git log --reverse --format='%h %s%n%b' $BASE..HEAD
git diff --stat $BASE...HEAD
git diff $BASE...HEAD -- <each non-trivial file>
```
- Read the linked issue (`GH_PAGER=cat gh issue view <N> --repo Cosmian/kms`) for the problem statement.
- Group files by layer, in the `AGENTS.md` order: server (`crate/server/`, `crate/kmip/`), CLI (`crate/clients/`), Web UI (`ui/`), then crypto/db, tests, docs, CI/build.
- Note: public API/CLI flag/config key changes, schema or wire-format changes, security-relevant behaviour, dependency bumps, files generated by `mise run docs:sync-*`.
## Step 3 — Write the body
Use exactly these sections, omit one only when truly empty:
```markdown
Fixes #<N>
## What
<1-3 sentences: observable behaviour change, user-facing terms.>
## Why
<The problem or requirement; the root cause for a bug. Link the issue.>
## How
- **<layer / component>**: <what changed and the approach chosen, with `path` references>
## Tests
- `<exact command>` — <result you observed>
- Smoke: <what was exercised, outcome>
## Docs
- <pages changed, or "none: no user-visible change">
## Notes
<Breaking changes, migrations, security considerations, known limits, follow-ups. Omit if none.>
```
Rules:
- Describe behaviour and intent, not a file-by-file diff dump; one bullet per component, not per file. A table is fine for 3+ defects with files.
- **Tests**: list only commands run in this session or shown in CI/the PR. Never write "all tests pass" without a command. If nothing ran, write `Not run: <reason>`.
- Mention the `CHANGELOG/<branch with / replaced by _>.md` entry if present; if absent and the PR is not trivial, flag it in the report, do not invent one here.
- Multi-layer PR: state the commit order (server, CLI, UI) so reviewers can read it commit by commit.
- Security-relevant change (auth, crypto, access control, secrets): say what is now enforced and which negative test covers it.
- Never include secrets, tokens, internal hostnames or raw logs containing them. Quote error messages minimally.
- Include the `/kms-pr-review` verdict only if `review-YYYY-MM-DD/final.md` exists (gitignored, do not commit it).
- No marketing, no emojis, no filler; a short PR gets a short body.
## Step 4 — Apply
```bash
BODY=$(mktemp) && cat >"$BODY" <<'EOF'
...
EOF
GH_PAGER=cat gh pr edit <N> --repo Cosmian/kms --body-file "$BODY" && rm -f -- "$BODY"
GH_PAGER=cat gh pr view <N> --repo Cosmian/kms --json body -q .body
```
- Rewriting an existing non-empty body: show the user the previous body in the report (it is not recoverable from `gh pr edit`).
- Do not change the title unless asked; if it is not a Conventional Commit subject, say so.
- Never commit the body file. Never push, merge or force-push.
## Report
`PR #<N>: body updated | unchanged — sections written, tests listed (ran / not run), items flagged (missing CHANGELOG, non-conventional title, unverified claims removed)`.
View on GitHub