Skip to content

Commit c0f7e48

Browse files
Merge pull request #6947 from BitGo/WIN-7185
chore: added claude prompt
2 parents cf12c69 + 3a313af commit c0f7e48

File tree

2 files changed

+147
-0
lines changed

2 files changed

+147
-0
lines changed

.github/prompts/code-review.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Code Review Prompt for BitGoJS
2+
3+
You are an expert code reviewer for the BitGoJS cryptocurrency wallet SDK. Please review the changes in this pull request with focus on:
4+
5+
## Security & Cryptography
6+
- Cryptographic implementations and key handling
7+
- Security best practices for cryptocurrency operations
8+
- Proper validation of transaction parameters
9+
- Safe handling of private keys and sensitive data
10+
11+
## Code Quality & Architecture
12+
- Adherence to BitGoJS coding standards and patterns
13+
- TypeScript type safety and interface compliance
14+
- Proper error handling and edge cases
15+
- Code organization and maintainability
16+
17+
## Testing & Coverage
18+
- Test coverage for new functionality
19+
- Edge case testing for cryptocurrency operations
20+
- Integration test considerations
21+
- Mock implementations and test data safety
22+
23+
## BitGoJS Specific Concerns
24+
- Compliance with existing coin SDK patterns
25+
- Proper inheritance from base classes (BaseCoin, AbstractUtxoCoin, etc.)
26+
- Transaction serialization and deserialization correctness
27+
- Multi-signature wallet compatibility
28+
- Fee calculation accuracy
29+
30+
## Performance & Compatibility
31+
- Memory usage and performance implications
32+
- Node.js and browser compatibility
33+
- Dependency management and security
34+
- Breaking changes to public APIs
35+
36+
Please provide constructive feedback focusing on:
37+
1. Critical issues that must be addressed
38+
2. Suggestions for improvement
39+
3. Questions about design decisions
40+
4. Acknowledgment of good practices
41+
42+
Be thorough but concise, and explain the reasoning behind your suggestions.

.github/workflows/claude-pr.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Claude PR
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
issues: write
7+
id-token: write
8+
9+
on:
10+
issue_comment:
11+
types: [created]
12+
pull_request_review_comment:
13+
types: [created]
14+
15+
jobs:
16+
claude-pr:
17+
if: |
18+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
19+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
20+
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
21+
runs-on: ubuntu-latest
22+
env:
23+
AWS_REGION: us-west-2
24+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
25+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
26+
AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }}
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v5
30+
31+
- name: Configure AWS Credentials (OIDC)
32+
uses: aws-actions/configure-aws-credentials@v5
33+
with:
34+
role-to-assume: arn:aws:iam::199765120567:role/${{ github.event.repository.name }}-iam-protected
35+
aws-region: us-west-2
36+
37+
- name: Assume inference role
38+
id: inference-role
39+
run: |
40+
CREDS="$(aws sts assume-role \
41+
--role-arn arn:aws:iam::168000258654:role/BedrockInferenceRole \
42+
--role-session-name claude-inference-session \
43+
--query 'Credentials' \
44+
--output json)"
45+
46+
AWS_ACCESS_KEY_ID="$(echo "$CREDS" | jq -r '.AccessKeyId')"
47+
AWS_SECRET_ACCESS_KEY="$(echo "$CREDS" | jq -r '.SecretAccessKey')"
48+
AWS_SESSION_TOKEN="$(echo "$CREDS" | jq -r '.SessionToken')"
49+
50+
echo "::add-mask::$AWS_SECRET_ACCESS_KEY"
51+
{ echo "aws-access-key-id=$AWS_ACCESS_KEY_ID"; echo "aws-secret-access-key=$AWS_SECRET_ACCESS_KEY"; echo "aws-session-token=$AWS_SESSION_TOKEN"; } >> "$GITHUB_OUTPUT"
52+
53+
- name: Determine prompt to use
54+
id: determine-prompt
55+
env:
56+
COMMENT_BODY: ${{ github.event.comment.body }}
57+
run: |
58+
# Safely trim whitespace and check if it's just @claude
59+
TRIMMED_COMMENT=$(echo "$COMMENT_BODY" | xargs)
60+
61+
if [ "$TRIMMED_COMMENT" = "@claude" ]; then
62+
echo "use-code-review-prompt=true" >> "$GITHUB_OUTPUT"
63+
else
64+
echo "use-code-review-prompt=false" >> "$GITHUB_OUTPUT"
65+
fi
66+
67+
- name: Read code review prompt
68+
id: read-prompt
69+
if: steps.determine-prompt.outputs.use-code-review-prompt == 'true'
70+
run: |
71+
PROMPT_CONTENT=$(cat .github/prompts/code-review.md)
72+
{
73+
echo "prompt-content<<EOF"
74+
echo "$PROMPT_CONTENT"
75+
echo "EOF"
76+
} >> "$GITHUB_OUTPUT"
77+
78+
- uses: anthropics/claude-code-action@69dec299f882fef0fff1652a1309b7e9771b9f98
79+
if: steps.determine-prompt.outputs.use-code-review-prompt == 'true'
80+
env:
81+
AWS_REGION: us-west-2
82+
AWS_ACCESS_KEY_ID: ${{ steps.inference-role.outputs.aws-access-key-id }}
83+
AWS_SECRET_ACCESS_KEY: ${{ steps.inference-role.outputs.aws-secret-access-key }}
84+
AWS_SESSION_TOKEN: ${{ steps.inference-role.outputs.aws-session-token }}
85+
with:
86+
timeout_minutes: '10'
87+
github_token: ${{ secrets.GITHUB_TOKEN }}
88+
use_bedrock: 'true'
89+
anthropic_model: 'arn:aws:bedrock:us-west-2:168000258654:inference-profile/us.anthropic.claude-sonnet-4-20250514-v1:0'
90+
direct_prompt: ${{ steps.read-prompt.outputs.prompt-content }}
91+
92+
- uses: anthropics/claude-code-action@69dec299f882fef0fff1652a1309b7e9771b9f98
93+
if: steps.determine-prompt.outputs.use-code-review-prompt == 'false'
94+
env:
95+
AWS_REGION: us-west-2
96+
AWS_ACCESS_KEY_ID: ${{ steps.inference-role.outputs.aws-access-key-id }}
97+
AWS_SECRET_ACCESS_KEY: ${{ steps.inference-role.outputs.aws-secret-access-key }}
98+
AWS_SESSION_TOKEN: ${{ steps.inference-role.outputs.aws-session-token }}
99+
COMMENT_BODY: ${{ github.event.comment.body }}
100+
with:
101+
timeout_minutes: '10'
102+
github_token: ${{ secrets.GITHUB_TOKEN }}
103+
use_bedrock: 'true'
104+
anthropic_model: 'arn:aws:bedrock:us-west-2:168000258654:inference-profile/us.anthropic.claude-sonnet-4-20250514-v1:0'
105+
direct_prompt: $COMMENT_BODY

0 commit comments

Comments
 (0)