guard-serialization

Enforces TOON and TOONL serialization defaults for structured data in JavaScript and TypeScript source.

20|2|Updated May 16, 2026
One-click install
npx skills add https://github.com/reddb-io/red-skills --skill guard-serialization-reddb-io
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: guard-serialization
Source: https://github.com/reddb-io/red-skills/tree/main/plugins/dev/skills/engineering/guard-serialization
Command: npx skills add https://github.com/reddb-io/red-skills --skill guard-serialization-reddb-io

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Structured data in a codebase can silently drift back to ad-hoc JSON writes on files and wire protocols, breaking format consistency and the migration ratchet. This Skill keeps every change to JavaScript or TypeScript source under apps or packages aligned with the TOON snapshot, TOONL stream, and TOON wire frame defaults. ## Core Features & Use Cases - TOON file discipline: Writes every *.toon file with the TOON encoder and reads it with the sniffing decoder, treating runtime JSON compatibility as a migration aid only. - Wire frame enforcement: Sends with encodeWireFrame and receives with decodeWireFrame from @reddb-io/shared/resident-wire.js, keeping owned wires on TOON frames while tolerating legacy JSON during rollouts. - JSON boundary classification: Records intentional JSON file or wire sites in .red/contracts/toon-json-file-io-allowlist.json as external or migrate, and prefers explicit --json output branches for caller-requested formats. - Use Case: When editing a TypeScript module that persists state or transports payloads, apply this Skill so the touched flow defaults to TOON, remaining JSON sites are classified, and toon-json-guard.test.ts passes. ## Quick Start Use the guard-serialization skill to review my changes to the TypeScript files under packages that read and write structured state, and make sure they default to TOON with any remaining JSON sites classified in the allowlist.

Frequently Asked Questions about guard-serialization

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

FAQPage Schema
How do I keep structured data on TOON instead of JSON in TypeScript?▼

Write every .toon file with the TOON encoder and read it with the sniffing decoder, and send wire payloads with encodeWireFrame from @reddb-io/shared/resident-wire.js. Runtime JSON compatibility exists only as a migration aid, not as permission to write JSON bytes under a TOON extension.

When should I use TOON versus TOONL for data serialization?▼

Use TOON for snapshots of structured state and TOONL for append-only streams. Prose content stays as prose; the serialization rules apply only to structured payloads.

Can I still output JSON when a caller explicitly requests it?▼

Yes, prefer an explicit --json output branch for caller-requested formats. For file or wire JSON that must remain, record the site in .red/contracts/toon-json-file-io-allowlist.json as external for permanent protocols or migrate for bounded conversion debt.

Does the TOON wire decoder accept legacy JSON frames?▼

Yes, decodeWireFrame may accept a legacy JSON frame while peers roll forward, but the default writer emits TOON frames. This keeps cross-process communication compatible during incremental migrations.

How do I know my serialization changes are complete?▼

Done means the touched flow defaults to TOON on files and owned wires, every remaining JSON site is explicitly classified in the allowlist, and toon-json-guard.test.ts passes. The detection rules live in apps/plugin-dev/src/core/toon-json-guard.ts.