Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add litestar-org/litestar-skills --skill msgspecgit clone --depth 1 https://github.com/litestar-org/litestar-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/litestar-org/litestar-skills/msgspec)<a href="https://agentmods.dev/skills/litestar-org/litestar-skills/msgspec"><img src="https://agentmods.dev/badge/skills/litestar-org/litestar-skills/msgspec.svg" alt="Measured on agentmods" height="20"></a>- NVIDIA SkillSpector pass
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00055 | $0.04087 |
| Opus 5 | $0.00028 | $0.02044 |
| Sonnet 5 | $0.00011 | $0.00817 |
| Haiku 4.5 | $0.00006 | $0.00409 |
Grade A, and why
msgspec scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 485 lines — stays where its author put it; the contents beside it link to each section on GitHub.
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(notOptional[T]) from __future__ import annotationsrule — Library/shared modules that define runtime-introspectedmsgspec.Structsubclasses 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=Truefor Structs with more than 2 fields - Put wire-name configuration on
msgspec.field(name=...)or the Struct'srename=option;msgspec.Metadefines constraints and JSON Schema metadata, not field aliases
Quick Reference
Struct Definition
import msgspec
# Basic struct
class User(msgspec.Struct):
id: int
name: str
email: str | None = None
# Performance options
class Event(msgspec.Struct, frozen=True, gc=False):
"""frozen=True: immutable + hashable. gc=False: skip GC for short-lived objects."""
event_type: str
payload: dict[str, object]
# Keyword-only (recommended for >2 fields)
class Config(msgspec.Struct, kw_only=True):
host: str
port: int = 5432
ssl: bool = False
# Array-like encoding (tuple encoding, more compact)
class Point(msgspec.Struct, array_like=True):
x: float
y: float
# Rename fields for serialization
class ApiResponse(msgspec.Struct, rename="camel"):
user_id: int # serialized as "userId"
created_at: str # serialized as "createdAt"
# Rename one field explicitly
class Resource(msgspec.Struct):
resource_id: int = msgspec.field(name="id")
# Reject unknown fields at API boundaries
class StrictInput(msgspec.Struct, forbid_unknown_fields=True):
name: str
value: int
Validation Constraints
from datetime import datetime
from typing import Annotated
import msgspec
from msgspec import Meta
class Product(msgspec.Struct):
name: Annotated[str, Meta(min_length=1, max_length=100)]
price: Annotated[float, Meta(gt=0)]
quantity: Annotated[int, Meta(ge=0, le=10_000)]
sku: Annotated[str, Meta(pattern=r"^[A-Z]{2}-\d{4}$")]
batch_size: Annotated[int, Meta(multiple_of=5)]
expires_at: Annotated[datetime, Meta(tz=True)]
# Reusable constraint aliases
PositiveInt = Annotated[int, Meta(gt=0)]
NonEmptyStr = Annotated[str, Meta(min_length=1)]
Percentage = Annotated[float, Meta(ge=0.0, le=100.0)]
class Order(msgspec.Struct):
id: PositiveInt
label: NonEmptyStr
discount: Percentage = 0.0
What ships with it
3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 485 lines · 55 tokens per session scan A 9d7dba1770df
msgspec is a skill published in the GitHub repository litestar-org/litestar-skills (14 stars, last pushed 18d ago), licensed MIT. It adds 55 tokens to every session and 4,087 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
python-backend-expert
This skill should be used when the user is writing, reviewing, debugging, or architecting Python backend code using Litestar or FastAPI with SQLAlchemy or Advanced Alchemy. Provides expert critique covering SOLID principles, hexagonal architecture, repository/service patterns, dependency injection, async correctness…
milp-modeling-gurobi
When the user wants to build, solve, and debug mixed-integer linear programs in Python with Gurobi — creating variables, writing constraint-builder functions, setting objectives and parameters, handling solver status, and extracting solutions safely. Also use when the user mentions "gurobipy," "build a MIP model,"…
python-programmer
Python-specific idioms, philosophy, and expert-level patterns. Use when working with Python code, including Jupyter notebooks (.ipynb). Covers Pythonic thinking, common pitfalls from other language backgrounds, testing ecosystem navigation, type hints trade-offs, and when to use modern Python features.
numpy-vectorization-for-optimization
When the user wants to remove slow Python loops from metaheuristic or optimization code using NumPy — population-level operations, batch fitness evaluation, distance matrices, broadcasting, argsort/argpartition idioms, defaultrng, and memory layout. Also use when the user mentions "vectorize," "numpy broadcasting,"…
yoink
Curate tests then decompose dependencies.
clean-code
Write clean Python functions with type hints and no docstrings.