Skip to content

po4yka/rust-skills / skills/rust-serde

rust-serde

Verified

Use when deriving or changing Serialize or Deserialize on a type whose encoded form is a contract (config, stored record, or wire message), or when serde_json drops a field, reorders keys, or loses number precision without an error. Triggers on deny_unknown_fields, rename_all, serde(alias), serde(tag), untagged, serde(flatten), skip_serializing_if, serde(default), serde(try_from), DeserializeOwned, JSON map key, large integer, preserve_order, float_roundtrip, arbitrary_precision, postcard, "unknown field", "did not match any variant".

references/wire-tests.md

View on GitHub
# Wire-contract tests

Read this when you write the tests that pin a serde type's wire contract: old-payload fixtures,
golden output, empty values, format round trips, numeric edges, and map keys.

Add tests for the risks the type carries:

- **Old payloads.** Commit one fixture per shipped version. Parse each with the current type and
  assert the field values, not only `is_ok()`. Include aliases, absent sections, and unknown keys.
- **Written output.** Compare the serialized form with a golden file, so a rename or a new
  `rename_all` shows up as a diff. The `rust-test-tools` skill, when it is installed, has the
  golden mechanics; without it, rewrite a fixture only in a run that sets `BLESS_GOLDENS=1`. When an older build must read the new output, parse the golden file with the
  released type. For a crate published to a registry, add a renamed dev-dependency on the same
  crate: `old = { package = "<crate>", version = "=<last>" }`.
- **Empty and absent values.** Round-trip empty strings, collections, maps, and `None` for every
  field that has `skip_serializing_if`. A skipped non-`Option` field without `default` writes a
  document that the same type cannot read, and serde_json reports `missing field` for it.
- **Every claimed format.** Round-trip each enum and each flattened type through every format the
  type claims, such as postcard. Tagged enums and `flatten` compile and fail only at runtime.
- **Numeric edges.** Test zero, signed minimum, unsigned maximum, the largest value inside the
  documented JSON range, and the first value above it. For `18446744073709551616`, assert
  `is_f64()` on the `Value` path, rejection on the typed `u64` path, or the exact digits under
  `arbitrary_precision`.
- **Map keys.** Serialize the exact public map type, not a `HashMap<String, T>` stand-in.
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall