pr-review
Review PyTorch pull requests for code quality, test coverage, security, and backward compatibility. Use when reviewing PRs, when asked to review code changes, or when the user mentions "review PR", "code review", or "check this PR".
Install
mkdir -p .claude/skills/pr-review && curl -L -o skill.zip "https://mcp.directory/api/skills/download/929" && unzip -o skill.zip -d .claude/skills/pr-review && rm skill.zipInstalls to .claude/skills/pr-review
About this skill
PyTorch PR Review Skill
Review PyTorch pull requests focusing on what CI cannot check: code quality, test coverage adequacy, security vulnerabilities, and backward compatibility. Linting, formatting, type checking, and import ordering are handled by CI.
Usage Modes
No Argument
If the user invokes /pr-review with no arguments, do not perform a review. Instead, ask the user what they would like to review:
What would you like me to review?
- A PR number or URL (e.g.,
/pr-review 12345)- A local branch (e.g.,
/pr-review branch)
Local CLI Mode
The user provides a PR number or URL:
/pr-review 12345
/pr-review https://github.com/pytorch/pytorch/pull/12345
For a detailed review with line-by-line specific comments:
/pr-review 12345 detailed
Use gh CLI to fetch PR data:
# Get PR details
gh pr view <PR_NUMBER> --json title,body,author,baseRefName,headRefName,files,additions,deletions,commits
# Get the diff
gh pr diff <PR_NUMBER>
# Get PR comments
gh pr view <PR_NUMBER> --json comments,reviews
Local Branch Mode
Review changes in the current branch that are not in main:
/pr-review branch
/pr-review branch detailed
Use git commands to get branch changes:
# Get current branch name
git branch --show-current
# Get list of changed files compared to main
git diff --name-only main...HEAD
# Get full diff compared to main
git diff main...HEAD
# Get commit log for the branch
git log main..HEAD --oneline
# Get diff stats (files changed, insertions, deletions)
git diff --stat main...HEAD
For local branch reviews:
- The "Summary" should describe what the branch changes accomplish based on commit messages and diff
- Use the current branch name in the review header instead of a PR number
- All other review criteria apply the same as PR reviews
GitHub Actions Mode
When invoked via workflow, PR data is passed as context. The PR number or diff will be available in the prompt.
Review Workflow
Step 1: Fetch PR Information
For local mode, use gh commands to get:
- PR metadata (title, description, author)
- List of changed files
- Full diff of changes
- Existing comments/reviews
- Fetch associated issue information when applicable
Step 2: Analyze Changes
Read through the diff systematically:
- Identify the purpose of the change from title/description/issue
- Group changes by type (new code, tests, config, docs)
- Note the scope of changes (files affected, lines changed)
Step 3: Deep Review
Perform thorough line-by-line analysis using the review checklist. See review-checklist.md for detailed criteria covering:
- Code quality and design
- Testing adequacy
- Security considerations
- Thread safety and concurrency (Python, C++, CPython C API, NoGIL)
- Performance implications
- Any behavior change not expected by author
Step 4: Check Backward Compatibility
Evaluate BC implications. See bc-guidelines.md for:
- What constitutes a BC-breaking change
- Required deprecation patterns
- Common BC pitfalls
Step 5: Formulate Review
Structure your review with actionable feedback organized by category.
Review Areas
| Area | Focus | Reference |
|---|---|---|
| Code Quality | Abstractions, patterns, complexity | review-checklist.md |
| API Design | New patterns, flag-based access, broader implications | review-checklist.md |
| Testing | Coverage, patterns, edge cases | review-checklist.md |
| Security | Injection, credentials, input handling | review-checklist.md |
| Performance | Regressions, device handling, memory | review-checklist.md |
| Thread Safety | Data races, GIL assumptions, NoGIL, CPython C API | review-checklist.md |
| BC | Breaking changes, deprecation | bc-guidelines.md |
Output Format
Structure your review as follows:
## PR Review: #<number>
<!-- Or for local branch reviews: -->
## Branch Review: <branch-name> (vs main)
### Summary
Brief overall assessment of the changes (1-2 sentences).
### Code Quality
[Issues and suggestions, or "No concerns" if none]
### API Design
[Flag new patterns, internal-access flags, or broader implications if any. Otherwise omit this section.]
### Testing
- [ ] Tests exist for new functionality
- [ ] Edge cases covered
- [ ] Tests follow PyTorch patterns (TestCase, assertEqual)
[Additional testing feedback]
### Security
[Issues if any, or "No security concerns identified"]
### Thread Safety
[Threading concerns if any, or "No thread safety concerns"]
### Backward Compatibility
[BC concerns if any, or "No BC-breaking changes"]
### Performance
[Performance concerns if any, or "No performance concerns"]
### Recommendation
**Approve** / **Request Changes** / **Needs Discussion**
[Brief justification for recommendation]
Specific Comments (Detailed Review Only)
Only include this section if the user requests a "detailed" or "in depth" review.
Do not repeat observations already made in other sections. This section is for additional file-specific feedback that doesn't fit into the categorized sections above.
When requested, add file-specific feedback with line references:
### Specific Comments
- `src/module.py:42` - Consider extracting this logic into a named function for clarity
- `test/test_feature.py:100-105` - Missing test for error case when input is None
- `torch/nn/modules/linear.py:78` - This allocation could be moved outside the loop
Key Principles
- No repetition - Each observation appears in exactly one section. Never repeat the same issue, concern, or suggestion across multiple sections. If an issue spans categories (e.g., a security issue that also affects performance), place it in the most relevant section only.
- Focus on what CI cannot check - Don't comment on formatting, linting, or type errors
- Be specific - Reference file paths and line numbers
- Be actionable - Provide concrete suggestions, not vague concerns
- Be proportionate - Minor issues shouldn't block, but note them
- Assume competence - The author knows PyTorch; explain only non-obvious context
Files to Reference
When reviewing, consult these project files for context:
CLAUDE.md- Coding style philosophy and testing patternsCONTRIBUTING.md- PR requirements and review processtorch/testing/_internal/common_utils.py- Test patterns and utilitiestorch/testing/_internal/opinfo/core.py- OpInfo test framework
More by pytorch
View all →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
rust-coding-skill
UtakataKyosui
Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.