ml-test-driven-development

Detect wiring and integration bugs in PyTorch model implementations before training runs.

Updated Feb 23, 2026
One-click install
npx skills add https://github.com/rishikanthc/ml-superpowers --skill ml-test-driven-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ml-test-driven-development
Source: https://github.com/rishikanthc/ml-superpowers/tree/main/skills/ml-test-driven-development
Command: npx skills add https://github.com/rishikanthc/ml-superpowers --skill ml-test-driven-development

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents long, costly training runs caused by wiring bugs, detached gradients, or misconfigured loss/optimizer setups by providing a short, focused test sequence that validates model integration before any full training run.

Core Features & Use Cases

  • Shape Gauntlet: Run a synthetic batch through the full forward pass to verify tensor shapes at module boundaries and catch dimension/broadcasting errors.
  • Gradient Smoke Test: Ensure all model parameters receive non-zero gradients to detect detached tensors, frozen layers, or broken loss hookups.
  • Overfit-One-Batch: Verify the model can memorize a single batch on a small config to confirm loss, label alignment, and optimizer steps are wired correctly.
  • Use Cases: Implementing a new model architecture, integrating custom loss functions or attention layers, porting models between frameworks, and validating data pipeline labels.

Quick Start

Run the three checkpoints—shape gauntlet, gradient smoke test, and overfit-one-batch—on a dummy batch before starting any full training run.

Frequently Asked Questions about ml-test-driven-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify PyTorch model shapes and gradients before training?

You can validate PyTorch model integration by running a synthetic batch through the forward pass to check tensor shapes at module boundaries and ensure all parameters receive non-zero gradients to catch detached tensors or broken loss hookups.

What is the overfit-one-batch test in machine learning?

The overfit-one-batch test verifies that a model can memorize a single batch on a small configuration. It confirms that the loss function, label alignment, and optimizer steps are wired correctly before committing to a full training run.

How do I test my custom loss function and training loop in PyTorch?

To test custom loss functions and training loops, run focused checkpoints like a gradient smoke test on a dummy batch. This validates that gradients flow correctly and the loss hookups are properly configured within short CPU runtimes.

Why does my PyTorch model have zero gradients during the training loop?

Zero gradients often indicate detached tensors, frozen layers, or broken loss hookups. Running a gradient smoke test on a dummy batch detects these wiring bugs early by verifying all model parameters receive non-zero gradients before long training runs.

Can I use test-driven development to catch ML training failures on CPU?

Yes, these test-driven development checks validate model integration within short CPU runtimes. By running a shape gauntlet, gradient smoke test, and overfit-one-batch sequence, you detect wiring and integration bugs before starting costly full training runs.