| name | pr-review |
| description | Review PyTorch tutorials pull requests for content quality, code correctness, build compatibility, and style. Use when reviewing PRs, when asked to review code changes, or when the user mentions "review PR", "code review", or "check this PR". |
Tutorials PR Review Skill
Review PyTorch tutorials pull requests for content quality, code correctness, tutorial structure, and Sphinx/RST formatting. CI lintrunner only checks trailing whitespace, tabs, and newlines โ it does not validate RST syntax, Python formatting, or Sphinx directives, so those must be reviewed manually.
CI Environment (GitHub Actions)
This section applies when Claude is running inside the GitHub Actions workflow (claude-code.yml).
Pre-installed Tools
| Detail | Value |
|---|
| Runner | ubuntu-latest |
| Python | 3.12 (pre-installed via actions/setup-python) |
| Lintrunner | 0.12.5 (pre-installed and initialized) |
| Timeout | 60 minutes |
| Model | claude-opus-4-6-v1 via AWS Bedrock |
All tools you need are already installed. Do not run pip install, apt-get, or any other installation commands. If a tool is missing, state that it is unavailable and move on.
Permissions
| Permission | Level | What it allows |
|---|
contents | read | Read repo files, checkout code |
pull-requests | write | Comment on PRs, post reviews |
id-token | write | OIDC authentication to AWS Bedrock |
What You MUST NOT Do
- Commit or push โ You have read-only access to repo contents. Never attempt
git commit, git push, or create branches.
- Merge or close PRs โ You cannot and should not merge pull requests.
- Install packages โ Everything needed is pre-installed. Do not run
pip install, npm install, apt-get, etc.
- Modify workflow files โ Do not suggest changes to
.github/workflows/ files in automated comments.
- Create issues โ Do not open new GitHub issues.
- Assign users โ Do not assign issues or PRs to specific people.
What You CAN Do
- Read all repo files โ Full checkout is available at the workspace root.
- Run lintrunner โ
lintrunner -m main or lintrunner --all-files are available.
- Run make (dry/noplot) โ
make html-noplot works for RST/Sphinx validation (no GPU).
- Comment on PRs โ Post review comments, inline suggestions, and general comments.
MCP Tools
| Tool | Purpose |
|---|
mcp__github__pr_read | Read PR details, diff, and review comments |
mcp__github__pr_comment | Post a comment or review on a PR |
Trigger & Interaction
Claude is invoked when a user mentions @claude in a PR comment or PR review comment. The triggering comment is passed as the prompt. Respond directly to what the user asked โ do not perform unrequested actions.
- You are responding asynchronously via GitHub comments. There is no interactive terminal session.
- Be concise โ GitHub comments should be scannable, not walls of text.
- Use markdown formatting (headers, tables, code blocks) for readability.
- If you cannot complete a request due to permission constraints, explain what you tried and what the user should do instead.
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/tutorials/pull/12345
For a detailed review with line-by-line specific comments:
/pr-review 12345 detailed
Use gh CLI to fetch PR data:
gh pr view <PR_NUMBER> --json title,body,author,baseRefName,headRefName,files,additions,deletions,commits
gh pr diff <PR_NUMBER>
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:
git branch --show-current
git diff --name-only main...HEAD
git diff main...HEAD
git log main..HEAD --oneline
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. See the CI Environment section above for constraints and available tools.
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
Step 2: Analyze Changes
Read through the diff systematically:
- Identify the purpose of the change from title/description
- Group changes by type (tutorial content, config, build, infra)
- Note the scope of changes (files affected, lines changed)
Step 3: Deep Review
Perform thorough analysis using the review checklist. See review-checklist.md for detailed criteria covering:
- Tutorial content quality and accuracy
- Code correctness in tutorial examples
- Sphinx/RST formatting
- Build compatibility
- Project structure compliance
Step 4: Formulate Review
Structure your review with actionable feedback organized by category.
Review Areas
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).
### Content Quality
[Issues and suggestions, or "No concerns" if none]
### Code Correctness
[Issues with tutorial code examples, imports, API usage, or "No concerns"]
### Structure & Formatting
[File placement, RST/Sphinx issues, index/toctree entries, or "No concerns"]
### Build Compatibility
[Dependency issues, data download concerns, CI compatibility, or "No 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
- `beginner_source/my_tutorial.py:42` - Docstring prose is unclear; rephrase for non-native speakers
- `index.rst:150` - Missing customcarditem entry for the new tutorial
- `requirements.txt:30` - New dependency should be pinned to a specific version
Key Principles
- No repetition - Each observation appears in exactly one section
- Focus on what CI cannot check - Don't comment on trailing whitespace or tab characters (caught by lintrunner). RST syntax, Sphinx directives, and Python code style must still be reviewed
- 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
- Audience awareness - Tutorials are read by beginners; clarity matters more than brevity
Files to Reference
When reviewing, consult these project files for context:
CLAUDE.md - Project structure and coding style
CONTRIBUTING.md - Submission process, tutorial types, and authoring guidance
conf.py - Sphinx Gallery configuration and extensions
requirements.txt - Approved dependencies
index.rst - Card listings and toctree structure