@claude in any pull request or issue comment to trigger Claude, and use /review from the CLI to review PRs locally.
Installing the GitHub App
The/install-github-app command walks you through the full setup interactively.
Prerequisites
Install and authenticate the GitHub CLI:Your GitHub token needs the
repo and workflow scopes. If they are missing, add them:Run the install command
From within your repository, run:Claude Code checks your GitHub CLI installation and authentication before proceeding.
Choose a repository
Select whether to use the current repository (detected automatically from your
git remote) or enter a repository name in owner/repo format.Install the Claude GitHub App
Claude Code opens
https://github.com/apps/claude in your browser. Install the app on your account or organization and grant it access to the repository.Select workflows
Choose which GitHub Actions workflows to add:
- Claude PR Assistant (
.github/workflows/claude.yml) — Triggered when@claudeis mentioned in a PR or issue comment. - Claude Code Review (
.github/workflows/claude-code-review.yml) — Automatically reviews every pull request when it is opened or updated.
Configure your API key
Provide your Anthropic API key. Claude Code stores it as a GitHub Actions secret (
ANTHROPIC_API_KEY by default). You can also use an OAuth token (CLAUDE_CODE_OAUTH_TOKEN) if you have a Claude.ai account.If an ANTHROPIC_API_KEY secret already exists in the repository, you can reuse it or replace it.Tagging @claude in pull request comments
Once the workflow is merged, mention@claude anywhere in a pull request or issue to trigger it:
- In a PR comment or issue comment
- In a pull request review comment (inline on a diff)
- In a pull request review body
- In the issue body or title
Only users with write access to the repository can trigger the workflow.
All Claude runs are stored in the GitHub Actions run history.
The Claude PR Assistant workflow
The installed workflow file (.github/workflows/claude.yml) is triggered by the following events:
if condition checks that the event body contains @claude before running. Only matching events incur API usage.
Customizing allowed tools
By default, Claude can read and write files, create comments, branches, and commits. To allow additional tools, edit the workflow file:Automated code review with /review
Local review from the CLI
The/review command runs a code review locally using Claude:
gh pr list to show open pull requests and lets you pick one. Pass a PR number to review it directly:
gh pr view and gh pr diff to fetch PR details and the diff, then provides a structured review covering:
- Overview of what the PR does
- Code quality and style
- Specific improvement suggestions
- Potential issues or risks
- Performance, test coverage, and security considerations
Automated review on every PR
The Claude Code Review workflow (.github/workflows/claude-code-review.yml) runs automatically whenever a pull request is opened, synchronized, or marked ready for review:
if condition in the workflow file.
PR comment workflows
The/pr-comments command fetches and formats all comments on the current pull request:
Working with branches and pull requests from the CLI
Claude Code uses the GitHub CLI (gh) for all GitHub operations. Common workflows:
The commit, push, PR workflow
A typical development workflow with Claude Code and GitHub:Security
- The Anthropic API key is stored as an encrypted GitHub Actions secret, not in the repository.
- The workflow only runs when
@claudeis mentioned; it does not process every comment. - Claude’s tool access is limited by default to reading/writing repository files and interacting with the GitHub API (comments, branches, commits).
- All Claude runs are logged in the GitHub Actions run history for auditing.