---
/plugin marketplace add fanioz/claude-code-pr-automation/plugin install fanioz-pr-automation@fanioz/claude-code-pr-automationThis skill inherits all available tools. When active, it can use any tool Claude has access to.
reference.mdtemplates/review-comment.mdAutomatically review pull requests using specialized agents, post reviews to GitHub, apply fixes with user approval, and iterate until the PR is ready to merge.
Trigger this skill when the user asks to:
Determine which PR to review:
gh pr view --json number)# Get current branch
git branch --show-current
# Find PR for current branch
gh pr view --json number,headRefName,title,state
# Get PR details
gh pr view $PR_NUMBER --json number,title,author,headRefName,baseRefName,state,additions,deletions,files
# Get PR diff
gh pr diff $PR_NUMBER
Store:
Based on file types, decide which agents to launch:
Always Run:
code-reviewer - General code quality and conventionsRun for Code Files (.ts, .tsx, .js, .jsx, .py, .go, .rs, etc.):
silent-failure-hunter - Error handling and edge casestype-design-analyzer - Type safety and designRun for Test Files (.test.ts, .spec.ts, tests/, *.test.js, *.spec.js):
pr-test-analyzer - Test coverage and qualityRun for Documentation (.md, .mdx, .txt):
comment-analyzer - Comment accuracy and completenessUse the Task tool to launch agents simultaneously:
Launch all applicable agents in one message for efficiency.
Agent Prompt Template:
Review PR #${PR_NUMBER} "${TITLE}" by ${AUTHOR}
**Files Changed**: ${FILES_CHANGED}
**Branch**: ${BRANCH_NAME}
**Diff**: [include relevant portions of diff]
Focus on: [agent-specific focus area]
Return findings with:
- Critical issues (confidence >= 90)
- High priority issues (confidence >= 80)
- Medium priority issues (confidence >= 70)
- File locations and line numbers
- Specific code examples for fixes
Collect results from all agents and organize by priority:
Critical Issues (Must Fix):
High Priority Issues (Should Fix):
Medium Priority Issues (Nice to Have):
Positive Observations:
Format findings into a comprehensive review:
## ⚠️ Review: [APPROVE/REQUEST CHANGES/COMMENT]
# PR #${NUMBER}: ${TITLE}
**Author**: ${AUTHOR}
**Branch**: ${BRANCH}
**Changes**: ${ADDITIONS}+ ${DELETIONS}-
---
## Summary
[2-3 sentence summary of overall assessment]
---
## 🚨 Critical Issues (Must Fix) - ${CRITICAL_COUNT}
### 1. [Title]
- **Agent**: [agent-name]
- **File**: `path/to/file:line`
- **Confidence**: X%
**Issue**:
[Description]
**Fix**:
\`\`\`typescript
[fix code]
\`\`\`
[... repeat for each critical issue]
---
## ⚠️ High Priority Issues (Should Fix) - ${HIGH_COUNT}
### 1. [Title]
- **Agent**: [agent-name]
- **File**: `path/to/file:line`
- **Confidence**: X%
**Issue**:
[Description]
**Suggested Fix**:
[Suggestion]
[... repeat for each high issue]
---
## 🔶 Medium Priority Issues - ${MEDIUM_COUNT}
- **[agent-name]**: [description] (`path/to/file:line`)
[... list all medium issues]
---
## ✅ Positive Observations
- [Strength 1]
- [Strength 2]
[... list all positive observations]
---
## Recommended Action
[approve/request changes/comment]
**Next Steps**:
1. Address critical issues first
2. Fix high priority issues
3. Consider medium priority improvements
4. Re-run review after fixes
---
Reviewed by Claude Code PR Automation
Agents: code-reviewer, silent-failure-hunter, type-design-analyzer, pr-test-analyzer, comment-analyzer
# Determine review action
if critical_issues > 0:
action="--request-changes"
elif high_issues > 0:
action="--comment"
else:
action="--approve"
# Post review
gh pr review $PR_NUMBER $action --body "$REVIEW_BODY"
If critical or high issues found, use AskUserQuestion tool:
Found ${critical_count} critical and ${high_count} high priority issues.
What would you like to do?
- Apply all fixes automatically
- Review each fix before applying
- I'll fix manually
- Skip fixes for now
For each issue to fix:
Simple Fixes (single line/small change):
Complex Fixes (multiple lines/refactoring):
Fix Application Pattern:
1. Read current file: Read({ file_path: "path/to/file" })
2. Apply fix: Edit({ file_path, old_string, new_string })
3. Commit: Bash({ command: "git add path/to/file && git commit -m 'fix: description'" })
# Push fixes to PR branch
git push origin $BRANCH_NAME
After pushing fixes:
When no critical/high issues remain:
gh pr review $PR_NUMBER --approve --body "✅ All critical and high priority issues resolved. Ready to merge."
Optional: Auto-merge if user approves:
gh pr merge $PR_NUMBER --merge --delete-branch
If PR doesn't exist:
If agents fail:
If git push fails:
If gh CLI not authenticated:
gh auth loginIf merge conflicts exist:
Always Allowed (via allowed-tools):
Will Ask Permission:
Skill not triggering:
~/.claude/skills/pr-automation/SKILL.mdAgents not launching:
Reviews not posting:
gh auth statusFixes not applying:
Push failing:
git statusgit branch -rIteration not working:
User: "Review PR 28" Claude: [Identifies PR 28, fetches details, launches agents, posts review, asks to fix]
User: "Review this PR and fix any issues" Claude: [Full workflow: review → post → fix → iterate → approve]
User: "Check if there are any issues with the current PR" Claude: [Review only, no fixes unless user approves]
User: "Review PR 123 and iterate until it's ready" Claude: [Full automated workflow with multiple iterations]
Keep track of:
Display progress:
Iteration 1/5:
- Critical issues: 2
- High priority issues: 3
- Fixed: 0
Iteration 2/5:
- Critical issues: 0
- High priority issues: 1
- Fixed: 2 critical
[Continue until done]
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.