mbtorch-tdd

Enforce test-driven development for MoonBit/MbTorch code changes.

1|Updated Mar 7, 2026
One-click install
npx skills add https://github.com/c-tomioka/mbtorch --skill mbtorch-tdd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mbtorch-tdd
Source: https://github.com/c-tomioka/mbtorch/tree/main/.claude/skills/mbtorch-tdd
Command: npx skills add https://github.com/c-tomioka/mbtorch --skill mbtorch-tdd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

MbTorch code changes often touch numerical kernels, autograd, and IO paths where regressions or unclear API contracts can silently break models; this Skill provides a structured TDD approach to make changes explicit, reproducible, and safe.

Core Features & Use Cases

  • Guided TDD Workflow: Red, Green, Refactor cycle applied to new features, bug fixes, and refactors with clear stop conditions.
  • Module-specific rules: Mandatory numerical accuracy and gradient checks for core/autograd, forward-shape and training integration tests for nn, optimizer convergence tests for optim, and round-trip comparison tests for io formats (ONNX, safetensors, .mbt).
  • Test hygiene & conventions: Naming, granularity, reproducible deterministic inputs, epsilon-based float comparisons, and slow-test marking to keep test suites maintainable.
  • Anti-pattern detection: Explicit guidance to avoid testless changes, oversized tests, and implementation-dependent assertions.

Quick Start

Write a failing test that reproduces the desired behavior or bug, implement the minimal change to make the test pass, and then refactor while keeping all tests green.

Frequently Asked Questions about mbtorch-tdd

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

FAQPage Schema
How do I enforce test-driven development for MbTorch autograd changes?

To enforce test-driven development for MbTorch autograd changes, you must write a failing test first and provide numerical gradient checks using deterministic small inputs to verify numerical accuracy before implementation.

What tests are required for MbTorch IO serialization formats?

MbTorch IO serialization formats require round-trip comparison tests to verify compatibility. You must write failing tests first to ensure data consistency across formats like ONNX, safetensors, and .mbt files.

How do I write unit tests for MoonBit MbTorch neural network modules?

Unit tests for MbTorch neural network modules require forward-shape verification and training integration tests. You must follow the Red, Green, Refactor cycle, writing a failing test before implementing the minimal change.

Does MbTorch test-driven development require deterministic inputs for reproducibility?

Yes, MbTorch test-driven development requires deterministic small inputs for reproducibility. Test hygiene conventions mandate epsilon-based float comparisons and slow-test marking to keep test suites maintainable.

What is the best way to prevent regressions when refactoring MbTorch core layers?

The best way to prevent regressions when refactoring MbTorch core layers is applying a structured TDD workflow. Write failing tests reproducing desired behavior, implement minimal changes, and refactor while keeping all tests green.