con un clic
pr-review
// Review TorchRec pull requests and diffs for distributed correctness, sharding safety, backward compatibility, and test coverage. Use when reviewing PRs, diffs, or when asked to review code changes.
// Review TorchRec pull requests and diffs for distributed correctness, sharding safety, backward compatibility, and test coverage. Use when reviewing PRs, diffs, or when asked to review code changes.
Generate tests for TorchRec source files with correct patterns (unit, distributed, hypothesis), proper BUCK targets, and test utilities. Use when asked to generate tests, add test coverage, or write tests for a module.
Investigate and explain TorchRec planner sharding statistics output, especially how HBM storage is computed per table and per rank. Use when the user asks about sharding stats, storage breakdown, or memory estimation.
Write docstrings for TorchRec functions and methods following PyTorch conventions. Use when writing or updating docstrings in TorchRec code.
Guide users through creating Agent Skills for Claude Code. Use when the user wants to create, write, author, or design a new Skill for TorchRec, or needs help with SKILL.md files.
Interview user in-depth to create a detailed spec with strict implementation details and tradeoff analysis
Find and remove tech debt (redundant/duplicated code), run linters, and ensure code quality in recent changes
| name | pr-review |
| description | Review TorchRec pull requests and diffs for distributed correctness, sharding safety, backward compatibility, and test coverage. Use when reviewing PRs, diffs, or when asked to review code changes. |
| allowed-tools | mcp__plugin_meta_mux__get_phabricator_diff_details, Bash(sl:*), Read, Grep, Glob, Task |
Review TorchRec code changes focusing on what CI and linters cannot check: distributed correctness, sharding safety, backward compatibility, OSS boundary violations, and test adequacy. Linting, formatting, type checking, and import ordering are handled by CI.
If the user invokes /pr-review with no arguments, use sl status and sl diff (or sl show .) to review uncommitted changes or the current commit.
The user provides a Phabricator diff ID:
/pr-review D12345678
/pr-review D12345678 detailed
Use mcp__plugin_meta_mux__get_phabricator_diff_details with include_raw_diff: true and include_diff_summary: true to fetch the diff.
Review uncommitted changes or the current commit:
/pr-review local
/pr-review local detailed
sl status to check for uncommitted changessl diff for uncommitted changes, or sl show . for the current commitsl diff --stat first, then Read to examine specific filesGroup changes by type:
Perform thorough analysis using the review checklist. See review-checklist.md for detailed criteria covering:
Evaluate BC implications for any change touching public APIs. See bc-guidelines.md for:
fb/)For non-trivial changes, use Read to examine:
Structure your review with actionable feedback organized by category.
| Area | Focus | Reference |
|---|---|---|
| Distributed Safety | Collectives, sharding, rank consistency, deadlocks | review-checklist.md |
| FBGEMM Integration | Kernel usage, op loading, config correctness | review-checklist.md |
| Code Quality | Patterns, abstractions, type hints | review-checklist.md |
| Testing | Coverage, distributed test patterns, edge cases | review-checklist.md |
| Performance | Memory, GPU utilization, pipeline efficiency | review-checklist.md |
| Backward Compatibility | Public API changes, deprecation | bc-guidelines.md |
| OSS Boundary | Public/internal separation | review-checklist.md |
Structure your review as follows:
## Review: D<number> / Local Changes
### Summary
Brief overall assessment of the changes (1-2 sentences).
### Distributed Safety
[Issues with collectives, sharding, rank consistency. Or "No concerns" if none]
### Code Quality
[Issues and suggestions, or "No concerns" if none]
### Testing
- [ ] Tests exist for new functionality
- [ ] Distributed tests use MultiProcessTestBase
- [ ] Edge cases covered (empty KJT, single rank, etc.)
[Additional testing feedback]
### Backward Compatibility
[BC concerns if any, or "No BC-breaking changes"]
### Performance
[Performance concerns if any, or "No performance concerns"]
### OSS Boundary
[Boundary violations if any, or "No boundary issues"]
### Recommendation
**Approve** / **Request Changes** / **Needs Discussion**
[Brief justification for recommendation]
Only include this section if the user requests a "detailed" review.
Do not repeat observations already made in other sections. This section is for additional file-specific feedback.
When requested, add file-specific feedback with line references:
### Specific Comments
- `torchrec/distributed/sharding/rw_sharding.py:142` - This allreduce should use async_op=True to overlap with compute
- `torchrec/sparse/jagged_tensor.py:305-310` - Missing validation for empty lengths tensor
- `torchrec/distributed/tests/test_model_parallel.py:88` - Test only covers world_size=2, add world_size=4 case
When reviewing TorchRec code, consult:
torchrec/CLAUDE.md - Coding style and testing patternstorchrec/distributed/test_utils/ - Test utilities and patternstorchrec/modules/ - Core module implementationstorchrec/distributed/planner/ - Sharding planner reference$ARGUMENTS