← back to writing
10 min read

From change to merge: how I automate my pull requests

What happens to a change between the moment I finish it and the moment I merge it, told through two real pull requests. One of them added the page you are reading.

the pipelineMake a changeyouShipcommit, push, PRSelf-reviewuntil nothing newPost findingscomments + reportRespondfix, recheckMergeyou decidefixes go back through review
FIG 01 · From change to merge: the pipeline runs the middle four steps

The page you are reading went through the pipeline it describes. When the pipeline reviewed the pull request that added this Writing section, it found a bug in the "On this page" list: any post that showed a markdown sample would have gotten links pointing at nothing. It posted the bug on the pull request with a tested fix, and the fix went in before the page shipped.

I run every pull request through it. I make a change and run one command. The pipeline opens the pull request, reviews it, posts what it found, and works through the fixes. What it leaves to me is deciding what to build, approving what it changes, and deciding to merge.

It is not one big prompt. It is an orchestrator: a skill that decides which smaller skills to run, in what order, and when to stop. I run it in Claude Code as /pr-pipeline, but every skill is a plain markdown file of instructions, so any coding agent that can read files and run git and gh can follow it. They are all open source in my claude-code-configs repo.

Where the time goes

With a coding agent, writing the change is rarely what takes longest anymore. The time goes to everything around the pull request, on both sides of it.

Before anyone reviews it, the author has to package the work. Small, focused commits mean one bad change can be reverted without taking the rest of the work with it. A description with a summary, a diagram, and test steps gets a reviewer oriented before they open the diff. Both take real effort by hand, so most pull requests ship as one big commit with a one-line description, and the reviewer pays for it by reading the diff cold.

Then the pull request waits. A reviewer might get to it in an hour or in two days. When comments arrive, they arrive one at a time, and the author keeps checking back to answer them, which pulls them off whatever they had moved on to.

By handnot to scaleWrite the changePackage itcommits, descriptionWaiting for reviewan hour, or two daysAnswerAnswerAnswereach one pulls the author backWith the pipelineWrite the changePackagedship modeWaiting for reviewthe same waitAnsweredAnsweredAnsweredI build the next thingtime
FIG 02 · Where a pull request's time goes, by hand and with the pipeline (not to scale)

The pipeline takes on both sides. It writes the commits and the description, it reviews its own pull request before a person has to, and it can watch the pull request and work through comments as they come in while I build the next thing.

1. I make a change

This post follows two changes through the pipeline.

The first is this Writing section: post pages, the diagrams in this post, and the "On this page" list, spread across a couple dozen files. It lives in a private repo, so I quote from it instead of linking.

The second is about as small as a change gets. One sentence in my configs repo's README named internal tools, and I rewrote it to describe them generically. That repo is public, so you can open the pull request yourself: #11.

Both started the same way, as ordinary edits on a branch. The pipeline takes over once there is work to ship.

2. One command reads the situation

When I run it, it looks at the branch before doing anything: git status, any unpushed commits, the open pull request if there is one, and whether I am its author. That picks the mode.

What it findsModeWhat runsA PR you named, or someone else's open PRreviewcheck base, analysis, postYour open PR, with unaddressed commentsrespondfix the comments, analysis, postYour open PR, no outstanding commentsreviewself-reviewcheck base, analysis, postUnpushed work and no PR yetshipcheck base, open PR, analysis, post
FIG 03 · The pipeline reads the state of the branch and picks a mode on its own

It names the mode before it starts, so I can correct it if the guess was wrong, and I can steer it in plain language, like "review only, skip the validate passes".

Two rules sit above every mode:

  1. Never silently change someone else's pull request. On a PR you do not own, the pipeline is advisory: it reads, analyzes, and comments. It does not commit, push, or force-push.
  2. Review effort that stays in the terminal did not happen. Every review pass ends with something visible on GitHub.

The first means it only changes code on my own pull requests. On a teammate's, it reviews and comments, and that is all. The second means a run is not finished until something is on GitHub.

3. Ship: focused commits and a real description

For new work, ship mode runs pr-smart-commit to split the change into focused commits, pushes the branch, and opens the pull request with pr-create. The description is the part a reviewer reads first, so pr-create holds it to a structure:

feat: what this PR doesSummarywhat changed and whyScreenshotsthe final UI inline; before | after when it helpsFeature diagramhow the parts connectDesign trade-offsdecision, alternatives, why this oneHow to teststeps with real values and expected resultsKnown limitationswhat it does not do yetTesting donewhat was actually runrequired for UI changesfeature PRs, when they helpevery PRevery PR
FIG 04 · What pr-create writes: two sections for every PR, more for UI changes and features

A docs fix or a bug fix gets the short form. The README fix got exactly that: a summary, a small table showing the line before and after, and what was checked. A feature can get more: a diagram of how the parts connect, a table of the decisions with the alternatives that lost, test steps with real values, and known limitations. Each one goes in only when it helps the reviewer, so a small feature does not carry empty headings. Any change to the UI needs screenshots inline in the description, not a link to them.

4. It reviews its own pull request

As soon as the pull request exists, the pipeline reviews it. Reviewing after the PR is open keeps the diff equal to the real change and leaves a review on it for anyone who looks later. Each review round is two skills, in order:

The diff+ PR contextvalidatesix independent lenses, then a synthesis passCorrectnessIntegrationAdversarialObservabilityTest qualityOperational readinessSynthesis: cross-reference all sixfindingspr-reviewdrafts line comments (CRITICAL · MAJOR · MINOR · NIT) and a summary verdict
FIG 05 · One review round: validate finds, then pr-review drafts

First, validate reads the diff through six independent lenses: correctness, integration, an adversarial pass that tries to make the change fail, observability, test quality, and operational readiness. A final pass reads them together for what no single lens could see. Then pr-review turns the findings into a draft comment for each specific line, with a severity label, plus one summary with a verdict.

One round under-reports, so the pipeline repeats the round until a round finds nothing new, three rounds at most. Before anything is posted, every finding goes through one filter:

Findings survive only if you can state a concrete failure: specific inputs or state producing a wrong result, a crash, a security hole, or an operational failure. A finding you cannot make fail is a question, not a defect. Either ask it as a question or drop it.

Findingfrom a review roundCan you make it fail?inputs or state that break itDefectposted, with the failing caseQuestionask it as a question, or drop ityesno
FIG 06 · A finding has to name what breaks before it earns a comment

5. The findings land on the pull request

The surviving comments go on the lines they are about, then one summary comment. Then the pipeline checks with gh pr view that the comment actually landed.

On the Writing section pull request, the review settled after two rounds with three findings. The main one was the bug from the top of this post. This is the comment it left on the line that built the list:

Review commentlib/notes.ts:35

MAJORSidebar headings are picked up from inside code samples

headingsOf keeps every line that starts with ## , including lines inside a <CodeBlock> template literal or a fenced code block. Those lines never render as headings, so they never get an id.

Failure: a post that shows a PR description template in a <CodeBlock> with a ## Summary line gets an "On this page" entry linking to #summary, and nothing on the page has that id. Clicking it does nothing.

Below that came a suggested fix, tested before the comment went up. The review also flagged four sections missing from the description, because I had opened that pull request by hand instead of through ship mode. The skill required those sections at the time. It has since made them optional, added only when they help.

The README fix shows the other side of the second rule. Its review found nothing, and the pipeline still posted a comment saying what it had checked, what it left out of scope, and what it skipped:

The pipeline's self-review comment on the README pull request: one round, nothing found, followed by sections for checked and clean, known and out of scope, and skipped.
The self-review on the README fix: nothing found, still on the record · view on GitHub ↗

That comment is a trimmed version of the report every run ends with:

PR Pipeline · reviewRounds run: n (converged, or hit the 3-round ceiling)Blockersfile:line and the concrete failureNon-blockingworth fixing, will not break productionChecked and cleanwhat was verified and came back finemakes "no blockers" mean somethingPosted to GitHubcomment count, summary URL, review stateSkippedany phase not run, and whymakes an incomplete run look incomplete
FIG 07 · The required final report, with the two sections that keep it honest

"Checked and clean" is the section I would keep if I could only keep one. "No blockers" on its own reads the same whether the review was careful or a skim. A list of what was verified and came back fine turns it into a claim I can check. "Skipped" does the same job from the other side, so an incomplete run looks incomplete instead of looking like a pass.

6. Respond: fix, reply, check again

When a pull request has open review comments, the same command switches to respond mode. pr-comments-fix gathers everything that needs an answer: comment threads, review summaries, and failing CI checks along with their actual logs. It proposes to accept or decline each item with a reason. Once I approve, it makes the fixes, pushes them, and replies in each thread. Then it checks again. If new comments came in, or a check is still failing because of this pull request, it goes around again, up to three times, and stops early if it gets blocked. The pipeline then reviews the changed code, because a fix applied without re-checking is how regressions ship, and runs pr-update if the description no longer matches the code.

pr-babysit, rerun by /loop while the session is openGatherthreads + checksProposeaccept or declineYou approveor pre-approveFix, push, replyreply in threadCheck againanything new?something new, or still failing: go again, 3 times maxcleanStopnothing left, or blocked
FIG 08 · Respond mode's loop, and the watch loop around it

On the Writing section pull request, one pass took about 13 minutes, from the review comments landing to all three fixes pushed in one commit and every thread answered with what changed and how it was checked. This is the reply on the sidebar thread, posted from my account:

Reply from kevinreberlib/notes.ts:35

Fixed in 1c57fad. headingsOf now skips lines inside fenced blocks and <CodeBlock> samples. Checked against a test body with a multi-line sample, a one-line sample, and a fenced block, and in the browser: all 10 sidebar entries on the post resolve to an element.

Accepting a finding did not mean hiding its cost. Making the diagrams reachable by keyboard adds a tab stop to each one on desktop, where nothing scrolls, and the reply on that thread says so. The second review, of just the fix, found nothing new, and pr-update added the four missing sections to the description.

Respond mode answers comments that are already there. The wait for them is the other half, and that is what pr-babysit is for. It checks one pull request for new feedback and failing checks, and on its own it only reads and reports. When I tell it to act, that instruction is the approval: it runs pr-comments-fix on that pull request, pushes only to my own branch, and replies in the threads. It never pushes to someone else's branch, force-pushes, merges, or closes.

It does not schedule itself. I pair it with Claude Code's /loop, which reruns a command on an interval:

Claude CodeTEXT
/loop 15m /pr-babysit owner/repo#42 and fix what you can

Then I go work on the next feature. When the reviewer gets to the pull request, their comments get answered and fixed without me checking back, and the next round of review starts from code that already reflects the last one.

7. I merge

The pipeline has no merge step, and it is written down as a rule: never merge, close, or force-push a pull request. Everything up to this point is reversible and visible on the pull request. Merging is the decision that ships it, and that one stays with me.

Things to know before you run it

Why it is built this way

The sidebar comment is a good example of where the effort in this pipeline goes. Finding the bug was the easy part. What made the comment worth reading was everything around it: it had to name the input that breaks the code, it came with a fix that had been checked, and it landed on the pull request instead of in my terminal.

A current model reading a diff will surface real issues without much help. Most of what I tuned is everything around that: how many passes before the findings stop being real, what a finding has to prove before it earns a comment, what the tool is never allowed to touch, and what counts as finished. None of that improves when the model gets better. It is ordinary product design, applied to a reviewer that is tireless, confident, and occasionally wrong.

Try it

The skills are plain markdown files. To install all of them for Claude Code:

terminalBASH
git clone https://github.com/kevinreber/claude-code-configs.git
cd claude-code-configs
./install.sh --skills

That copies every skill into ~/.claude/skills/, where Claude Code picks them up. With a different agent, point it at skills/pr-pipeline/SKILL.md and the skills it names from the repo's skills/ folder. Either way you need the GitHub CLI installed and signed in, since everything it posts goes through gh.

Then make a change and run the pipeline. The orchestrator is about 150 lines. Read it before you run it: every rule in this post is in that file in plain sight, and changing one is a text edit.

← back to writing