Skip to content

Commit 7d4acc6

Browse files
gobetticlaude
andauthored
Make claude-review.yml reusable and configurable (#23)
- Add `extra_prompt` input so callers can append repo-specific review rules without forking the workflow - Add `timeout_minutes` input so callers can override the job timeout (default: 15) and now using that instead of the hardcoded 15 - Make `claude_args` use `${{ inputs.model }}` and `${{ inputs.max_turns }}` consistently - Add `use_sticky_comment: true` so subsequent PR pushes update the existing review comment, instead of creating new ones - Remove `github_token` so comments are posted by the Claude bot, not the GitHub Actions bot - Embed the full review rubric directly in the prompt (security, compliance, data/migrations, performance, testing, APIs, dependencies) so callers inherit it automatically - Strip all platform/framework-specific content from the base rubric (no iOS/Android, no specific linter names, no mobile-only bullet points) to keep it generic for all repos To adopt in any repo (replacing an existing standalone claude.yml): # .github/workflows/claude.yml name: Claude Code – PR Review on: pull_request: types: [opened, synchronize, reopened, ready_for_review] jobs: review: uses: isapp/.github/.github/workflows/claude-review.yml@main secrets: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} with: # Optional — only specify what differs from the defaults: max_turns: 25 # default: 15 timeout_minutes: 25 # default: 15 extra_prompt: | # default: "" (nothing appended) ## Repo-Specific Rules - Example rule A - Example rule B Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f0cd2d9 commit 7d4acc6

1 file changed

Lines changed: 99 additions & 3 deletions

File tree

.github/workflows/claude-review.yml

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ on:
1212
required: false
1313
type: number
1414
default: 15
15+
timeout_minutes:
16+
description: "Job timeout in minutes"
17+
required: false
18+
type: number
19+
default: 15
20+
extra_prompt:
21+
description: "Additional prompt content appended after the base review prompt"
22+
required: false
23+
type: string
24+
default: ""
1525
secrets:
1626
ANTHROPIC_API_KEY:
1727
required: true
@@ -30,7 +40,7 @@ concurrency:
3040
jobs:
3141
review:
3242
runs-on: ubuntu-latest
33-
timeout-minutes: 15
43+
timeout-minutes: ${{ inputs.timeout_minutes }}
3444
steps:
3545
- name: Checkout PR
3646
uses: actions/checkout@v5
@@ -43,17 +53,103 @@ jobs:
4353
env:
4454
GITHUB_EVENT_NAME: pull_request
4555
with:
46-
github_token: ${{ secrets.GITHUB_TOKEN }}
4756
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
4857
allowed_bots: "renovate,devin-ai-integration"
58+
use_sticky_comment: true
4959
prompt: |
5060
/review
5161
5262
IMPORTANT: Also reference and apply the organization-wide code review guidelines available at:
5363
https://github.com/isapp/.github/blob/main/CLAUDE.md
5464
5565
These org-level guidelines cover security (OWASP, SQL injection, auth), compliance (HIPAA, SOC2, FedRAMP),
56-
data handling, mobile development, infrastructure, performance, testing, APIs, and dependencies.
66+
data handling, infrastructure, performance, testing, APIs, and dependencies.
5767
Apply these standards IN ADDITION to any repository-specific CLAUDE.md guidelines.
68+
69+
# Review rubric (Claude)
70+
71+
## Must-fix
72+
73+
### Security
74+
- OWASP Top 10 issues: SQL injection, XSS, CSRF, broken authentication, insecure deserialization
75+
- AuthN/Z: verify JWT validation, session management, proper OAuth flows, role-based access
76+
- API security: rate limiting, input validation, API key rotation, proper CORS configuration
77+
- Secrets: no hardcoded credentials, use environment variables or secrets management
78+
- PII handling: encrypt PII at rest and in transit, redact PII in logs and error messages
79+
- FedRAMP/HIPAA compliance requirements
80+
81+
### Compliance (HIPAA/SOC2/FedRAMP)
82+
- Logging: no PHI/PII in logs, logs encrypted, proper retention policies
83+
- Encryption: use approved algorithms (AES-256, TLS 1.2+), proper key management
84+
- Access control: least-privilege, MFA for admin access, proper role separation
85+
- Audit trails: log access to sensitive data, retain audit logs per compliance requirements
86+
- Data deletion: implement proper data lifecycle, support user data deletion requests
87+
88+
### Data & Migrations
89+
- Migrations: safe, rollbackable, tested in staging before production
90+
- Schema changes: backward compatible, no breaking changes without version bump
91+
- Indexes: add indexes for foreign keys and frequently queried columns
92+
- Data validation: constraints at database level, not just application level
93+
- PHI/PII: ensure proper encryption, audit trails for sensitive data access
94+
95+
## Should-fix
96+
97+
### Performance
98+
- Database: N+1 queries, missing indexes, unbounded result sets
99+
- API: missing pagination for list endpoints, slow queries without caching
100+
- Memory: large allocations, memory leaks, inefficient data structures
101+
102+
### Testing
103+
- Unit tests: cover edge cases, error conditions, security validations
104+
- Integration tests: test API contracts, database interactions, mock external services
105+
- Security tests: authentication failures, authorization boundaries, input validation
106+
107+
### APIs/Services
108+
- API design: RESTful conventions, proper HTTP status codes, versioning strategy
109+
- Error handling: consistent error response format, proper logging without PII
110+
- Service-to-service: proper authentication tokens, circuit breakers, timeouts
111+
- Pagination: implement for list endpoints to prevent large responses
112+
- Documentation: ensure API changes include updated Swagger/OpenAPI docs
113+
114+
### Dependencies
115+
- Security: flag outdated dependencies with known CVEs
116+
- Version pinning: use specific versions in production dependencies
117+
- Licensing: ensure licenses are compatible with your usage
118+
- Deprecations: flag usage of deprecated APIs or libraries
119+
120+
## Nice-to-have (optional suggestions)
121+
122+
- Code clarity: simplify complex logic, extract helper functions, add explanatory comments
123+
- Documentation: update README for significant features, add inline docs for complex logic
124+
- Performance optimizations: suggest caching opportunities, query optimizations (non-critical)
125+
126+
## Style
127+
128+
- Follow the repo's linters and formatters
129+
- Keep suggestions concise and actionable
130+
- Show patch-style diffs for proposed changes
131+
- Group related issues together
132+
133+
## Behavior
134+
135+
- Be terse and direct in comments
136+
- Prefer inline comments on specific diff lines when possible
137+
- Prioritize must-fix issues over nice-to-have suggestions
138+
- When reviewing code for issues, if you initially find an issue but then determine no fix is needed, do not comment on it in the findings summary.
139+
- Skip review for:
140+
- Pure whitespace/formatting changes (if linters pass)
141+
- Documentation-only updates (unless security/compliance docs)
142+
- Configuration changes without code impact
143+
- Minor dependency bumps (unless security-related)
144+
- If skipping, comment: "No significant code changes to review" and explain why
145+
146+
## Instructions
147+
1. Review the PR based on review rubric and focus on must-fix items, security, HIPAA, and compliance issues. Be concise.
148+
2. If issues found, post specific inline comments on the problematic lines
149+
3. If no issues, comment "LGTM - no security/compliance issues detected"
150+
4. Be concise and actionable
151+
5. Provide detailed feedback on code review
152+
153+
${{ inputs.extra_prompt }}
58154
claude_args: "--model ${{ inputs.model }} --max-turns ${{ inputs.max_turns }} --allowedTools 'Read,Glob,Grep,Bash(git log:*),Bash(git diff:*),Bash(git show:*)'"
59155
track_progress: true

0 commit comments

Comments
 (0)