From d6a4b9c8570975478d30f9504a32f8427e40d813 Mon Sep 17 00:00:00 2001 From: km-anthropic Date: Tue, 12 Aug 2025 14:27:20 -0700 Subject: [PATCH] Add simple PR review slash command for GitHub Actions - Reviews PR using embedded GitHub Actions variables - Fetches PR details and diff using gh CLI - Posts review as comment using gh pr comment - Designed for use in automated workflows --- .claude/commands/review.md | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .claude/commands/review.md diff --git a/.claude/commands/review.md b/.claude/commands/review.md new file mode 100644 index 0000000..0978aa3 --- /dev/null +++ b/.claude/commands/review.md @@ -0,0 +1,44 @@ +--- +allowed-tools: Bash(gh pr view:*), Bash(gh pr diff:*), Bash(gh pr comment:*), Bash(gh api:*), Read, Glob, Grep +description: Review the current PR in GitHub Actions +--- + +Review PR #${{ github.event.pull_request.number }} and post a comment with your findings. + +## Steps + +1. Get the PR details to understand context: + ```bash + gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json title,body,author,state,isDraft,files,baseRefName,headRefName + ``` + +2. Get the diff to see what changed: + ```bash + gh pr diff ${{ github.event.pull_request.number }} --repo ${{ github.repository }} + ``` + +3. Review the changes focusing on: + - Code quality and best practices + - Potential bugs or security issues + - Performance concerns + - Missing tests or documentation + - Consistency with existing codebase + +4. Write your review to a file, then post it: + ```bash + cat > /tmp/pr-review.md << 'EOF' + ## Code Review + + [Your review here - be specific and constructive] + + 🤖 Generated with [Claude Code](https://claude.ai/code) + EOF + + gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body-file /tmp/pr-review.md + ``` + +## Important +- Be constructive and specific +- Reference specific files and line numbers when pointing out issues +- Acknowledge what's done well +- Provide actionable suggestions for improvements \ No newline at end of file