Skip to content

Commit 014cd74

Browse files
authored
Improve Claude PR review: add Go tooling, static analysis phase, and positive feedback (#723)
- Add Go setup step so Claude can compile and vet code - Expand allowed tools to include go build, go vet, go mod tidy, golangci-lint - Restructure prompt into 3 phases: static analysis, code review, acknowledge good work - Add explicit instruction to read CLAUDE.md for project conventions
1 parent e353b79 commit 014cd74

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ jobs:
8080
with:
8181
fetch-depth: 0
8282

83+
- name: Set up Go
84+
uses: actions/setup-go@v5
85+
with:
86+
go-version-file: ".go-version"
87+
check-latest: true
88+
8389
- name: Claude review (general)
8490
uses: anthropics/claude-code-action@v1
8591
env:
@@ -92,12 +98,26 @@ jobs:
9298
claude_args: |
9399
--max-turns 30
94100
--model claude-opus-4-6
95-
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)"
101+
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(go build:*),Bash(go vet:*),Bash(go mod tidy:*),Bash(git diff:*),Bash(golangci-lint:*)"
96102
97103
prompt: |
98104
REPO: ${{ github.repository }}
99105
PR NUMBER: ${{ github.event.pull_request.number }}
100106
107+
Read CLAUDE.md in the repo root for build commands, architecture details, and testing patterns.
108+
Use this context to assess whether the PR follows established conventions.
109+
110+
## Phase 1: Static Analysis (run these BEFORE reading code)
111+
112+
Run the following checks and note any failures:
113+
1. `go build ./...` — verify the code compiles
114+
2. `go vet ./...` — catch common Go mistakes
115+
3. `go mod tidy && git diff --exit-code go.mod go.sum` — check for missing or unused dependencies
116+
117+
Include any failures from these checks in your review as high-priority issues.
118+
119+
## Phase 2: Code Review
120+
101121
Review this PR for:
102122
103123
1. **Code quality** – clarity, consistency with the rest of the codebase, and adherence to existing patterns.
@@ -108,6 +128,11 @@ jobs:
108128
6. **Security implications** – potential security vulnerabilities, data exposure, and other security risks.
109129
7. **Performance considerations** – potential performance bottlenecks, scalability issues, and other performance risks.
110130
131+
## Phase 3: Acknowledge Good Work
132+
133+
Briefly note any well-designed patterns, good testing practices, or thoughtful improvements in the PR.
134+
A good review balances constructive criticism with recognition of quality work.
135+
111136
Note: The PR branch is already checked out in the current working directory.
112137
Be concise and actionable. Prefer inline suggestions where possible; add a short summary at the end.
113138

0 commit comments

Comments
 (0)