---
name: writing-pr
description: >-
  Use when writing or updating a pull or merge request title or body, adding screenshots or a diagram to one, or drafting replies to review comments. Not for pushing or opening the PR - use ship; not for reviewing someone else's PR - use `review`.
title: writing-pr
canonical_url: https://skilld.dev/gh/avik-creator/agent-skills/writing-pr
last_updated: 2026-11-17T15:45:41.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/plain-words.md](https://skilld.dev/api/skills-raw/avik-creator/agent-skills/writing-pr/references/plain-words.md).
>
> If the user asked to install this Skill, run `npx skilld install avik-creator/agent-skills/writing-pr`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/writing-pr`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/avik-creator/agent-skills/writing-pr) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/writing-pr`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/writing-pr --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/writing-pr --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Writing a PR or MR

## Scope

The title, the body, keeping the body current, and drafts of replies to review threads. Creating the PR or MR is `ship` step 5. Editing a body that is already up runs when the user asks, or after a yes to the shown text.

Replies to review threads are drafts. Never post a comment, a reply, or a reaction as the user unless they say so for that thread or that routine.

## Before writing

Read the whole diff against the target branch, the commits, and the request. Ask every blocking question in one turn. Never invent a fact. A number, a payload, or a screenshot comes from this change, not from memory.

If the diff mixes unrelated changes or is too big to review in one sitting, propose splitting it into separate or stacked MRs before writing anything.

## Title

Short. It says what changes, in the repo's existing title style; read recent merged titles first.

## Body

Diagrams and code come first, then bullets around them. No essays: any prose is a bullet.

1. **One line**: what changes, and for whom.
2. **Flow**: a simplified mermaid diagram of the path that changed. Stop at the zoom that answers "what does this change do", as the design-docs skill's `flows-and-diagrams.md` says. Leave it out only for a change with no flow, such as a typo or a version bump.
3. **Code**: a short snippet of the internals that matter, or sample usage. For an API change, the request a client sends and the response it gets, built from the real types.
4. **Changes**: bullets, each with a code reference where it helps.
5. **Before and after**:
   - Visual changes, direct or indirect: a table with before and after images or videos.
   - Benchmarks: a table with the baseline from the target branch and the candidate from this branch, with units and the command.
6. **Before merge and deploy**: only when there is something to do. The exact commands, environment variables, migrations, and their order, plus the undo for each one that changes data.
7. **Kept on purpose**: a suppression, skip, or lowered bar the user agreed to, with its reason (ship's bar-guard).

For a change that is hard, high-risk, or wide in scope, write the body like a short technical blog post: the context, the problem, the approach, code samples, before and after, diagrams, images.

## Never in the body

- "Validation", "I ran tests", test counts, or a list of commands run. Why: CI shows it, and the body is about the change.
- How the PR got here: earlier sizes, refactors between commits, rebases, review rounds. Why: only the final squash commit is read later.
- AI attribution: no "Generated with", no co-author trailer.
- Secrets, tokens, connection strings, internal URLs with credentials, or personal data in screenshots.
- Anything a reviewer wouldn't miss. When the body is long, cut sections before shortening sentences.

## Images

Upload them and embed the returned Markdown. Uploading is outward-facing, so show the files first and upload after a yes.
- GitLab: `glab api projects/:id/uploads --form "file=@<path>"`. The response's `markdown` field is the embed.
- GitHub: `gh` has no image upload. Ask the user to drop the image into the PR in the browser, then reference it.

## Updating the body

- After a push that changes behaviour, or after review feedback is addressed, rewrite the body so it describes the final state. Do not append an "update" section.
- Show the new text, then run:
  - GitLab: `glab mr update <iid> --description "$(cat <file>)"`
  - GitHub: `gh pr edit <number> --body-file <file>`
- Read it back after the update.

## Review replies

Per thread: the file and line, the reviewer's point in one line, and the drafted reply. A reply says what changed and where, or why not, with the evidence. The user posts it.

## Replies

Talk to the user in simple English: short sentences, everyday words, and a technical term only where it is needed, explained the first time it appears.

Before showing anything, check it against [plain-words.md](https://skilld.dev/api/skills-raw/avik-creator/agent-skills/writing-pr/references/plain-words.md), the patterns that make text read as machine-written. Then show the title and body as they will appear. Say what was left out and why.
