msgspec

Installation
SKILL.md

msgspec Skill

msgspec is a high-performance Python library for serialization, deserialization, and typed validation. This guidance targets the immutable 0.21.1 release.

Code Style Rules

  • Use PEP 604 for unions: T | None (not Optional[T])
  • from __future__ import annotations rule — Library/shared modules that define runtime-introspected msgspec.Struct subclasses should avoid postponed annotations unless the consuming tool resolves them. Consumer modules that only use Structs MAY use future annotations.
  • Annotate every serialized field; only annotated attributes become Struct fields
  • Use kw_only=True for Structs with more than 2 fields
  • Put wire-name configuration on msgspec.field(name=...) or the Struct's rename= option; msgspec.Meta defines constraints and JSON Schema metadata, not field aliases

Quick Reference

Struct Definition

Installs
8
GitHub Stars
13
First Seen
May 29, 2026
msgspec — litestar-org/litestar-skills