Skip to content

Commit c0c32eb

Browse files
ntindleclaude
andcommitted
feat: enhance Claude GitHub Actions with advanced capabilities
- Upgraded both workflows to use Claude Opus 4.1 for better analysis - Added comprehensive permissions for repository interaction - Configured extensive allowed_tools for testing and verification - Added project-specific custom instructions focusing on: - MathJS unitMath usage enforcement - TypeScript requirements - Code quality standards - Enhanced PR review prompts with detailed criteria - Added sticky comments for continuous PR review updates - Configured environment variables for proper context 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2a8f2fc commit c0c32eb

3 files changed

Lines changed: 137 additions & 41 deletions

File tree

.claude/settings.local.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
"Bash(npx vite:*)",
1313
"Bash(npx tsc:*)",
1414
"Bash(gh pr view:*)",
15-
"Bash(gh api:*)"
15+
"Bash(gh api:*)",
16+
"Bash(cp:*)",
17+
"Fetch(*)",
18+
"WebSearch(*)"
1619
],
1720
"deny": []
1821
}

.github/workflows/claude-code-review.yml

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ jobs:
2020

2121
runs-on: ubuntu-latest
2222
permissions:
23-
contents: read
24-
pull-requests: read
25-
issues: read
26-
id-token: write
23+
contents: write # Allow Claude to suggest file changes
24+
pull-requests: write # Allow Claude to create review comments
25+
issues: write # Allow Claude to create issues for findings
26+
id-token: write # For OIDC authentication
27+
actions: read # Read CI results
28+
checks: write # Create check runs for review status
29+
statuses: write # Update commit status
2730

2831
steps:
2932
- name: Checkout repository
@@ -37,22 +40,45 @@ jobs:
3740
with:
3841
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3942

40-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
41-
# model: "claude-opus-4-1-20250805"
43+
# Use Claude Opus 4.1 for thorough code reviews
44+
model: "claude-opus-4-1-20250805"
4245

43-
# Direct prompt for automated review (no @claude mention needed)
46+
# Comprehensive review prompt with project-specific focus
4447
direct_prompt: |
45-
Please review this pull request and provide feedback on:
46-
- Code quality and best practices
47-
- Potential bugs or issues
48-
- Performance considerations
49-
- Security concerns
50-
- Test coverage
48+
Please perform a thorough code review of this pull request.
5149
52-
Be constructive and helpful in your feedback.
50+
CRITICAL PROJECT RULES:
51+
1. All calculations MUST use unitMath service (src/services/unitMath.ts) - NEVER use native JS math
52+
2. All new code must be TypeScript with proper types
53+
3. Use @/ import alias consistently
54+
4. Follow existing patterns in the codebase
55+
56+
Review for:
57+
- **Math Operations**: Flag ANY use of +, -, *, /, Math.* in calculation code
58+
- **TypeScript**: Proper typing, no 'any' types, interfaces defined
59+
- **Code Quality**: DRY principles, readability, maintainability
60+
- **Potential Bugs**: Edge cases, null checks, error handling
61+
- **Performance**: Unnecessary re-renders, memoization opportunities
62+
- **Security**: Input validation, XSS prevention, no exposed secrets
63+
- **Test Coverage**: New features should have tests
64+
- **Accessibility**: ARIA labels, keyboard navigation for UI changes
65+
- **Gridfinity Logic**: Correct bin calculations, spacer generation
66+
67+
Format your review with:
68+
✅ What looks good
69+
⚠️ Suggestions for improvement
70+
🚨 Critical issues that must be fixed
71+
72+
Be specific with line numbers and provide code examples for fixes.
5373
54-
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
55-
# use_sticky_comment: true
74+
# Use sticky comments to update review on new commits
75+
use_sticky_comment: true
76+
77+
# Enhanced permissions for review actions
78+
additional_permissions: |
79+
actions: read
80+
checks: write
81+
statuses: write
5682
5783
# Optional: Customize review based on file types
5884
# direct_prompt: |
@@ -68,11 +94,27 @@ jobs:
6894
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
6995
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
7096

71-
# Optional: Add specific tools for running tests or linting
72-
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
97+
# Allow Claude to run verification commands during review
98+
allowed_tools: |
99+
Bash(npm run test:*)
100+
Bash(npm run lint:*)
101+
Bash(npm run typecheck:*)
102+
Bash(npm run build:*)
103+
Bash(npx vitest *)
104+
Bash(npx eslint *)
105+
Bash(npx tsc --noEmit)
106+
Bash(git diff)
107+
Bash(git log)
108+
Bash(rg *)
109+
Bash(grep -r)
110+
Bash(find * -type f -name)
111+
Bash(cat *)
112+
Bash(head *)
113+
Bash(tail *)
73114
74-
# Optional: Skip review for certain conditions
75-
# if: |
76-
# !contains(github.event.pull_request.title, '[skip-review]') &&
77-
# !contains(github.event.pull_request.title, '[WIP]')
115+
# Custom environment for review context
116+
claude_env: |
117+
REVIEW_MODE: strict
118+
PROJECT: gridfinity-space-optimizer
119+
TECH_STACK: React,TypeScript,Vite,TailwindCSS,MathJS
78120

.github/workflows/claude.yml

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,15 @@ jobs:
1919
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
2020
runs-on: ubuntu-latest
2121
permissions:
22-
contents: read
23-
pull-requests: read
24-
issues: read
25-
id-token: write
26-
actions: read # Required for Claude to read CI results on PRs
22+
contents: write # Allow Claude to create/edit files
23+
pull-requests: write # Allow Claude to create/update PRs
24+
issues: write # Allow Claude to create/update issues
25+
id-token: write # For OIDC authentication
26+
actions: read # Required for Claude to read CI results on PRs
27+
checks: read # Allow reading check runs
28+
statuses: read # Allow reading commit statuses
29+
packages: read # Allow reading packages if needed
30+
discussions: write # Allow Claude to participate in discussions
2731
steps:
2832
- name: Checkout repository
2933
uses: actions/checkout@v4
@@ -36,29 +40,76 @@ jobs:
3640
with:
3741
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3842

39-
# This is an optional setting that allows Claude to read CI results on PRs
43+
# Enhanced permissions for Claude to interact with the repository
4044
additional_permissions: |
4145
actions: read
46+
checks: read
47+
statuses: read
48+
packages: read
4249
43-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
44-
# model: "claude-opus-4-1-20250805"
50+
# Use Claude Opus 4.1 for more complex tasks
51+
model: "claude-opus-4-1-20250805"
4552

4653
# Optional: Customize the trigger phrase (default: @claude)
4754
# trigger_phrase: "/claude"
4855

4956
# Optional: Trigger when specific user is assigned to an issue
5057
# assignee_trigger: "claude-bot"
5158

52-
# Optional: Allow Claude to run specific commands
53-
# allowed_tools: "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)"
59+
# Allow Claude to run a comprehensive set of commands
60+
allowed_tools: |
61+
Bash(npm install)
62+
Bash(npm ci)
63+
Bash(npm run build:*)
64+
Bash(npm run test:*)
65+
Bash(npm run lint:*)
66+
Bash(npm run typecheck:*)
67+
Bash(npm run dev:*)
68+
Bash(npm run preview:*)
69+
Bash(npx *)
70+
Bash(git status)
71+
Bash(git diff:*)
72+
Bash(git log:*)
73+
Bash(git branch:*)
74+
Bash(gh pr *)
75+
Bash(gh issue *)
76+
Bash(gh api *)
77+
Bash(node *)
78+
Bash(tsx *)
79+
Bash(vitest:*)
80+
Bash(eslint:*)
81+
Bash(prettier:*)
82+
Bash(tsc:*)
83+
Bash(echo *)
84+
Bash(cat *)
85+
Bash(ls *)
86+
Bash(pwd)
87+
Bash(which *)
88+
Bash(find * -type f -name)
89+
Bash(grep -r)
90+
Bash(rg *)
5491
55-
# Optional: Add custom instructions for Claude to customize its behavior for your project
56-
# custom_instructions: |
57-
# Follow our coding standards
58-
# Ensure all new code has tests
59-
# Use TypeScript for new files
92+
# Custom instructions for Claude to follow project standards
93+
custom_instructions: |
94+
Follow the CLAUDE.md file in the repository root for project guidelines
95+
Use TypeScript for all new files
96+
Follow existing code patterns and conventions
97+
Use MathJS unitMath for all calculations (never use native JS math)
98+
Ensure all new code has tests
99+
Run linter and type checks before suggesting changes
100+
Use the @/ import alias consistently
101+
Prefer editing existing files over creating new ones
102+
When reviewing PRs, check for:
103+
- Proper use of unitMath instead of native math operations
104+
- TypeScript type safety
105+
- Test coverage for new features
106+
- Consistent code style
107+
- Performance implications
108+
- Security considerations
60109
61-
# Optional: Custom environment variables for Claude
62-
# claude_env: |
63-
# NODE_ENV: test
110+
# Custom environment variables for Claude
111+
claude_env: |
112+
NODE_ENV: development
113+
CI: true
114+
VITE_PORT: 8080
64115

0 commit comments

Comments
 (0)