m05-type-driven

Community

Enforce invariants with type-safe design.

Authorsimorgh3196
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill helps developers prevent invalid runtime states by encoding invariants in the Rust type system, enabling compile-time guarantees that certain states can only exist when preconditions are met.

Core Features & Use Cases

  • Type State: model distinct states with separate types to ensure valid transitions at compile time.
  • Newtype: wrap primitive values to enforce domain semantics and invariants.
  • PhantomData: use phantom type parameters to encode additional constraints without runtime cost.
  • Marker Traits: express capabilities and allowed operations through trait bounds.
  • Builder Pattern: progressively construct complex objects with type-safe steps.
  • Sealed Trait / ZST: limit external implementations and leverage zero-sized markers for safety and API clarity.

Quick Start

Create a small Rust module that defines a newtype around a primitive (e.g., UserId), implements a simple Type State flow (e.g., Unregistered -> Registered), and experiments with PhantomData and marker traits to encode invariants. Then wire a minimal builder to demonstrate gradual construction.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: m05-type-driven
Download link: https://github.com/simorgh3196/tsuzulint/archive/main.zip#m05-type-driven

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.