Skip to content

ci: switch Claude Code Review to experimental-review mode#2355

Merged
Yeraze merged 1 commit intomainfrom
ci/claude-review-experimental-mode
Mar 21, 2026
Merged

ci: switch Claude Code Review to experimental-review mode#2355
Yeraze merged 1 commit intomainfrom
ci/claude-review-experimental-mode

Conversation

@Yeraze
Copy link
Owner

@Yeraze Yeraze commented Mar 21, 2026

Summary

  • Switch from default tag mode to experimental-review mode for inline PR comments and code suggestions
  • Based on the official example from anthropics/claude-code-action@beta docs
  • Use custom_instructions instead of direct_prompt (review mode has its own built-in prompt)
  • Full git history (fetch-depth: 0) for better diff analysis
  • Reference CLAUDE.md for project-specific conventions
  • Add 30-minute timeout to prevent hung reviews
  • Remove unnecessary allowed_tools (base GitHub tools are always included)

Test plan

  • This PR itself will test the new workflow — check if Claude Code Review produces inline comments
  • Verify review mode doesn't fail with infrastructure errors

🤖 Generated with Claude Code

Use the dedicated review mode for inline PR comments and suggestions
instead of the general tag mode with direct_prompt. Based on the
official example from anthropics/claude-code-action@beta.

Changes:
- mode: experimental-review for inline review comments
- custom_instructions instead of direct_prompt
- fetch-depth: 0 for full diff analysis
- Reference CLAUDE.md for project conventions
- Add timeout_minutes to prevent hung reviews
- Remove unnecessary allowed_tools (base GitHub tools always included)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
issues: read
actions: read
pull-requests: write
issues: write

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issues: write permission might be more than needed. Consider if issues: read would be sufficient for the experimental-review mode, unless you specifically need to create/modify issues.

Suggested change
issues: write
issues: read

steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider updating to checkout@v4 for consistency, as the previous version used v6 but v4 is more commonly used and stable.

Suggested change
uses: actions/checkout@v4
uses: actions/checkout@v4

uses: actions/checkout@v4
with:
fetch-depth: 1
fetch-depth: 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent improvement! Using fetch-depth: 0 instead of fetch-depth: 1 provides the full git history, which allows Claude to better understand the context of changes and provide more accurate reviews. This is particularly important for the experimental-review mode.

id: claude-review
uses: anthropics/claude-code-action@beta
with:
mode: experimental-review

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect choice! The experimental-review mode is exactly what you want for inline comments and code suggestions. This mode is specifically designed for PR reviews and will provide a much better experience than the default tag mode.

direct_prompt: |
Please review this pull request and provide feedback on:
- Code quality and best practices
timeout_minutes: "30"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good addition! The 30-minute timeout prevents workflows from hanging indefinitely. Consider adding a brief comment to explain this choice:

Suggested change
timeout_minutes: "30"
timeout_minutes: "30" # Prevent hung reviews

Comment on lines +35 to +45
custom_instructions: |
Use the repository's CLAUDE.md for guidance on style, conventions, and architecture.
Focus on:
- Code quality and maintainability
- Potential bugs or issues
- Security vulnerabilities
- Performance considerations
- Security concerns
- Test coverage

Be constructive and helpful in your feedback.
- Test coverage gaps

# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
# use_sticky_comment: true

# Optional: Customize review based on file types
# direct_prompt: |
# Review this PR focusing on:
# - For TypeScript files: Type safety and proper interface usage
# - For API endpoints: Security, input validation, and error handling
# - For React components: Performance, accessibility, and best practices
# - For tests: Coverage, edge cases, and test quality

# Optional: Different prompts for different authors
# direct_prompt: |
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}

# Optional: Add specific tools for running tests or linting
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"

# Optional: Skip review for certain conditions
# if: |
# !contains(github.event.pull_request.title, '[skip-review]') &&
# !contains(github.event.pull_request.title, '[WIP]')
Be constructive and provide specific suggestions for improvements.
Use GitHub's suggestion format when proposing code changes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent configuration! Using custom_instructions instead of direct_prompt is the correct approach for experimental-review mode. The instructions are comprehensive and reference CLAUDE.md for project-specific conventions.

The focus areas are well-balanced and the suggestion to use GitHub's suggestion format is particularly valuable for actionable feedback.

Optional enhancement: Consider adding file path restrictions if you want to limit reviews to specific directories:

Suggested change
custom_instructions: |
Use the repository's CLAUDE.md for guidance on style, conventions, and architecture.
Focus on:
- Code quality and maintainability
- Potential bugs or issues
- Security vulnerabilities
- Performance considerations
- Security concerns
- Test coverage
Be constructive and helpful in your feedback.
- Test coverage gaps
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
# use_sticky_comment: true
# Optional: Customize review based on file types
# direct_prompt: |
# Review this PR focusing on:
# - For TypeScript files: Type safety and proper interface usage
# - For API endpoints: Security, input validation, and error handling
# - For React components: Performance, accessibility, and best practices
# - For tests: Coverage, edge cases, and test quality
# Optional: Different prompts for different authors
# direct_prompt: |
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
# Optional: Add specific tools for running tests or linting
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
# Optional: Skip review for certain conditions
# if: |
# !contains(github.event.pull_request.title, '[skip-review]') &&
# !contains(github.event.pull_request.title, '[WIP]')
Be constructive and provide specific suggestions for improvements.
Use GitHub's suggestion format when proposing code changes.
custom_instructions: |
Use the repository's CLAUDE.md for guidance on style, conventions, and architecture.
Focus your review on source code files in src/, excluding generated or vendor files.
Focus on:
- Code quality and maintainability
- Potential bugs or issues
- Security vulnerabilities
- Performance considerations
- Test coverage gaps
Be constructive and provide specific suggestions for improvements.
Use GitHub's suggestion format when proposing code changes.

@Yeraze Yeraze merged commit c50f0fb into main Mar 21, 2026
10 checks passed
Yeraze added a commit that referenced this pull request Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant