pytorch-lightning · davila7 — Claude Code skill: what it does, how to install
Helps Claude Code structure PyTorch code into LightningModules and configure multi-GPU or TPU training. It removes boilerplate loops and organizes data pipelines.
npx claude-code-templates@latest --skill scientific/pytorch-lightningWhat pytorch-lightning does
This skill guides Claude Code in refactoring raw PyTorch code into structured Lightning projects. Model logic resides inside LightningModule, while dataset preparation lives in LightningDataModule. The skill provides starter scripts like template_lightning_module.py and template_datamodule.py.
For model execution, the skill guides Trainer configuration. It sets up mixed precision and gradient clipping. Metric tracking connects directly to WandbLogger or TensorBoard. Built-in hooks include EarlyStopping and ModelCheckpoint. Running fast_dev_run=True tests pipeline integrity on a single batch.
Device distribution rules depend on weight count: DDP handles networks below 500M parameters, while FSDP or DeepSpeed fit larger models. The resulting code will fail without torch and lightning installed in your environment.
What it helps with
- convert raw PyTorch training scripts into a modular
LightningModule - isolate dataset preparation and data loaders inside a
LightningDataModule - configure multi-GPU training with DDP, FSDP, or DeepSpeed
- add automated checkpointing and early stopping callbacks
Example prompts for the agent
- Convert the PyTorch network in
model.pyinto a LightningModule with Adam optimizer - Write a LightningDataModule that loads training and validation datasets with batch size 32
- Configure a Trainer for 4 GPUs using FSDP distributed strategy
How to install pytorch-lightning
1claude-code-templates
npx claude-code-templates@latest --skill scientific/pytorch-lightning2Skills CLI (Vercel)
npx skills add davila7/claude-code-templates --skill pytorch-lightning -a claude-code3Manually: put the files in place
~/.claude/skills/pytorch-lightning/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pytorch-lightning/
Manually: put the files in place
.agents/skills/pytorch-lightning/SKILL.mdFor all projects use ~/.agents/skills/
Manually: put the files in place
.cursor/skills/pytorch-lightning/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install davila7/claude-code-templates pytorch-lightning2Manually: put the files in place
.github/skills/pytorch-lightning/SKILL.mdPlatform CLI
gemini skills install https://github.com/davila7/claude-code-templates --path cli-tool/components/skills/scientific/pytorch-lightningManually: put the files in place
.devin/skills/pytorch-lightning/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about pytorch-lightning
How to install pytorch-lightning in Claude Code?
Run npx claude-code-templates@latest --skill scientific/pytorch-lightning. Alternatively, install it with npx skills add davila7/claude-code-templates --skill pytorch-lightning -a claude-code.
What does the pytorch-lightning skill do?
It provides templates and guidelines for Claude Code to structure deep learning projects. The agent learns how to separate model steps, build data pipelines, and manage training routines.
Which distributed strategy does the skill recommend for training?
The documentation recommends DDP for models with fewer than 500M parameters. For architectures with 500M or more parameters, it directs users toward FSDP or DeepSpeed.
Similar skills
All skills for AI and ML →pytorch-lightning by other authors comes first.