mds-statum-patterns

Implement Rust typestate patterns for compile-time enforcement of legal state transitions.

Updated Jan 6, 2026
One-click install
npx skills add https://github.com/eboody/eran.codes --skill mds-statum-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mds-statum-patterns
Source: https://github.com/eboody/eran.codes/tree/main/.codex/skills/mds-statum-patterns
Command: npx skills add https://github.com/eboody/eran.codes --skill mds-statum-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides guidance for implementing stable, phase-based workflows and API protocols in Rust, ensuring that invalid transitions are unrepresentable at compile time and improving overall code correctness and maintainability.

Core Features & Use Cases

  • Typestate Patterns: Enforces workflow phases and legal transitions using Rust's type system.
  • API Protocol Design: Guides the creation of robust API protocols with clear state management.
  • Rehydration: Supports reconstructing typed machines from persisted data using validators.
  • Use Case: When building a document review system with distinct phases like 'Draft', 'InReview', and 'Published', this Skill helps ensure that a document cannot be 'Published' directly from 'Draft' without going through the 'InReview' phase.

Quick Start

Apply the mds-statum-patterns skill to define a new Rust workflow with stable ordered phases.

Frequently Asked Questions about mds-statum-patterns

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

FAQPage Schema
How do I enforce state transitions in Rust at compile time?

You can enforce state transitions in Rust at compile time by applying typestate patterns to model workflow phases as distinct types, making invalid transitions unrepresentable. This ensures phase-based workflows and API protocols remain correct and maintainable.

What is the best way to design API protocols with state management in Rust?

Designing API protocols with state management in Rust benefits from typestate patterns, which guide the creation of robust protocols by encoding legal state transitions directly into the type system for improved correctness and readability.

How do I rehydrate state machines from persisted data in Rust?

Rehydrating state machines from persisted data in Rust involves using validators to reconstruct typed machines, ensuring that the loaded data conforms to the expected state and lifecycle legality before application use.

Can I use typestate patterns for complex stateful systems in Rust?

Typestate patterns are suitable for complex stateful systems in Rust, providing compile-time enforcement of lifecycle legality and extensibility for workflows requiring strict phase ordering and correctness.

How do I prevent invalid workflow transitions in a Rust application?

Preventing invalid workflow transitions in a Rust application requires typestate patterns to enforce ordered phases, ensuring that states like 'Published' cannot be reached directly from 'Draft' without passing through intermediate phases like 'InReview'.

When do I need typestate patterns in Rust?

You need typestate patterns in Rust when building phase-based workflows or API protocols that require compile-time enforcement of state transitions, preventing invalid lifecycle states and improving code maintainability.