--- name: serialize description: Use when implementing or debugging code that uses @suaveplan/serialize: Round-trip-preserving structured serialization — tagged JSON, MessagePack binary, streaming, eval-safe by default. --- # @suaveplan/serialize Round-trip-preserving structured serialization for JavaScript's rich type system. The standard `JSON.stringify`/`JSON.parse` pair silently drops `Date` objects, `Map`, `Set`, `BigInt`, `Uint8Array`, `URL`, `RegExp`, `undefined`, `NaN`, and `±Infinity`. This package preserves all of them via a tagged-JSON codec (`serialize`/`deserialize`) and an efficient MessagePack binary codec (`encodeBinary`/`decodeBinary`). It also provides 4-byte-framed streaming codecs for `ReadableStream` pipelines, cycle detection with path context, a pluggable type registry for custom classes, and an opt-in `/unsafe` subpath that handles `Function`-bearing payloads. The default entry point is eval-safe. Use `@suaveplan/serialize` whenever you need to serialise application state across process boundaries, persist structured data, or stream binary payloads — and want to get back exactly what you put in. ## When to use this skill - Implementing or debugging code that imports `@suaveplan/serialize`. - The task touches: see package README. - You need API guidance for this package's exports. ## Quick reference ```ts import { /* see API Reference below */ } from "@suaveplan/serialize"; ``` ## Dependencies Workspace dependencies: `@suaveplan/error`, `@suaveplan/types` ## Where to read more This skill is intentionally short. The package's own documentation is the authoritative source — read these in order: 1. **`packages/foundation/serialize/README.md`** — overview, install, quick-start, module index 2. **`packages/foundation/serialize/src/**/*.md`** — co-located docs per implementation file (Purpose, Features, Basic + Advanced examples, full API reference, Implementation notes — all packages ship ≥200 words per module) 3. **`packages/foundation/serialize/package.json`** `exports` map — every subpath you can import from When the user asks an API question, read the relevant co-located `.md` first; do not answer from training-data memory. ## See also - `@suaveplan/error` - `@suaveplan/types` --- _This SKILL.md is auto-generated by `suaveplan-skills/scripts/generate-skills.ts` from the package's README. Do not edit by hand — re-run the generator after the README changes._