brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
pr-code-reviewComprehensive code review for GitHub pull requests using parallel agents. Checks bugs, CLAUDE.md compliance, git history, previous PR patterns, and code comments. Use when reviewing PRs, doing code review, or when user mentions "review PR", "check PR", or provides a PR number.
Independent GitHub snapshot · Automated classification · Original documentation governs
Performs comprehensive, multi-dimensional code review for GitHub pull requests using 5 parallel Sonnet agents and confidence-based issue scoring.
User: "Review PR #945"
Assistant: [Launches this skill with PR number 945]
This skill implements an 8-step comprehensive review:
Eligibility check (Haiku agent)
Find CLAUDE.md files (Haiku agent)
Get PR summary (Haiku agent)
Launch 5 parallel review agents (Sonnet agents)
Score all issues (parallel Haiku agents)
Filter issues
Re-verify eligibility (Haiku agent)
Post review comment (gh command)
Use TodoWrite to create tracking list:
- Check PR eligibility
- Find CLAUDE.md files
- Get PR summary
- Launch 5 review agents
- Score issues
- Filter and verify
- Post review comment
Launch Haiku agent to verify:
- Is PR closed? → SKIP
- Is PR draft? → SKIP
- Doesn't need review (automated/trivial)? → SKIP
- Already has Claude Code review? → SKIP
Use: gh pr view {number}
gh api repos/{owner}/{repo}/pulls/{number}/comments
Launch Haiku agent to locate:
- Root CLAUDE.md
- Directory-specific CLAUDE.md files for modified paths
Use: gh pr view {number} --json files
Check for CLAUDE.md in each directory
Return list of CLAUDE.md file paths (not contents).
Launch Haiku agent to extract:
- What the PR adds/changes/fixes
- Key files modified
- Main functionality changes
Use: gh pr view {number}
gh pr diff {number}
IMPORTANT: Launch all 5 agents in parallel (single message, multiple Task calls).
Review PR for CLAUDE.md compliance:
- Read CLAUDE.md files
- Check code style (type hints, docstrings, line length 88, PEP 8)
- Check testing requirements
- Check package management (uv only, no pip)
- Note: CLAUDE.md is guidance for writing code, not all applies to review
Return issues with:
- Issue description
- CLAUDE.md rule violated
- File and line reference
Review PR for obvious bugs:
- Use gh pr diff {number}
- Focus ONLY on changed lines
- Look for: logic errors, incorrect variable usage, missing critical error handling, runtime errors
- Avoid: nitpicks, style issues, false positives, pre-existing issues
Return issues with:
- Issue description
- Bug type
- File and line reference
Review PR against git history:
- Get modified files
- Use git blame and git log
- Look for: violated patterns, repeated historical bugs, relevant commit context
Return issues with:
- Issue description
- Historical context
- File and line reference
Review PR against previous PR patterns:
- Get modified files
- Search for recent PRs touching same files
- Check comments on those PRs for applicable feedback
Use: gh pr list --search "path:{file}" --state merged
Return issues with:
- Issue description
- Pattern from PR #X
- File and line reference
Review PR for code comment compliance:
- Read modified files
- Check for TODO comments, warnings, documented patterns
- Verify changes follow comment guidance
Return issues with:
- Issue description
- Comment guidance violated
- File and line reference
For EACH issue found by the 5 agents, launch a parallel Haiku agent to score it.
Scoring rubric (give to agent verbatim):
Score on 0-5 scale:
- 0: False positive. Not a real issue or pre-existing.
- 1: Low confidence. Might be real but likely false positive.
- 2: Uncertain. Could be real but might be nitpick or minor.
- 3: Moderate confidence. Real issue but not critical.
- 4: High confidence. Real issue that will impact functionality.
- 5: Critical. Definitely a real bug that will cause problems.
Agent instructions:
Score this issue on 0-5 scale using the rubric above.
Issue: [issue description]
For CLAUDE.md issues: Verify CLAUDE.md actually says this.
For bugs: Verify with gh pr diff that this is real.
Check for false positives: pre-existing issues, lines not modified, linter-catchable.
Return: score (0-5) and 1-2 sentence explanation.
1. Filter issues: Keep only score >= 4 (high confidence or critical)
2. If no issues >= 4: STOP, do not post review
3. Re-verify eligibility with Haiku agent (same as Step 2)
4. If not eligible: STOP
Get PR head commit SHA:
gh pr view {number} --json headRefOid --jq '.headRefOid'
Format comment:
### Code review
Found {N} issues:
1. {brief description} ({CLAUDE.md says "..."} or {bug due to ...})
{link with full SHA}
2. ...
🤖 Generated with [Claude Code](https://claude.ai/code)
<sub>- If this code review was useful, please react with 👍. Otherwise, react with 👎.</sub>
Or if no issues:
### Code review
No issues found. Checked for bugs and CLAUDE.md compliance.
🤖 Generated with [Claude Code](https://claude.ai/code)
Link format:
https://github.com/{owner}/{repo}/blob/{FULL_SHA}/{file_path}#L{start}-L{end}
Requirements:
- Use FULL commit SHA (not short)
- # before line numbers
- L prefix for lines
- Range format: L{start}-L{end}
- Include 1+ lines of context around issue
Post with:
gh pr comment {number} --body "{formatted_comment}"
Do NOT flag:
User: Review PR #945
Assistant: [Creates todo list, runs 8-step process, posts review]
User: Review all open PRs
Assistant: [Gets list with gh pr list, reviews each in sequence]
User: Review PR #959
Assistant: [Checks eligibility, finds incomplete description, skips with explanation]
Agents give contradictory scores: Trust the explanation, not just the number. If explanation says "not a problem" but score is 75, treat as false positive (score should be 0).
Too many issues found: This is good! The parallel agent approach catches more. The scoring step filters to only high-confidence issues (score >= 4).
PR changed during review: The re-verification step (Step 7) catches this.
No CLAUDE.md files: Review still works, just skips CLAUDE.md compliance checks.
gh) installed and authenticatedAfter completing review:
✓ Reviewed PR #{number}
- Found {N} high-confidence issues (score >= 4)
- Posted review comment: {URL}
Or:
✓ Reviewed PR #{number}
- No issues found
- Posted approval comment: {URL}
Or:
⊘ Skipped PR #{number}
- Reason: {eligibility issue}