Skip to main content
skill

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.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --skill scientific/pytorch-lightning
Open on GitHub

What 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.py into 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-lightning

2Skills CLI (Vercel)

npx skills add davila7/claude-code-templates --skill pytorch-lightning -a claude-code

3Manually: put the files in place

~/.claude/skills/pytorch-lightning/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pytorch-lightning/

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.

From the same set804

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor