Recipes / Dev & code
Claude CodeFull setupDev & code

@claude in pull requests (GitHub Action)

Anthropic's official action runs Claude Code on your own GitHub runner to review PRs, answer @claude questions and implement small changes.

Setup time15 min
CostAPI usage
RunsOn PR or @mention
NeedsGitHub Actions, Anthropic API key (secret)
Last updated2026-10-15
GitHubSource

anthropics/claude-code-action

by anthropics · 2025-05-19 (repo created)

✓ Repo metadata and README fetched from GitHub on 2026-10-15

Read the original ↗
Part 1 · What the source did

Anthropic's official action runs Claude Code on your own GitHub runner to review PRs, answer @claude questions and implement small changes.

  • Detects whether it was triggered by an @claude mention, an assignment or an explicit prompt.
  • Reviews PR changes, answers code questions and can implement fixes.
  • Shows progress as checkboxes and can return structured JSON outputs.

Summary written by Agent Cookbook. See the original for the full context.

Part 2 · Our copy-paste version

Adapted by us from what the source described. Fill in the [BRACKETS].

The prompt

Review this PR as a senior engineer. 1. Summarize what changed in 3 bullets. 2. List bugs, security issues and missing tests as review comments on specific lines, highest risk first. 3. Do NOT push commits. If a fix is trivial, suggest it as a code suggestion block. 4. End with: APPROVE-WORTHY / NEEDS CHANGES and why.
🛡
Approval ruleRestrict tools so it comments rather than pushes; humans merge.

Set it up

  1. Add the API key as a repository secret.
  2. Install the workflow from the repo's quick start.
  3. Put the prompt above in the workflow's prompt input.
  4. Open a test PR and check the comments.

Common failures

⚠
What usually goes wrong
  • Prompt injection from PR text or issues. Limit tools and don't give write tokens.
  • Costs grow on busy repos; trigger on mention only.

Variations

  • Trigger only when someone comments @claude.
  • Return JSON outputs to drive labels.

Related recipes