cli-tool/components/skills/scientific/pytorch-lightning/SKILL.md
Deep learning framework (PyTorch Lightning). Organize PyTorch code into LightningModules, configure Trainers for multi-GPU/TPU, implement data pipelines, callbacks, logging (W&B, TensorBoard), distributed training (DDP, FSDP, DeepSpeed), for scalable neural network training.
npx skillsauth add davila7/claude-code-templates pytorch-lightningInstall 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.
PyTorch Lightning is a deep learning framework that organizes PyTorch code to eliminate boilerplate while maintaining full flexibility. Automate training workflows, multi-device orchestration, and implement best practices for neural network training and scaling across multiple GPUs/TPUs.
This skill should be used when:
Organize PyTorch models into six logical sections:
__init__() and setup()training_step(batch, batch_idx)validation_step(batch, batch_idx)test_step(batch, batch_idx)predict_step(batch, batch_idx)configure_optimizers()Quick template reference: See scripts/template_lightning_module.py for a complete boilerplate.
Detailed documentation: Read references/lightning_module.md for comprehensive method documentation, hooks, properties, and best practices.
The Trainer automates the training loop, device management, gradient operations, and callbacks. Key features:
Quick setup reference: See scripts/quick_trainer_setup.py for common Trainer configurations.
Detailed documentation: Read references/trainer.md for all parameters, methods, and configuration options.
Encapsulate all data processing steps in a reusable class:
prepare_data() - Download and process data (single-process)setup() - Create datasets and apply transforms (per-GPU)train_dataloader() - Return training DataLoaderval_dataloader() - Return validation DataLoadertest_dataloader() - Return test DataLoaderQuick template reference: See scripts/template_datamodule.py for a complete boilerplate.
Detailed documentation: Read references/data_module.md for method details and usage patterns.
Add custom functionality at specific training hooks without modifying your LightningModule. Built-in callbacks include:
Detailed documentation: Read references/callbacks.md for built-in callbacks and custom callback creation.
Integrate with multiple logging platforms:
Log metrics using self.log("metric_name", value) in any LightningModule method.
Detailed documentation: Read references/logging.md for logger setup and configuration.
Choose the right strategy based on model size:
Configure with: Trainer(strategy="ddp", accelerator="gpu", devices=4)
Detailed documentation: Read references/distributed_training.md for strategy comparison and configuration.
self.device instead of .cuda()self.save_hyperparameters() in __init__()self.log() for automatic aggregation across devicesseed_everything() and Trainer(deterministic=True)Trainer(fast_dev_run=True) to test with 1 batchDetailed documentation: Read references/best_practices.md for common patterns and pitfalls.
Define model:
class MyModel(L.LightningModule):
def __init__(self):
super().__init__()
self.save_hyperparameters()
self.model = YourNetwork()
def training_step(self, batch, batch_idx):
x, y = batch
loss = F.cross_entropy(self.model(x), y)
self.log("train_loss", loss)
return loss
def configure_optimizers(self):
return torch.optim.Adam(self.parameters())
Prepare data:
# Option 1: Direct DataLoaders
train_loader = DataLoader(train_dataset, batch_size=32)
# Option 2: LightningDataModule (recommended for reusability)
dm = MyDataModule(batch_size=32)
Train:
trainer = L.Trainer(max_epochs=10, accelerator="gpu", devices=2)
trainer.fit(model, train_loader) # or trainer.fit(model, datamodule=dm)
Executable Python templates for common PyTorch Lightning patterns:
template_lightning_module.py - Complete LightningModule boilerplatetemplate_datamodule.py - Complete LightningDataModule boilerplatequick_trainer_setup.py - Common Trainer configuration examplesDetailed documentation for each PyTorch Lightning component:
lightning_module.md - Comprehensive LightningModule guide (methods, hooks, properties)trainer.md - Trainer configuration and parametersdata_module.md - LightningDataModule patterns and methodscallbacks.md - Built-in and custom callbackslogging.md - Logger integrations and usagedistributed_training.md - DDP, FSDP, DeepSpeed comparison and setupbest_practices.md - Common patterns, tips, and pitfallstools
No-code automation democratizes workflow building. Zapier and Make (formerly Integromat) let non-developers automate business processes without writing code. But no-code doesn't mean no-complexity - these platforms have their own patterns, pitfalls, and breaking points. This skill covers when to use which platform, how to build reliable automations, and when to graduate to code-based solutions. Key insight: Zapier optimizes for simplicity and integrations (7000+ apps), Make optimizes for power
tools
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
tools
Workflow automation is the infrastructure that makes AI agents reliable. Without durable execution, a network hiccup during a 10-step payment flow means lost money and angry customers. With it, workflows resume exactly where they left off. This skill covers the platforms (n8n, Temporal, Inngest) and patterns (sequential, parallel, orchestrator-worker) that turn brittle scripts into production-grade automation. Key insight: The platforms make different tradeoffs. n8n optimizes for accessibility
development
Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.