diff --git a/.claude/skills/review.md b/.claude/skills/review.md index 6eccd5d9..51f66124 100644 --- a/.claude/skills/review.md +++ b/.claude/skills/review.md @@ -1,3 +1,11 @@ +--- +name: review +description: > + Perform a thorough code review of changed files. Use when the user asks + to "review" code, requests a code review, or uses @review. Do NOT trigger + when the user only asks a question about code without requesting a review. +--- + # Skill: review Perform a thorough code review of changed files, checking for correctness, Rust best practices, XLayer-specific conventions, security issues, and test coverage. diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index e7ffb6ab..c490cd0e 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -35,4 +35,40 @@ jobs: uses: anthropics/claude-code-action@v1 with: anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - custom_instructions: "Skills are available in .claude/skills/. Users can invoke them with /review or /commit in comments." + + claude-review: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@review')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@review')) + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + issues: write + id-token: write + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 1 + + - name: Load review skill + id: skill + run: | + if [ -f ".claude/skills/review.md" ]; then + SKILL_CONTENT=$(cat .claude/skills/review.md) + echo "skill_content<> $GITHUB_OUTPUT + echo "$SKILL_CONTENT" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + else + echo "skill_content=Perform a thorough code review." >> $GITHUB_OUTPUT + fi + + - name: Run Claude Review + id: claude + uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + prompt: | + ${{ steps.skill.outputs.skill_content }}