Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code-review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ This approach, battle-tested by Anthropic's own engineering team building Claude
### Templates & Examples
- [Claude Code Review YAML](./claude-code-review.yml) - Standard GitHub Action configuration for automated code reviews
- [Custom Code Review YAML](./claude-code-review-custom.yml) - Extended configuration with custom review criteria
- [MiniMax Code Review YAML](./claude-code-review-minimax.yml) - Standard review configuration backed by MiniMax's Anthropic-compatible endpoint
- [Custom MiniMax Code Review YAML](./claude-code-review-custom-minimax.yml) - Extended review configuration backed by MiniMax's Anthropic-compatible endpoint
- [Pragmatic Code Review Slash Command](./pragmatic-code-review-slash-command.md) - Custom slash command for on-demand pragmatic code reviews
- [Pragmatic Code Review Subagent](./pragmatic-code-review-subagent.md) - Subagent configuration for comprehensive code analysis

Expand Down
130 changes: 130 additions & 0 deletions code-review/claude-code-review-custom-minimax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Claude Code Review (MiniMax)

on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
workflow_dispatch:
inputs:
minimax_model:
description: MiniMax chat model id to use for the review
type: choice
options:
- MiniMax-M3
- MiniMax-M2.7
default: MiniMax-M3
minimax_region:
description: MiniMax API region (selects the Anthropic-compatible base URL)
type: choice
options:
- global
- cn
default: global

jobs:
claude-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
env:
# MiniMax exposes an Anthropic-compatible API. Route the Claude Code
# CLI to the MiniMax endpoint for the selected region instead of the
# default Anthropic endpoint.
# global -> https://api.minimax.io/anthropic
# cn -> https://api.minimaxi.com/anthropic
ANTHROPIC_BASE_URL: ${{ (inputs.minimax_region == 'cn' && 'https://api.minimaxi.com/anthropic') || 'https://api.minimax.io/anthropic' }}
# MiniMax authenticates with a Bearer token, so set
# ANTHROPIC_AUTH_TOKEN (Authorization: Bearer) rather than
# ANTHROPIC_API_KEY (x-api-key).
ANTHROPIC_AUTH_TOKEN: ${{ secrets.MINIMAX_API_KEY }}
with:
# claude-api-key is provided so the action accepts the run; the
# ANTHROPIC_AUTH_TOKEN env var above takes precedence for the
# Bearer auth MiniMax requires.
claude-api-key: ${{ secrets.MINIMAX_API_KEY }}
# When track_progress is enabled:
# - Creates a tracking comment with progress checkboxes
# - Includes all PR context (comments, attachments, images)
# - Updates progress as the review proceeds
# - Marks as completed when done
track_progress: true
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

You are acting as the Principal Engineer Reviewer for a high-velocity, lean startup. Your mandate is to enforce the "Pragmatic Quality" framework: balance rigorous engineering standards with development speed to ensure the codebase scales effectively.

### Review Philosophy & Directives

1. **Net Positive > Perfection:** Your primary objective is to determine if the change *definitively improves* the overall code health. Do not block on imperfections if the change is a net improvement.
2. **Focus on Substance:** Assume automated CI (Linters, Formatters, basic tests) has passed. Focus your analysis strictly on architecture, design, business logic, security, and complex interactions. Do not comment on style or formatting.
3. **Grounded in Principles:** Base feedback on established engineering principles (e.g., SOLID, DRY) and technical facts, not opinions.
4. **Signal Intent:** Prefix minor, optional polish suggestions with "**Nit:**".

### Hierarchical Review Checklist

Analyze the changes using the following framework, prioritizing these high-impact areas:

1. **Architectural Design & Integrity**
- Is the design appropriate for the system and aligned with existing architectural patterns?
- Is the code appropriately modular? Does it adhere to the Single Responsibility Principle (SRP)?
- Does it introduce unnecessary complexity, or could a simpler, more scalable solution achieve the same goal?
- Is the PR atomic? (Does it fulfill a single, cohesive purpose, or is it bundling unrelated changes like refactoring with new features?)

2. **Functionality & Correctness**
- Does the code correctly achieve the intended business logic?
- Are edge cases, error conditions, and unexpected inputs handled gracefully and robustly?
- Identify potential logical flaws, race conditions, or concurrency issues.

3. **Security (Non-Negotiable)**
- Is all user input rigorously validated, sanitized, and escaped (mitigating XSS, SQLi, etc.)?
- Are authentication and authorization checks correctly and consistently applied to all protected resources?
- Are secrets, API keys, or credentials hardcoded or potentially leaked (e.g., in logs or error messages)?

4. **Maintainability & Readability**
- Is the code easy for a future developer to understand and modify?
- Are variable, function, and class names descriptive and unambiguous?
- Is the control flow clear? (Analyze complex conditionals and nesting depth).
- Do comments explain the "why" (intent/trade-offs) rather than the "what" (mechanics)?

5. **Testing Strategy & Robustness**
- Is the test coverage sufficient for the complexity and criticality of the change?
- Do tests validate failure modes, security edge cases, and error paths, not just the "happy path"?
- Is the test code itself clean, maintainable, and efficient?

6. **Performance & Scalability (Web/Services Focus)**
- Backend: Are database queries efficient? Are potential N+1 query problems identified? Is appropriate caching utilized?
- Frontend: Does the change negatively impact bundle size or Core Web Vitals?
- API Design: Is the API contract clear, consistent, backwards-compatible, and robust in error handling?

7. **Dependencies & Documentation**
- Are any newly introduced third-party dependencies necessary and vetted for security/maintenance? (Adding dependencies is a long-term commitment).
- Has relevant external documentation (API docs, READMEs) been updated?

### Output Guidelines

Provide specific, actionable feedback. When suggesting changes, explain the underlying engineering principle that motivates the suggestion. Be constructive and concise.

Use top-level comments for general observations or praise.

Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
# MiniMax-M3 (1,000,000-token context) is the default; switch the
# workflow_dispatch input to MiniMax-M2.7 (204,800-token context) when needed.
claude_args: "--model ${{ inputs.minimax_model || 'MiniMax-M3' }} --allowed-tools \"mcp__github_inline_comment__create_inline_comment,Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)\""
105 changes: 105 additions & 0 deletions code-review/claude-code-review-minimax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Claude Code Review (MiniMax)

on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
workflow_dispatch:
inputs:
minimax_model:
description: MiniMax chat model id to use for the review
type: choice
options:
- MiniMax-M3
- MiniMax-M2.7
default: MiniMax-M3
minimax_region:
description: MiniMax API region (selects the Anthropic-compatible base URL)
type: choice
options:
- global
- cn
default: global

jobs:
claude-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
env:
# MiniMax exposes an Anthropic-compatible API. Route the Claude Code
# CLI to the MiniMax endpoint for the selected region instead of the
# default Anthropic endpoint.
# global -> https://api.minimax.io/anthropic
# cn -> https://api.minimaxi.com/anthropic
ANTHROPIC_BASE_URL: ${{ (inputs.minimax_region == 'cn' && 'https://api.minimaxi.com/anthropic') || 'https://api.minimax.io/anthropic' }}
# MiniMax authenticates with a Bearer token, so set
# ANTHROPIC_AUTH_TOKEN (Authorization: Bearer) rather than
# ANTHROPIC_API_KEY (x-api-key).
ANTHROPIC_AUTH_TOKEN: ${{ secrets.MINIMAX_API_KEY }}
with:
# claude-api-key is provided so the action accepts the run; the
# ANTHROPIC_AUTH_TOKEN env var above takes precedence for the
# Bearer auth MiniMax requires.
claude-api-key: ${{ secrets.MINIMAX_API_KEY }}
# When track_progress is enabled:
# - Creates a tracking comment with progress checkboxes
# - Includes all PR context (comments, attachments, images)
# - Updates progress as the review proceeds
# - Marks as completed when done
track_progress: true
prompt: |
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.

Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
# MiniMax-M3 (1,000,000-token context) is the default; switch the
# workflow_dispatch input to MiniMax-M2.7 (204,800-token context) when needed.
claude_args: "--model ${{ inputs.minimax_model || 'MiniMax-M3' }} --allowed-tools \"mcp__github_inline_comment__create_inline_comment,Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)\""
1 change: 1 addition & 0 deletions security-review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This approach ensures that security is built into the development process from t
### Templates & Examples
- [Security Review Slash Command](./security-review-slash-command.md) - Default security review command from Anthropic (source: [claude-code-security-review](https://github.com/anthropics/claude-code-security-review))
- [Security YAML](./security.yml) - GitHub Action configuration for automated security scanning
- [MiniMax Security YAML](./security-minimax.yml) - Security scanning configuration backed by MiniMax's Anthropic-compatible endpoint

### Video Tutorial
For a detailed walkthrough of this workflow, watch the [comprehensive tutorial on YouTube](https://www.youtube.com/watch?v=nItsfXwujjg).
56 changes: 56 additions & 0 deletions security-review/security-minimax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Security Review (MiniMax)

permissions:
pull-requests: write # Needed for leaving PR comments
contents: read

on:
pull_request:
workflow_dispatch:
inputs:
minimax_model:
description: MiniMax chat model id to use for the review
type: choice
options:
- MiniMax-M3
- MiniMax-M2.7
default: MiniMax-M3
minimax_region:
description: MiniMax API region (selects the Anthropic-compatible base URL)
type: choice
options:
- global
- cn
default: global

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 2

- uses: anthropics/claude-code-security-review@main
env:
# MiniMax exposes an Anthropic-compatible API. Route the underlying
# Claude Code SDK to the MiniMax endpoint for the selected region
# instead of the default Anthropic endpoint.
# global -> https://api.minimax.io/anthropic
# cn -> https://api.minimaxi.com/anthropic
ANTHROPIC_BASE_URL: ${{ (inputs.minimax_region == 'cn' && 'https://api.minimaxi.com/anthropic') || 'https://api.minimax.io/anthropic' }}
# MiniMax authenticates with a Bearer token, so set
# ANTHROPIC_AUTH_TOKEN (Authorization: Bearer) rather than
# ANTHROPIC_API_KEY (x-api-key).
ANTHROPIC_AUTH_TOKEN: ${{ secrets.MINIMAX_API_KEY }}
with:
comment-pr: true
# claude-api-key is provided so the action accepts the run; the
# ANTHROPIC_AUTH_TOKEN env var above takes precedence for the
# Bearer auth MiniMax requires.
claude-api-key: ${{ secrets.MINIMAX_API_KEY }}
# MiniMax-M3 (1,000,000-token context) is the default; switch the
# workflow_dispatch input to MiniMax-M2.7 (204,800-token context) when needed.
claude-model: ${{ inputs.minimax_model || 'MiniMax-M3' }}
custom-security-scan-instructions: "" # Add any custom instructions specific to your codebase here.