torchrec/.claude/skills/skill-writer/SKILL.md
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.
npx skillsauth add meta-pytorch/torchrec skill-writerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This Skill helps you create well-structured Agent Skills for Claude Code specifically for the TorchRec project.
Use this Skill when:
First, understand what the Skill should do:
Ask clarifying questions:
Keep it focused: One Skill = one capability
TorchRec Skills should be placed in:
fbcode/torchrec/.claude/skills/<skill-name>/SKILL.md
Create the directory and files:
mkdir -p fbcode/torchrec/.claude/skills/skill-name
For multi-file Skills:
skill-name/
├── SKILL.md (required)
├── reference.md (optional)
├── examples.md (optional)
└── templates/ (optional)
Create YAML frontmatter with required fields:
---
name: skill-name
description: Brief description of what this does and when to use it
---
Field requirements:
name:
sharding-optimizer, kjt-validatorSharding_Optimizer, KJT Validator!description:
Optional frontmatter fields:
allowed-tools: Restrict tool access (comma-separated list)
allowed-tools: Read, Grep, Glob
argument-hint: Hint for expected arguments
argument-hint: [feature or task description]
The description is critical for Claude to discover your Skill.
Formula: [What it does] + [When to use it] + [TorchRec keywords]
Examples:
✅ Good:
description: Optimize sharding plans for TorchRec embedding tables. Use when configuring DistributedModelParallel, analyzing sharding strategies, or tuning embedding performance.
✅ Good:
description: Validate KeyedJaggedTensor (KJT) configurations and debug sparse tensor issues. Use when working with KJT, debugging embedding lookups, or validating feature configurations.
❌ Too vague:
description: Helps with TorchRec
description: For distributed training
Use clear Markdown sections:
# Skill Name
Brief overview of what this Skill does for TorchRec.
## Quick start
Provide a simple example to get started immediately.
## Instructions
Step-by-step guidance for Claude:
1. First step with clear action
2. Second step with expected outcome
3. Handle edge cases
## TorchRec-Specific Patterns
Document TorchRec-specific patterns and conventions.
## Examples
Show concrete usage examples with TorchRec code.
## Best practices
- Key conventions to follow
- Common pitfalls to avoid
- When to use vs. not use
## Files to Reference
List important TorchRec files for context:
- `torchrec/distributed/` - Distributed training code
- `torchrec/modules/` - Core modules
Check these requirements:
✅ File structure:
name✅ YAML frontmatter:
--- on line 1--- before contentname follows naming rulesdescription is specific and < 1024 chars✅ Content quality:
Here are some useful Skills to consider creating:
| Skill Name | Purpose |
|------------|---------|
| sharding-optimizer | Analyze and optimize embedding sharding plans |
| kjt-validator | Validate KeyedJaggedTensor configurations |
| distributed-debug | Debug distributed training issues |
| embedding-benchmark | Benchmark embedding performance |
| migration-helper | Help migrate to newer TorchRec APIs |
---
name: sharding-analyzer
description: Analyze TorchRec sharding plans and suggest optimizations. Use when reviewing ShardingPlan, DistributedModelParallel configuration, or optimizing embedding distribution across devices.
---
# Sharding Analyzer
Analyze TorchRec sharding plans and suggest optimizations for embedding tables.
## Quick start
Run `/sharding-analyzer` on a file containing a ShardingPlan to get optimization suggestions.
## Instructions
1. Read the sharding plan configuration
2. Analyze table sizes and sharding strategies
3. Check for common anti-patterns:
- Large tables with TABLE_WISE sharding
- Small tables with ROW_WISE sharding
- Unbalanced memory distribution
4. Suggest optimizations
## TorchRec Sharding Strategies
| Strategy | Best For | Avoid When |
|----------|----------|------------|
| TABLE_WISE | Small tables, < 1M rows | Large tables |
| ROW_WISE | Large tables, uniform access | Small tables |
| COLUMN_WISE | Wide embeddings, > 256 dim | Narrow embeddings |
## Files to Reference
- `torchrec/distributed/planner/` - Sharding planner
- `torchrec/distributed/sharding/` - Sharding implementations
When creating a Skill, I will:
testing
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.
development
Find and remove tech debt (redundant/duplicated code), run linters, and ensure code quality in recent changes
testing
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.
development
# TorchRec Release Cut Instructions ## Step 1 — Switch to a Local Machine These instructions should be run from a **local machine** (e.g., MacBook Pro), not from a devgpu or dev-server, since you'll need direct access to GitHub for pushing branches and triggering workflows. ## Step 2 — Clone / Navigate to the Repo Navigate to the TorchRec repo at `~/local/torchrec`. If the directory doesn't exist, clone it first: ```bash git clone https://github.com/meta-pytorch/torchrec/ ~/local/torchrec c