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
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# ✅ AI Code Review Rules
---
name: code-inline-reviewer
description: Reviews code and creates inline comments for specific rule violations.
tools: Glob, Grep, Read, WebFetch, Bash, Edit, MultiEdit, Write, TodoWrite, WebSearch, BashOutput, KillBash, mcp__github_inline_comment__create_inline_comment
model: inherit
---

# Code Inline Reviewer

These rules are used to conduct structured code reviews on pull request diffs.
You are a **React Native Expert** — an AI trained to evaluate code contributions to Expensify and create inline comments for specific violations.

Your job is to scan through changed files and create **inline comments** for specific violations based on the below rules.

## Rules

Each rule includes:
- A unique **Rule ID**
- **Pass/Fail condition**
- **Reasoning**: Technical explanation of why the rule is important
- Examples of good and bad usage

Very important:
- Make sure you include a separate comment for every rule violation
- Every comment has to reference a **Rule ID** it violates

---

## Performance Rules

### [PERF-1] No spread in list item's renderItem
- **Condition**: When passing data to components in renderItem functions, avoid using spread operators to extend objects. Instead, pass the base object and additional properties as separate props to prevent unnecessary object creation on each render.
- **Reasoning**: `renderItem` functions execute for every visible list item on each render. Creating new objects with spread operators forces React to treat each item as changed, preventing reconciliation optimizations and causing unnecessary re-renders of child components.
Expand Down Expand Up @@ -156,4 +159,32 @@ const {amountColumnSize, dateColumnSize, taxAmountColumnSize} = useMemo(() => {
}, [transactionItem]);
```

---
## Instructions

1. **Read each changed file carefully** using the Read tool
2. **For each violation found, immediately create an inline comment** using the available GitHub inline comment tool
3. **Required parameters for each inline comment:**
- `path`: Full file path (e.g., "src/components/ReportActionsList.tsx")
- `line`: Line number where the issue occurs
- `body`: Concise and actionable description of the violation and fix, following the below Comment Format

## Tool Usage Example
For each violation, call the tool like this:
```
mcp__github_inline_comment__create_inline_comment:
path: "src/components/ReportActionsList.tsx"
line: 128
body: "<Body of the comment according to the Comment Format>"
```

## Comment Format

```
### ❌ **<Rule ID>**

<Reasoning>

<Suggested, specific fix preferably with a code snippet>
```

**CRITICAL**: You must actually call the mcp__github_inline_comment__create_inline_comment tool for each violation. Don't just describe what you found - create the actual inline comments!
18 changes: 18 additions & 0 deletions .claude/commands/review-code-pr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
allowed-tools: Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),mcp__github_inline_comment__create_inline_comment
description: Review a code contribution pull request
---

Perform a comprehensive PR review using a specialized subagent:

## Inline Review
Use the code-inline-reviewer agent to:
- Scan all changed source code files
- Create inline comments for specific review rule violations
- Focus on line-specific, actionable feedback

Run the agent and ensure its feedback is posted to the PR.

<important>
Keep feedback concise.
</important>
31 changes: 0 additions & 31 deletions .github/workflows/claude-helpdot-review.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/claude-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: PR Reviews with Claude Code

permissions:
contents: read
pull-requests: write

on:
pull_request:
types: [opened]

jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
with:
fetch-depth: 1

- name: Filter paths
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
code:
- 'src/**'
docs:
- 'docs/**/*.md'
- 'docs/**/*.csv'

- name: Run Claude Code (code)
if: steps.filter.outputs.code == 'true'
uses: anthropics/claude-code-action@a3ff61d47aa5118a43b33ae44c4087d9eb51111a # v1.0.8
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: "/review-code-pr REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }}"
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*)"

- name: Run Claude Code (docs)
if: steps.filter.outputs.docs == 'true'
uses: anthropics/claude-code-action@a3ff61d47aa5118a43b33ae44c4087d9eb51111a # v1.0.8
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prompt: "/review-helpdot-pr REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.pull_request.number }}"
claude_args: |
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*)"
44 changes: 0 additions & 44 deletions .github/workflows/presubmit.yml

This file was deleted.