← ClaudeAtlas

dotnet-techne-serialisationsolid

Use when selecting serialisation formats and contracts for APIs, messaging, caching, or persistence. Keywords: serialisation, System.Text.Json, source generator, protobuf, messagepack, wire compatibility, AOT.
Metalnib/dotnet-episteme-skills · ★ 11 · Code & Development · score 85
Install: claude install-skill Metalnib/dotnet-episteme-skills
# Serialisation in .NET ## When to Use This Skill Use this skill when: - Choosing a serialisation format for APIs, messaging, or persistence - Migrating from Newtonsoft.Json to System.Text.Json - Implementing AOT-compatible serialisation - Designing wire formats for distributed systems - Optimizing serialisation performance --- ## Schema-Based vs Reflection-Based (Serialisation) | Aspect | Schema-Based | Reflection-Based | |--------|--------------|------------------| | **Examples** | Protobuf, MessagePack, System.Text.Json (source gen) | Newtonsoft.Json, BinaryFormatter | | **Type info in payload** | No (external schema) | Yes (type names embedded) | | **Versioning** | Explicit field numbers/names | Implicit (type structure) | | **Performance** | Fast (no reflection) | Slower (runtime reflection) | | **AOT compatible** | Yes | No | | **Wire compatibility** | Excellent | Poor | **Recommendation**: Use schema-based serialisation for anything that crosses process boundaries. --- ## Format Recommendations | Use Case | Recommended Format | Why | |----------|-------------------|-----| | **REST APIs** | System.Text.Json (source gen) | Standard, AOT-compatible | | **gRPC** | Protocol Buffers | Native format, excellent versioning | | **Actor messaging** | MessagePack or Protobuf | Compact, fast, version-safe | | **Event sourcing** | Protobuf or MessagePack | Must handle old events forever | | **Caching** | MessagePack | Compact, fast | | **Configuration** | JSON (System.Text.