rust-impl-serde
Installation
SKILL.md
rust-impl-serde
The structured data interchange skill: how to derive Serialize / Deserialize, shape the wire format with container and field attributes, pick the right enum representation, write a custom impl when the derive is not enough, and choose between JSON, TOML, YAML, bincode, and MessagePack. Serde is a compile-time framework: no runtime reflection, zero overhead, the data-structure / data-format interaction "can be completely optimized away by the Rust compiler" (per serde.rs).
Cross-references: [[rust-impl-cargo-project]] (feature flags, the derive feature), [[rust-syntax-traits]] (Serialize / Deserialize as trait bounds, generic impls), [[rust-syntax-lifetimes]] (zero-copy deserialization with #[serde(borrow)] and 'de).
When to use this skill
- User adds
#[derive(Serialize, Deserialize)]and getserror: cannot find derive macro(forgot thederivefeature). - User asks how to rename fields, accept legacy names, or convert all field names to
camelCaseat once. - User has an enum and asks which JSON shape to emit: tagged, untagged, adjacently tagged.
- User wants to flatten a sub-struct into the parent shape, or pull arbitrary extra fields into a
HashMap. - User wants zero-copy deserialization with
&'a strand getserror: implementation of Deserialize is not general enough. - User asks whether to choose
serde_json,toml,serde_yaml,bincode, orrmp-serdefor a given task. - User asks how to write a manual
Serialize/Deserializeimpl when the derive cannot express the format. - User mixes
#[serde(rename = ...)]with#[serde(alias = ...)]for a schema migration.