From b348e433548dd8896fee672ae1d7d4f78098a490 Mon Sep 17 00:00:00 2001 From: Ricardo Decal Date: Fri, 12 Dec 2025 08:31:26 -0800 Subject: [PATCH 1/3] "Update Claude PR Assistant workflow" --- .github/workflows/claude.yml | 45 ++++++++---------------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 2cf1bd4..d300267 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -32,46 +32,19 @@ jobs: - name: Run Claude Code id: claude - uses: anthropics/claude-code-action@beta + uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # This is an optional setting that allows Claude to read CI results on PRs additional_permissions: | actions: read - - # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) - # model: "claude-opus-4-20250514" - - # Optional: Customize the trigger phrase (default: @claude) - # trigger_phrase: "/claude" - - # Optional: Trigger when specific user is assigned to an issue - assignee_trigger: "claude-bot" - - # Optional: Allow Claude to run specific commands - allowed_tools: "Bash(uvx pre-commit run --all-files),Bash(python ci/check_*.py)" - - # Optional: Add custom instructions for Claude to customize its behavior for your project - custom_instructions: | - This is a Python/Bash tools repository. When reviewing or writing code: - - **Python Standards:** - - All scripts must have proper main guards (if __name__ == "__main__") - - Avoid 'Any' type hints - - Follow PEP 8 and Python best practices - - **Bash Standards:** - - Ensure scripts are safe and portable - - Use proper error handling - - Include helpful comments - - **General:** - - Check the README.md files in each directory for specific guidelines - - Run CI checks when appropriate to verify compliance - - Focus on code quality, security, and maintainability - - # Optional: Custom environment variables for Claude - # claude_env: | - # NODE_ENV: test + + # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. + # prompt: 'Update the pull request description to include a summary of changes.' + + # Optional: Add claude_args to customize behavior and configuration + # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md + # or https://code.claude.com/docs/en/cli-reference for available options + # claude_args: '--allowed-tools Bash(gh pr:*)' From 66bb028e6bdd9690a58797d6a220daae971e4736 Mon Sep 17 00:00:00 2001 From: Ricardo Decal Date: Fri, 12 Dec 2025 08:31:28 -0800 Subject: [PATCH 2/3] "Update Claude Code Review workflow" --- .github/workflows/claude-code-review.yml | 46 +++++++----------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 14ece19..8452b0f 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -17,14 +17,14 @@ jobs: # github.event.pull_request.user.login == 'external-contributor' || # github.event.pull_request.user.login == 'new-developer' || # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' - + runs-on: ubuntu-latest permissions: contents: read pull-requests: read issues: read id-token: write - + steps: - name: Checkout repository uses: actions/checkout@v4 @@ -33,45 +33,25 @@ jobs: - name: Run Claude Code Review id: claude-review - uses: anthropics/claude-code-action@beta + uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} - # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) - # model: "claude-opus-4-20250514" - - # Direct prompt for automated review (no @claude mention needed) - direct_prompt: | Please review this pull request and provide feedback on: - Code quality and best practices - Potential bugs or issues - Performance considerations - Security concerns - Test coverage - - Be constructive and helpful in your feedback. Ensure that the code follows the repo's coding standards as written in the README.md guides. - # 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(uvx pre-commit run --all-files)" - - # Optional: Skip review for certain conditions - # if: | - !contains(github.event.pull_request.title, '[skip-review]') && !contains(github.event.pull_request.title, '[WIP]') + 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://code.claude.com/docs/en/cli-reference for available options + claude_args: '--allowed-tools "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:*)"' From 2299148719030ca957191589b35ae4c949bd73bf Mon Sep 17 00:00:00 2001 From: Ricardo Decal Date: Fri, 12 Dec 2025 14:18:37 -0800 Subject: [PATCH 3/3] Restore repo-specific config and merge with new improvements - Restored original prompt referencing README.md guides (not CLAUDE.md) - Kept new REPO and PR NUMBER context info - Kept instruction to use 'gh pr comment' - Combined allowed_tools: pre-commit + gh CLI commands - Restored Python/Bash standards in custom instructions - Re-added sticky comments for review workflow - Kept v1 API updates with proper claude_args format - Cleaned up example comments to avoid YAML parser issues --- .github/workflows/claude-code-review.yml | 27 ++++++++++++++--- .github/workflows/claude.yml | 37 ++++++++++++++++++++---- 2 files changed, 54 insertions(+), 10 deletions(-) diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 8452b0f..b9e6a76 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -36,6 +36,11 @@ jobs: uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) + # model: "claude-opus-4-20250514" + + # Direct prompt for automated review (no @claude mention needed) prompt: | REPO: ${{ github.repository }} PR NUMBER: ${{ github.event.pull_request.number }} @@ -47,11 +52,25 @@ jobs: - Security concerns - Test coverage - Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback. + Be constructive and helpful in your feedback. Ensure that the code follows the repo's coding standards as written in the README.md guides. 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://code.claude.com/docs/en/cli-reference for available options - claude_args: '--allowed-tools "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:*)"' + # Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR + # Add specific tools for running tests/linting and GitHub CLI commands + claude_args: '--use-sticky-comment --allowed-tools "Bash(uvx pre-commit run --all-files),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:*)"' + + # Optional: Customize review based on file types + # 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 (example) + # You can conditionally set the prompt based on PR author association + + # Optional: Skip review for certain conditions (example) + # Add a job-level if condition to skip PRs with [skip-review] or [WIP] in title diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index d300267..7008a2c 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -40,11 +40,36 @@ jobs: additional_permissions: | actions: read - # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. - # prompt: 'Update the pull request description to include a summary of changes.' + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) + # model: "claude-opus-4-20250514" - # Optional: Add claude_args to customize behavior and configuration - # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md - # or https://code.claude.com/docs/en/cli-reference for available options - # claude_args: '--allowed-tools Bash(gh pr:*)' + # Optional: Customize the trigger phrase (default: @claude) + # claude_args: '--trigger-phrase "/claude"' + + # Optional: Trigger when specific user is assigned to an issue + # claude_args: '--assignee-trigger "claude-bot"' + + # Optional: Allow Claude to run specific commands and add custom instructions + claude_args: >- + --allowed-tools "Bash(uvx pre-commit run --all-files),Bash(python ci/check_*.py),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:*)" + --custom-instructions "This is a Python/Bash tools repository. When reviewing or writing code: + + **Python Standards:** + - All scripts must have proper main guards (if __name__ == \"__main__\") + - Avoid 'Any' type hints + - Follow PEP 8 and Python best practices + + **Bash Standards:** + - Ensure scripts are safe and portable + - Use proper error handling + - Include helpful comments + + **General:** + - Check the README.md files in each directory for specific guidelines + - Run CI checks when appropriate to verify compliance + - Focus on code quality, security, and maintainability" + + # Optional: Custom environment variables for Claude + # claude_env: | + # NODE_ENV: test