pr-automation
Automated pull request review workflow. Fetch PR from GitHub, review with specialized agents (code quality, error handling, type safety, tests, documentation), post review comments, ask for approval before fixing issues, iterate until mergeable. Use when user asks to "review PR", "check pull request", "fix PR issues", or similar.
What this skill does
# Automated PR Review Workflow
## Objective
Automatically review pull requests using specialized agents, post reviews to GitHub, apply fixes with user approval, and iterate until the PR is ready to merge.
## When to Use
Trigger this skill when the user asks to:
- Review a pull request
- Check PR for issues
- Fix PR problems
- Iterate on PR until mergeable
## Workflow Steps
### 1. Identify Pull Request
Determine which PR to review:
- If PR number provided: Use that PR
- If on branch: Find PR for current branch (`gh pr view --json number`)
- If no PR: Ask user which PR to review
```bash
# Get current branch
git branch --show-current
# Find PR for current branch
gh pr view --json number,headRefName,title,state
```
### 2. Fetch PR Information
```bash
# 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:
- PR number
- Branch name
- Changed files
- Diff content
### 3. Determine Review Scope
Based on file types, decide which agents to launch:
**Always Run**:
- `code-reviewer` - General code quality and conventions
**Run for Code Files** (.ts, .tsx, .js, .jsx, .py, .go, .rs, etc.):
- `silent-failure-hunter` - Error handling and edge cases
- `type-design-analyzer` - Type safety and design
**Run for Test Files** (.test.ts, .spec.ts, __tests__/, *.test.js, *.spec.js):
- `pr-test-analyzer` - Test coverage and quality
**Run for Documentation** (.md, .mdx, .txt):
- `comment-analyzer` - Comment accuracy and completeness
### 4. Launch Review Agents (Parallel)
Use 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
```
### 5. Aggregate Findings
Collect results from all agents and organize by priority:
**Critical Issues** (Must Fix):
- Issue 1: [description] - [agent-name] (file:line)
- Issue 2: [description] - [agent-name] (file:line)
**High Priority Issues** (Should Fix):
- Issue 1: [description] - [agent-name] (file:line)
- Issue 2: [description] - [agent-name] (file:line)
**Medium Priority Issues** (Nice to Have):
- Issue 1: [description] - [agent-name] (file:line)
**Positive Observations**:
- Strength 1: [description]
- Strength 2: [description]
### 6. Generate Review Comment
Format findings into a comprehensive review:
```markdown
## โ ๏ธ 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
```
### 7. Post Review to GitHub
```bash
# 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"
```
### 8. Offer to Fix Issues
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
```
### 9. Apply Fixes (If Approved)
For each issue to fix:
**Simple Fixes** (single line/small change):
1. Use Edit tool to apply fix
2. Show user the change
**Complex Fixes** (multiple lines/refactoring):
1. Ask user to review the proposed fix
2. Get approval before applying
3. Use Write tool for complete file rewrite
**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'" })
```
### 10. Push Changes
```bash
# Push fixes to PR branch
git push origin $BRANCH_NAME
```
### 11. Iterate (Loop)
After pushing fixes:
1. Go back to step 2 (fetch PR info)
2. Re-run review with updated code
3. Check if issues are resolved
4. Continue until:
- No critical or high issues remain
- PR is approved
- User chooses to stop
- Max iterations reached (5)
### 12. Final Approval
When no critical/high issues remain:
```bash
gh pr review $PR_NUMBER --approve --body "โ
All critical and high priority issues resolved. Ready to merge."
```
Optional: Auto-merge if user approves:
```bash
gh pr merge $PR_NUMBER --merge --delete-branch
```
## Error Handling
**If PR doesn't exist**:
- Inform user and ask for correct PR number
**If agents fail**:
- Log error
- Continue with other agents
- Inform user which agents succeeded/failed
**If git push fails**:
- Ask user to resolve merge conflicts
- Retry after conflicts resolved
**If gh CLI not authenticated**:
- Instruct user to run `gh auth login`
- Pause workflow until authenticated
**If merge conflicts exist**:
- Ask user to resolve conflicts
- Retry after resolution
## Tool Permissions
**Always Allowed** (via allowed-tools):
- Read, Grep, Glob - For reading code
- Bash - For git/gh commands
- Task - For launching agents
- AskUserQuestion - For user interaction
- Edit, Write - For applying fixes
- Skill - For invoking other skills
**Will Ask Permission**:
- Any tools not in allowed-tools list
## Best Practices
1. **Be Transparent**: Always show user what you're doing
2. **Ask Before Destructive Actions**: Get approval for pushes/merges
3. **Provide Context**: Explain why each fix is needed
4. **Iterate Safely**: Max 5 iterations to prevent infinite loops
5. **Respect User Choice**: Allow manual fixing or stopping workflow
6. **Maintain Git History**: Write clear commit messages
7. **Test After Fixes**: Re-run review to verify fixes work
8. **Parallel Execution**: Launch agents in parallel for speed
## Troubleshooting
**Skill not triggering**:
- Check description includes trigger words: "review PR", "pull request", "fix issues"
- Verify skill file is in correct location: `~/.claude/skills/pr-automation/SKILL.md`
**Agents not launching**:
- Verify Task tool is in allowed-tools
- Check agent names are correct (see reference.md)
- Ensure agents are available in the system
**Reviews not posting**:
- Verify ghRelated in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.