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".
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.
This section applies when Claude is running inside the GitHub Actions workflow (claude-code.yml).
| 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.
| 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 |
git commit, git push, or create branches.pip install, npm install, apt-get, etc..github/workflows/ files in automated comments.lintrunner -m main or lintrunner --all-files are available.make html-noplot works for RST/Sphinx validation (no GPU).| 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 |
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.
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)
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:
# 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
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:
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.
For local mode, use gh commands to get:
Read through the diff systematically:
Perform thorough analysis using the review checklist. See review-checklist.md for detailed criteria covering:
Structure your review with actionable feedback organized by category.
| Area | Focus | Reference |
|---|---|---|
| Content Quality | Accuracy, clarity, learning objectives | review-checklist.md |
| Code Correctness | Working examples, imports, API usage | review-checklist.md |
| Structure | File placement, index entries, toctree | review-checklist.md |
| Formatting | RST/Sphinx syntax, Sphinx Gallery conventions | review-checklist.md |
| Build | Dependencies, data downloads, CI compat | review-checklist.md |
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]
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
When reviewing, consult these project files for context:
CLAUDE.md - Project structure and coding styleCONTRIBUTING.md - Submission process, tutorial types, and authoring guidanceconf.py - Sphinx Gallery configuration and extensionsrequirements.txt - Approved dependenciesindex.rst - Card listings and toctree structure