msgspec

Installation
SKILL.md

msgspec Skill

msgspec is a high-performance Python library for serialization, deserialization, and validation. Structs are ~5x more memory-efficient than regular classes and serialize faster than Pydantic or dataclasses.

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.
  • Always annotate all fields; msgspec requires type annotations
  • Use kw_only=True for Structs with more than 2 fields

Quick Reference

Struct Definition

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