Skip to content
Merged
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
25 changes: 14 additions & 11 deletions .claude/commands/review.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ Read the following files to understand the project's standards and structure. Th

Also use Glob to find any additional guideline files:
- `.cursor/rules/*.mdc` or `.cursor/*.md` (coding standards, review checklists)
- Any `CLAUDE.md` files in subdirectories relevant to the changed files
- Any `CLAUDE.md` or `BUGBOT.md` files in subdirectories relevant to the changed files
- `CONTRIBUTING.md` if it exists

**Subdirectory guidelines**: If changed files are in subdirectories with their own guideline files, read those as well for module-specific review criteria.

## Step 2: Gather PR data

Run these commands in parallel:
Expand All @@ -33,7 +35,7 @@ Run these commands in parallel:
Count the number of changed files from step 2.

**If fewer than 100 files changed:**
Review all changed files directly. Read each changed file using the Read tool to understand surrounding context beyond the diff.
Review all changed files directly. Read each changed file using the Read tool to understand surrounding context beyond the diff. Cache these file contents for reuse in later validation steps.

**If 100 or more files changed:**
This is a large PR. Deploy parallel sub-agents to gather context efficiently:
Expand All @@ -43,7 +45,7 @@ This is a large PR. Deploy parallel sub-agents to gather context efficiently:

## Step 4: Four review passes

Execute four independent review passes. For PRs with fewer than 100 files, do these sequentially. For large PRs, launch agents in parallel.
Execute four independent review passes **in parallel** using separate tool calls. Each pass operates independently on the file context gathered in Step 3.

### Pass 1 + 2: Code standards and style compliance

Expand Down Expand Up @@ -93,18 +95,17 @@ For each issue found across all passes, assign a confidence score from 0 to 100:
- **75**: Highly confident, real and important
- **100**: Absolutely certain, definitely real

**Validation**: For each finding scored 50 or above, verify it by:
- Re-reading the relevant code in full context (not just the diff)
**Filter**: Discard all findings below confidence 80.

**Validation**: For each finding scored **80 or above**, verify it by:
- Re-reading the relevant code in full context (not just the diff) if not already cached from Step 3
- Checking if the pattern is intentionally used elsewhere in the codebase
- For style violations: confirming the project actually enforces this rule

**Filter**: Discard all findings below confidence 80.

**Always discard (false positives):**
- Pre-existing issues not introduced in this PR
- Code that appears buggy but is actually correct in context
- Pedantic nitpicks a senior engineer would not flag
- Issues that linters (ruff, mypy) will catch — do not run the linter to verify
- General code quality concerns not explicitly required by project conventions
- Issues silenced in code via lint-ignore comments

Expand Down Expand Up @@ -141,14 +142,16 @@ sequenceDiagram
<interactions showing the primary flow affected by this PR>
```

<Generate a Mermaid sequence diagram that shows the key interaction flow introduced or modified by this PR. Rules:>
<Generate a Mermaid sequence diagram **if the change affects architectural flow or component interactions**. Skip for simple bug fixes (typos, off-by-one errors, single-function changes). Rules:>
<- Maximum 8 participants>
<- Maximum 15 interactions>
<- For refactors: show before/after with labeled boxes>
<- For new features: show the end-to-end flow>
<- For bug fixes: show the incorrect flow crossed out and the corrected flow>
<- For bug fixes affecting flow: show the corrected flow>
<- Use descriptive labels on arrows>

<If skipping the diagram, replace this section with a brief explanation of why it's not needed.>

### Findings

<If findings exist above threshold:>
Expand All @@ -174,7 +177,7 @@ No issues found. Checked for bugs, security, and code standards compliance.
For each finding in the Findings table, post an inline comment using `mcp__github_inline_comment__create_inline_comment`.

Rules for inline comments:
- Maximum 10 inline comments total (prioritize by severity)
- Maximum 10 inline comments total (prioritize by severity), **unless there are more than 10 Critical severity findings**
- Each comment includes: severity tag, issue description, why it matters, and the suggested fix
- For small, self-contained fixes (< 6 lines): include a committable suggestion block
- For larger fixes: describe the issue and suggested approach without a suggestion block
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Claude Code

on:
pull_request:
types: [opened, synchronize, reopened]
issue_comment:
types: [created]
pull_request_review_comment:
Expand All @@ -17,6 +19,7 @@ permissions:
jobs:
claude:
if: |
(github.event_name == 'pull_request' && github.event.pull_request.draft == false) ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
Expand Down Expand Up @@ -47,7 +50,9 @@ jobs:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.LITELLM_API_KEY }}
prompt: |
${{ github.event_name == 'pull_request' && format('Review PR #{0} using the /review command.', github.event.pull_request.number) || '' }}
claude_args: |
--model claude-opus-4-6
--allowedTools "mcp__github_inline_comment__create_inline_comment"
--model claude-opus-4.5
--allowedTools "Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr comment:*),Bash(gh api:*),Bash(git show:*),Bash(git blame:*),mcp__github_inline_comment__create_inline_comment"
--append-system-prompt "CRITICAL INSTRUCTION: When a user asks you to review a pull request (e.g. @claude review, @claude review this PR, @claude please review), you MUST execute the /review slash command. Do NOT attempt a freeform review. Always use the /review skill — no exceptions."
Loading