Recipes / Claude Code use cases
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.

From anthropics on GitHub · May 2025

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

What the source did

  • 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 from the original post. See the original for the full context. How we source recipes

Our notes

What it takes
Admin rights on the repo, which the README requires to install the GitHub app and add secrets. The quickstart is /install-github-app inside Claude Code, which walks you through both; it's only for direct Anthropic API users, and Amazon Bedrock, Google Vertex AI and Microsoft Foundry have their own setup doc. The action runs on your own GitHub runner.
Where it breaks
Old v0.x workflows: v1.0 moved configuration to unified prompt and claude_args inputs, and the README points to a migration guide (most existing setups stay compatible). What Claude can and can't do in the action is in the repo's Capabilities & Limitations doc.
Human checkpoint
By default it gets GitHub APIs and file operations, and more tools only come on through configuration, so leave extras off if you only want comments. The action can also implement changes; access control, permissions and commit signing are covered in the repo's Security doc.
Tools involved
GitHub Actions, Anthropic API key (secret)

✓ Verified Source link checked and still live. Notes by Thomas, editor. How we verify

Get their template

Made and published by anthropics. Start here; it is their original, not ours.

Their prompt

From Anthropic's example workflow Their exact wording. Source ↗

REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }} Perform a comprehensive code review with the following focus areas: 1. **Code Quality** - Clean code principles and best practices - Proper error handling and edge cases - Code readability and maintainability 2. **Security** - Check for potential security vulnerabilities - Validate input sanitization - Review authentication/authorization logic 3. **Performance** - Identify potential performance bottlenecks - Review database queries for efficiency - Check for memory leaks or resource issues 4. **Testing** - Verify adequate test coverage - Review test quality and edge cases - Check for missing test scenarios 5. **Documentation** - Ensure code is properly documented - Verify README updates for new features - Check API documentation accuracy Provide detailed feedback using inline comments for specific issues. Use top-level comments for general observations or praise.

Approval rule

🛡
Restrict 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

⚠
  • 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.

Get the 10 best agent setups. Free.

Plus new recipes every week. One email, no spam.

Unsubscribe anytime. Privacy

Related recipes

Same job: Dev & code

In these guides: More Claude Code use cases → · AI code review agents →

Get their template ↗