68 68. AI in the Pull Request Workflow
Pull Requests and Code Review showed the GitHub Flow and how teammates review each other’s work. This page shows how Claude Code can open pull requests for you, review code, and work directly on GitHub. You stay responsible for what gets merged.
68.1 Asking Claude Code to open a pull request
As of Oct 6, 2026 · Official docs: Common workflows: Create pull requests · Best practices
Claude Code can do steps 1-4 of the GitHub Flow for you. The docs suggest asking it directly (“create a pr for my changes”) or step by step:
summarize the changes I've made to the authentication module
create a pr
enhance the PR description with more context about the security improvements
Install the GitHub CLI and sign in (gh auth login); the docs note that Claude knows how to use gh to open pull requests, create issues, and read comments. Review the pull request Claude wrote before you ask anyone to review it, and ask Claude to point out potential risks. To find the Claude Code session that created a pull request later, run claude --from-pr 2 (with your PR number); it lists the sessions linked to that pull request so you can resume one.
68.2 Reviewing code with /code-review
As of Oct 6, 2026 · Official docs: Code Review: Review a diff locally · Find bugs with ultrareview · Commands
Inside a Claude Code session:
/code-reviewreviews your branch’s commits plus any uncommitted changes for correctness bugs. It runs in the background and reports its findings in your conversation. Pass a pull request number to review a teammate’s PR (/code-review 2). You can also add an effort level fromlow(only the findings it is most confident about) tomax(broader coverage),--fixto apply the findings to your files, or--commentto post them as comments on the GitHub pull request./reviewis another name for the same command./code-review ultraruns a deeper review in the cloud (called ultrareview): a group of reviewer agents that verify each finding, taking roughly 5 to 10 minutes. It needs a claude.ai account; Pro and Max accounts get 3 free runs (a one-time allowance), after which each review is billed separately as usage credits./security-reviewchecks your branch’s changes for security problems.
An AI reviewer is a useful second reader, especially for code an AI wrote, but it doesn’t replace a human review: someone on the team should still read and approve the pull request.
68.3 Claude on GitHub: @claude and automatic reviews
As of Oct 6, 2026 · Official docs: Claude Code GitHub Actions · Code Review
- Claude Code GitHub Actions. Running
/install-github-appin Claude Code (you need admin access to the repository and a signed-ingh) installs the Claude GitHub App, stores a credential as a repository secret, and prepares a pull request that adds the workflow file. After you merge it, anyone with write access can mention@claudein an issue or pull request comment, for example@claude fix the TypeError in the user dashboard component, and Claude works on it and replies in the comment. Each run uses GitHub Actions minutes plus either API tokens or your Claude subscription. - Code Review. A managed service (research preview, for Team and Enterprise plans) that reviews pull requests automatically and posts findings as comments on the changed lines, marked Important, Nit, or Pre-existing. It never approves or blocks a pull request. Commenting
@claude reviewon a pull request requests a review. It is billed separately from the plan (the docs say reviews average $15-25 each). On other plans, use/code-reviewlocally.
68.4 Key takeaways
- Claude Code can open pull requests for you (“create a pr”) using the GitHub CLI,
gh. Read the pull request it wrote before you ask a teammate to review it. /code-reviewreviews your branch (or a pull request, with its number) for bugs;/code-review ultraruns a deeper review in the cloud;/security-reviewlooks for security problems.- On GitHub,
@claudein a comment asks Claude to work on an issue or pull request (after/install-github-app), and the managed Code Review service reviews pull requests automatically. - AI reviews are a second reader, not a replacement: a person still reads and approves the pull request and stays responsible for what is merged.
Practice Questions
Easy
Question 1 · Multiple choice
Which tool does Claude Code use to open pull requests, create issues, and read comments on GitHub?
git push- The GitHub CLI,
gh /security-review- The Files changed tab
Question 2 · Matching
Match each command with what it does.
| Command | What it does | |
|---|---|---|
1. /code-review |
A. Checks your branch’s changes for security problems | |
2. /code-review ultra |
B. Installs the Claude GitHub App so people can mention @claude on GitHub |
|
3. /security-review |
C. Reviews your branch’s changes for correctness bugs, in your session | |
4. /install-github-app |
D. Runs a deeper review in the cloud with a group of reviewer agents |
Question 3 · True or false
If /code-review finds no problems in your pull request, nobody else needs to review it.
Question 4 · True or false
The managed Code Review service can block a pull request so that it can’t be merged.
Medium
Question 5 · Short answer
In a Claude Code session, what does /code-review review by default, and how do you make it review pull request 2 instead?
Question 6 · Write the command
Sam wants Claude Code to review his teammate’s pull request 7 and post the findings as comments on the pull request on GitHub. What does he type in his Claude Code session?
Question 7 · Short answer
Last week Maria asked Claude Code to create pull request 12. Now a reviewer has asked for changes, and she wants to continue in the Claude Code session that created it. What command helps her find that session?
Question 8 · Multiple choice
Sam’s /code-review runs report many findings, and several turn out to be false alarms. Which effort level should he add to see only the findings the review is most confident about?
lowmediummaxultra
Question 9 · Scenario
For each situation, name the tool from this page that fits best:
- Maria wants a quick check of her branch for bugs before she opens a pull request.
- Sam is about to merge a large, risky change and wants the deepest review available, even if it takes several minutes.
- Maria changed the sign-in code and is worried about security problems.
- A teammate wants to write a comment in a GitHub issue asking Claude to fix the bug described there.
Question 10 · Ordering
Put these steps in order so that the team can mention @claude in pull request comments:
- A. Merge the pull request that adds the workflow file
- B. Sign in to the GitHub CLI with
gh auth login - C. A teammate writes
@claudeand a request in a pull request comment - D. Run
/install-github-appin Claude Code
Hard
Question 11 · Scenario
You asked Claude Code to “create a pr” for your changes, and it did. What should you do before asking a teammate to review it, and how could AI review tools help without replacing your teammate?
Question 12 · Compare
Compare Claude Code GitHub Actions (@claude) with the managed Code Review service: what does each do, who can use it, and how is it paid for?
Question 13 · Long answer
A teammate proposes: “Claude writes most of our code and /code-review checks it, so we can stop doing human reviews and merge as soon as the AI review is clean.” Give two reasons this is a bad idea, and describe a better process that still uses the AI tools.