Get a change from your branch onto the real site safely, through a pull request a person can review in minutes.
Your goals
By the end of this Lesson
- You'll be able to follow a change from a branch to production on a site like this one: pull request, preview with its own database branch, testing, then squash and merge.
- You'll be able to say what
/prdoes and what it leaves to you: it's model-invoked, and it writes only the PR body. - You'll be able to judge a PR body: a Summary that shows the change, Evidence with a before and an after, and a Merge Danger call on the risk of merging.
- You'll be able to judge whether a change can be undone (a two-way door) or not (a one-way door), and use that to decide how hard to review and when to test before merging.
Why it matters
Claude Code (Anthropic's coding agent: an AI that reads your files, runs commands and writes code from your terminal) can write a feature in minutes. Someone still has to decide whether that code reaches the real site, and on a careful project that someone is a person reading a pull request: a request to merge a set of changes into the site's main code, which others review first. Matt Pocock, a developer and teacher who publishes a popular set of Skills for Claude Code, says pull requests are still the main bottleneck for getting work shipped. (A Skill is a short instruction file the agent loads when you type its name, or when a task matches its description. Skills covers them.)
Picture the pull request that added Comments to this site. Suppose its description said only "Added comment box, all tests pass." (Tests are small programs that run the code and check its answers.) You'd have two bad options: read every changed line to work out what it does, or trust the sentence and merge. The first takes an hour. The second is how a change to the database reaches real data unchecked.
This Lesson covers both halves. First, the road a change takes from your laptop to the real site. Then /pr, the Skill that shapes the description so a reviewer knows what changed, whether it works and how risky it is before reading a line of code.
How a change ships
Shipping is mostly vocabulary, so here are the words first.
- Git keeps the history of a project folder, called a repo. Each saved step is a commit.
- A branch is a separate line of commits.
mainis the branch the real site is built from, so work happens on other branches until it's ready. - Pushing copies your commits to GitHub, the website that hosts the repo.
- A pull request (PR) asks GitHub to merge one branch into another. It shows the diff (every line added or removed) and a description called the body. Reviewers read both, comment, and approve or ask for changes.
- Merging folds the branch into
main. Squash and merge turns all of the branch's commits into one tidy commit onmain. - Production is the real site that Visitors (the people reading it) use.
On this site, two services make PRs safe to try. Vercel, the site's host, builds a preview of every pushed branch: a full, temporary copy of the website at its own address. Neon, the database's host, gives each preview its own database branch: a throwaway copy, never merged back, so test data stays off the real site. Every build also runs any migration (a script that changes the database's structure, like adding a table) against its own database. So a preview tries a migration on its copy, and only the merge runs it on the real one.
- A branch off main
- The PR body, shaped by the pr Skill
- A pull request on GitHub
- A Vercel preview site
- Its own Neon database branch
- You test the preview
- Squash and merge
- Production, the real site
The change is committed to a branch, so
mainand the real site stay untouched.When you ask for a PR, the agent writes its body first. That's exactly what the
prSkill describes, so it loads without being asked.Then the agent pushes the branch and opens a pull request with that body.
Vercel builds the pushed branch into a preview site at its own address.
The preview gets its own database branch, and any migration runs on that copy first.
You open the preview, do the thing the PR is about, and try to break it.
Only then do you squash and merge: the branch's commits become one commit on
main.Merging puts the change live on production, and that build runs the migration on the real database.
Merging to main deploys production automatically: the new version goes live. That's why you test on the preview before you merge, never after: the preview is the last place a mistake costs nothing.
Checkpoint 1 of 4
Show the answer
Answer: Only in the preview's own database branch.
- On the real site too, because both sites read the same database. Not with this setup. Each preview gets its own database branch, so the real site never sees it.
- Only in the preview's own database branch. Right. The preview is a separate copy, so testing there can't touch production.
- Nowhere. Previews are read-only. Previews are full working sites. You can post, click and break things, which is the whole point.
- In production, but only after you squash and merge. Merging ships the code and its migrations, not the recipes you added while testing.
The idea: a body built for the reviewer
/pr is a format for a PR body, and that's all. It doesn't create the branch, push it or open the PR. It tells the agent what the body should look like whenever it writes one. It joined the plugin (the bundle that installs all of Matt's Skills at once) in version 1.3, in October 2026.
It's a model-invoked Skill: the agent loads it on its own whenever it's writing a PR body, so you rarely need to type /pr (you can). Compare user-invoked Skills like /implement (Matt's Skill that builds planned work, test-first where it can, then reviews and commits it), which start only when you type their name.
The body has three sections, in this order, with no intro paragraph above them. It uses your project's own words from its glossary file (GLOSSARY.md), if there is one.
1. Summary: show the change. The diff is already on the reviewer's screen. The Summary's job is to show its outline before they read it, using the smallest view that makes the point:
| The change is about | The view |
|---|---|
| Logic or an algorithm | Pseudocode (plain-English code) |
| What calls what when it runs | A call tree |
| The structure of a page | A component tree (the page's building blocks, nested) |
| Which file owns what | A shallow file tree |
| How the parts talk to each other | A Mermaid diagram (text that GitHub draws as a picture) |
| What changes in a structure that already exists | A shaped diff: one of these views, with + marking added lines and − removed ones |
Each visual sits next to the short sentence it supports. One is usually enough, several is fine, and all six would bury the point. When most of the code is new, it can show the whole block instead. Matt credits this menu to show-me, a Skill by Dex Horthy of HumanLayer.
2. Evidence: prove it works. Always a before and an after. Screenshots are the strongest evidence when the change is visible and the agent can take them. Next comes evidence from running the code: the exact test that failed before the change and passes after it, written as pseudocode, or console output (what a program prints) that changed. "All tests pass" on its own is a claim, not evidence.
3. Merge Danger: how risky is it to land? Two calls:
- Door: one-way or two-way. You can walk back through a two-way door: if the change is wrong, a revert (a new commit that undoes it) puts things back. A one-way door can't be walked back. That's anything destructive or hard to reverse: deleted data, a destructive migration, anything already sent out into the world.
- Blast radius: one word for how far the damage could spread if the change is wrong, plus optional notes such as layout shift (parts of a page jumping as it loads), problems on phones, or broken code elsewhere that relies on it.
Here's that shape applied to a real bug fix from this site, PR #7, where posting a number as a Comment's text crashed the server. The real PR's body was a bullet list; this one is for illustration. A key: body and name here are a Comment's text and author, not the PR body. POST /api/comments is the request that saves a Comment. The route handler is the code that receives that request; the comments module, through its postComment function, checks and saves the Comment. A 500 is the server's "I crashed" reply, a 400 its "your request was wrong". trim strips spaces off text, and crashed when handed a number. The schema is the database's structure.
## Summary
A non-text body or name is now rejected before it reaches `trim`.
```diff
POST /api/comments
route handler: reads the request only
comments module: postComment(input)
+ if body or name is not text → 400 with an error message
trim, check lengths, save
```
## Evidence
- **Before:** test "rejects a non-text body": POST {"body": 123} → 500, `.trim is not a function`
**After:** same test → 400 with an error message; 20 of 20 tests pass
## Merge Danger
**Door:** two-way
Input checks only. No schema or data changes, so a revert undoes it cleanly.
**Blast Radius:** small
Requests that used to crash now get a 400. Valid Comments behave as before.
Checkpoint 2 of 4
Show the answer
Answer: The test that failed before the change and passes now.
- The test that failed before the change and passes now. Right. With nothing visible to screenshot, the best evidence comes from running the code: a before and an after.
- A screenshot of the changed code, open in the editor. A picture of code doesn't show that it works. Screenshots are strongest only when the change itself is visible.
- A note that a code review checked the branch and found no problems. A review checks the code's quality and its fit with the plan. Evidence shows the change working, with a before and an after.
- A Mermaid diagram of the script. A diagram belongs in the Summary. It shows the shape of the change, not that it works.
A session, step by step
Here's that bug fix again as a short session (one Claude Code conversation). The fix and its new test are committed on their own branch. You've just reviewed them in a clean session, as Code review advises, so this session never saw the new test fail.
You: Write the PR body for this branch against main. Show it to me here; don't push or open anything.
Agent: Loads the
prSkill, reads the diff between this branch andmain, then runs the new test againstmain's code (a 500) and on this branch: 20 of 20 pass.Agent: Summary: a shaped diff of the comments module, with one new line: if body or name is not text → 400.
Agent: Evidence: before the fix, the new test got a 500 (
.trim is not a function). Now it gets a 400, and all 20 tests pass.Agent: Merge Danger: two-way door, because there's no schema or data change and a revert undoes it. Blast radius: small.
You: The door call holds. Push the branch and open the PR with this body.
Agent: Pushed the branch and opened the PR with
gh pr create(ghis GitHub's command-line tool).
You ask for a body, and nothing else.
Writing a PR body is what the
prSkill describes, so the agent loads it on its own. Evidence needs a real before and after, so it runs the new test on both versions instead of trusting the code it read.The body starts at the Summary: one small visual and a sentence, no intro.
Evidence is a before and an after: the new test on
main's code, then on this branch.Merge Danger names the door and the blast radius.
You skim the diff yourself rather than take the agent's door call on trust: a small change, no migration, nothing deleted or sent. The two-way call holds.
Only now does anything leave your laptop. The PR opens, and Vercel starts building its preview.
Checkpoint 3 of 4
Show the answer
Answer: A PR body in your terminal, and nothing else.
- An open PR on GitHub with that body.
/pronly shapes the body. Pushing and opening the PR are separate steps the agent takes when you ask. - A draft PR, waiting for your approval.
/prnever opens anything, draft or not. Opening a PR is a separate step you ask for. - The branch pushed, with the PR left for you to open. Pushing is a separate step too, and
/prdoesn't take it. - A PR body in your terminal, and nothing else. Right. It writes the body and stops. Ask the agent to push the branch and open the PR when you're ready.
Your part: read it, argue with it
/pr writes the body. Judging it is still your job.
- Read Merge Danger first, then Evidence, then Summary. The door call tells you how carefully to read the rest.
- Doubt the comfortable call most. "Two-way, small blast radius" comes from the same agent that wrote the code, so it's marking its own homework. Whether a change can be undone often isn't visible in the diff at all. Reverting code doesn't bring back deleted rows, and as one user put it in Matt's docs, "rolling back a commit won't unsend a batch of emails."
- Give the agent what it needs to judge. Show it the ticket (one small task from a plan) or the spec (the written description of what to build), not only the diff. Name your repo's one-way changes (migrations, anything that sends messages out, anything that deletes) in
CLAUDE.md, a file of standing instructions the agent reads at the start of every session. - Start on a branch.
/implementcommits to whatever branch you're on. Ask for a new branch before you build, or the work lands onmain. - Review before the body. Run Matt's review Skill by its full name,
/mattpocock-skills:code-review, so the body describes a diff that's already been checked. The short name/code-reviewcan reach Claude Code's own Built-in review, a bug hunt; if the reply lacks Matt's two sections, Standards and Spec, that's what answered./implementcalls the review by its short name too, so run the full name yourself afterwards (see Code review). - Ask for a rewrite after big changes. The body is written once. If the PR changes a lot under review, ask the agent to write it again.
What it won't do: open the PR (the agent does that with gh when you ask), sort through review comments, follow your repo's own PR template (a file GitHub uses to pre-fill new PR descriptions; settle any clash in CLAUDE.md), label the body as AI-written, or split a huge PR. And if a Mermaid diagram looks like raw text in your terminal, nothing's broken: GitHub draws it.
When the work ships as a PR, /pr comes between review and the retrospective in The main flow: /implement, /mattpocock-skills:code-review, /pr, then /retro (a look back at the session). Among Matt's Skills, only /implement-spec, which builds a whole spec in one run, opens a PR by itself: a draft (marked not ready for review) that it marks ready when the work is done, and only if your issue tracker (where tickets live) closes work through PRs or you ask. See Implement.
Checkpoint 4 of 4
Show the answer
Answer: Write in CLAUDE.md that migrations are always one-way doors.
- Correct it again each time, since door calls are judgements it makes fresh. The correction disappears with the session. Write the rule where every session will read it.
- Write in
CLAUDE.mdthat migrations are always one-way doors. Right. Every session readsCLAUDE.mdat the start, so the next door call begins from your rule. - Stop the agent using
/pron PRs that change the database. Those are the PRs where the door call matters most. Fix the call; don't drop it. - Run a code review on every PR that changes the database. A review checks the code, not how the next session calls the door. Write the rule where every session reads it.
How Matt and others use it
Matt Pocock built /pr to make human review as fast and simple as possible. From his talks, videos and docs:
- It loads by itself. In his v1.3 video (5 October 2026) he called it one of his most used recent Skills and said it seems to load every time without being asked, at least on Opus 5.5, one of Anthropic's models.
- Evidence buys verification. In the same video he explained that asking for evidence often makes the agent run an extra test or take a screenshot. Without it, agents happily say a change probably works because they've read the code.
- His own example, in that video, merged two near-identical algorithms. The body showed the files removed and added, the call structure, a before and after on a real record, and Merge Danger: two-way, small blast radius.
- Merge Danger goes last, but gets read early. He puts it at the bottom and expects it to be the first or second thing a reviewer looks at.
- Review the irreversible. In his "Fixing the PR Bottleneck" talk (25 September 2026), he said most PRs are two-way doors, software's big advantage over civil engineering, where a bad bridge can't be reverted. But a tiny change that accidentally emails 60,000 people is one-way. He closed with the rule: not every two-way door needs review, but every one-way door does.
- Flags don't settle it. His October 2026 docs warn that a change hidden behind a feature flag (a switch that turns new code on or off without a new release) stays reversible only until it first saves data in the new shape.
- PRs that close issues. In a May 2026 video he said he usually has the agent open a PR that references the issue (the ticket on GitHub), so merging closes it.
Other developers:
- A self-described AI rookie on Matt's GitHub discussions asked in August 2026 when to push and open a PR after
/implement. Replies, the last in October, explained that/implementcommits to whatever branch you're on and/pronly writes the body, so pushing and opening the PR are yours, by hand or by asking the agent.
Try it yourself
Your turn
You need Claude Code installed and signed in, plus Git (see Start here). Nothing here touches GitHub.
- In your terminal, make a practice folder that's a Git repo and start Claude Code in it. If it asks whether you trust this folder, choose Yes.
mkdir pr-practice
cd pr-practice
git init -b main
claude
- Type
/prbut don't press Enter. In the list that pops up, look for aprentry described as "Use when writing a PR body." Then delete what you typed. If it isn't there, type/exit, install Matt's Skills, then runclaudeagain:
claude plugin install mattpocock-skills@claude-plugins-official
- If you see "plan mode on" under the prompt box (plan mode only reads and proposes), press Shift+Tab until it changes. Then set up a tiny project. If it asks permission to create files or run commands in this folder, choose Yes; press Esc at any point to stop it. If Git says it doesn't know who you are, let the agent set a name and email for this folder only.
Create a tiny project in a language already installed here: one function that returns a comment's display name, with one passing test. Commit it to main.
- Make a change on a branch. Watching the new test fail first is what gives the body a real "before". If the agent proposes a seam (the boundary a test checks the code at) and waits, reply: "Yes, test the display-name function itself."
Make a branch called anonymous-name. First write a test that an empty or blank name shows as "Anonymous", and run it so we see it fail. Then change the function so it passes, and commit to that branch.
- Ask for the body, and only the body:
Write the PR body for this branch against main. Show it to me here; don't push or open anything.
- Read it as the reviewer: Merge Danger first, then Evidence, then Summary. Then ask: "What would make this a one-way door?"
- Type
/exitwhen you're done. Later, in a real project of yours that's already on GitHub, withghsigned in, you can end with: "Push this branch and open the PR with that body."
It's working if:
- The body starts at the Summary heading, with no intro paragraph.
- You can tell what changed from the Summary visual alone.
- Evidence shows a before and an after (the new test failing, then passing), not just "tests pass".
- Merge Danger names a door and a one-word blast radius, and you agree with both.
- Nothing was pushed or opened unless you asked.
If the three headings are missing, ask: "Did you load the pr skill?"
Common mistakes
- Evidence that's a claim. "Tests are green" with no before and after.
- Merging, then testing. On a PR with a migration, the merge has already changed the real database. Check the preview first.
- A wall of diagrams, or a huge PR. One small view is usually enough, and
/prcan't split a PR that's too big to review. - The rest are in Your part, above: trusting "two-way, small" on sight, building on
main, and expecting/prto push, open or update the PR.
Cheat sheet
| Moment | What to do |
|---|---|
| Before you build | Make a branch; /implement commits wherever you are |
| Code written, not yet reviewed | /mattpocock-skills:code-review (the bare /code-review can reach Claude Code's own) |
| Need a PR body | Ask for one; /pr loads by itself |
| Reading a body | Merge Danger, then Evidence, then Summary |
| Evidence | A before and an after: screenshots if visible, else a test that failed before and passes now |
| Door call | One-way if it's destructive or hard to reverse: deletes data, migrates destructively, sends anything out |
| Repo always treats X as one-way | Write it in CLAUDE.md |
| Big changes under review | Ask for the body to be rewritten |
| Ship it | Preview → test it → squash and merge → production |
Final test
10 questions on everything above. Pick your answer, then open the box under it to check.
Show the answer
Answer: No. Asking for a PR is enough; the agent picks up
/pritself.- No. Asking for a PR is enough; the agent picks up
/pritself. Right./pris model-invoked, and Matt says it fires reliably by itself, at least on Opus 5.5. - Yes. Without it, the agent writes no body at all. The agent can always write a body. The question is its shape, and
/prsupplies that without you typing it. - Yes, because only typing
/prmakes the agent push the branch and open the PR./prnever pushes or opens anything; it only shapes the body. The agent opens the PR withghbecause you asked. - No.
/implementalready wrote the body when it committed./implementends by committing to the current branch. It doesn't write a PR body.
- No. Asking for a PR is enough; the agent picks up
Show the answer
Answer: Before and after screenshots at phone width.
- A layout test that failed at phone width before the fix and passes now. Good evidence, but for a change you can see it ranks below screenshots. A picture shows the box really fits.
- A shaped diff of the styling code (CSS) that changed. That's a Summary visual. It shows what changed, not that the change works.
- "Checked on mobile, looks good now." A claim, with no before to compare against.
- Before and after screenshots at phone width. Right. For a visible change, screenshots are the strongest evidence, and the before shows what was broken.
Show the answer
Answer: A quick skim that checks the door call holds.
- A line-by-line read, because every PR deserves equal care. Equal care for everything means too little care for the PRs that can't be undone. Spend it where reversal is hard.
- A quick skim that checks the door call holds. Right. A small two-way door gets a light look, not a slow read. The skim is still how you check the call, since the agent that wrote the code made it.
- None: the agent's door call already settles it. The call comes from the agent that wrote the code. A quick look is how you catch a "two-way" that isn't.
- Ask the agent if it's sure, and merge if it says yes. That has the agent grade its own call a second time. Your quick skim is the independent check.
Show the answer
Answer: Ask the agent to rewrite the body and update the PR.
- Leave it: reviewers can follow the new commits in the diff. The new commits may change what the Summary shows and whether the Merge Danger call still holds. Ask for a new body.
- Type
/pragain: it rewrites the body and puts it on the PR. It rewrites the body, but/pronly writes. Putting the new body on the PR is a step you ask the agent for. - Add a comment on the PR saying the body is out of date. The body is what reviewers read first. Fix it rather than flag it.
- Ask the agent to rewrite the body and update the PR. Right. Writing a PR body loads
/pragain, so the new body has the same shape./prwon't put it on the PR for you.
Show the answer
Answer: Say in
CLAUDE.mdhow they combine, since every session reads it.- Let
/prfind the repo's template and fill it in./prhas its own template and doesn't look for yours. Left alone, the agent has two competing instructions. - Copy the repo's template into
GLOSSARY.md, since/prreads that file./prborrows your project's words from the glossary, not a layout. Say how the two templates combine inCLAUDE.md. - Say in
CLAUDE.mdhow they combine, since every session reads it. Right. For example: fill in the repo's template, with Summary, Evidence and Merge Danger under it. - Type
/pryourself, so it reads the repo's template. Typing the name loads the same Skill, which still doesn't look for your template.
- Let
Show the answer
Answer: It never shows the search failing, then working.
- Evidence should be a Mermaid diagram of the search module. A diagram shows the shape of the change, so it belongs in the Summary. Evidence shows the change working.
- It never shows the search failing, then working. Right. A passing suite is a claim. Show a before and an after: screenshots of the search if the agent can take them, or the search test that failed before the fix and passes now.
- It should say how many files changed. The diff already shows that, and it proves nothing about whether search works.
- Nothing: a full green suite is the strongest evidence there is. Screenshots rank higher for visible changes, and a green suite with no before doesn't show this bug was ever caught.
Show the answer
Answer: The Summary should be a small visual, not prose.
- It should start with Merge Danger instead. The order is Summary, Evidence, Merge Danger. Reviewers may read Merge Danger first, but the body doesn't start with it.
- Four paragraphs is fine, but each one needs a screenshot. Screenshots are Evidence, and only for visible changes. The problem is the prose itself.
- It needs a fifth paragraph saying why each file changed. More prose makes it longer, not clearer. A file-by-file walk-through is just the diff retold in words.
- The Summary should be a small visual, not prose. Right. Pick the smallest view that makes the point, like a call tree or a shaped diff, with a short sentence beside it.
Show the answer
Answer: The door is one-way, since texts can't be unsent.
- The door is one-way, since texts can't be unsent. Right. Anything sent out into the world is a one-way door, however small the diff. Read this one slowly.
- Nothing: a revert switches the reminders off again. It stops future texts. The ones already sent can't be pulled back, and that's what makes the door one-way.
- The call is right; it just needs a wider blast radius. Blast radius is how far it spreads. The door is about whether it can be undone, and this one can't.
- Two-line diffs don't need a Merge Danger section. Every body gets one, and size doesn't decide the door. Matt's own one-way example is a tiny change that accidentally emails 60,000 people.
Show the answer
Answer: The merge migrated the real database, so the check came too late.
- Nothing: a revert undoes a migration like any other change. Reverting the code doesn't undo what a migration did to the database. That's what can make it a one-way door.
- The merge migrated the real database, so the check came too late. Right. Merging deploys production, and that build migrates the real database. Check the preview first, while a mistake only hits its copy.
- The preview already migrated the real database, so merging first changed nothing. Each preview migrates its own database branch. Only the merge's production build touches the real one, which is why you test the preview first.
- Squash and merge skips migrations, so Sam must run this one by hand. Squashing only combines the commits. The production build still runs the migration.
Show the answer
Answer: branch → build →
/mattpocock-skills:code-review→/prwrites the body → open the PR → test the preview → squash and merge- branch → build →
/prwrites the body →/mattpocock-skills:code-review→ open the PR → test the preview → squash and merge The body should describe a diff that's already been reviewed. If the review changes the code, this body is out of date before anyone reads it. - branch → build →
/mattpocock-skills:code-review→ open the PR → test the preview → squash and merge →/prwrites the body The body is for the reviewer, so it has to exist before anyone reviews or merges the PR. - branch → build →
/mattpocock-skills:code-review→/prwrites the body → open the PR → test the preview → squash and merge Right. Review, then describe, then test on the copy. The merge is the last step and the only one that touches production. - build on
main→/mattpocock-skills:code-review→ branch →/prwrites the body → open the PR → test the preview → squash and merge/implementcommits to whatever branch you're on, so building first puts the work onmain. Branch before you build.
- branch → build →
