Tooluck logoTooluck
SKILL.md

serialization

Agent skill fromAaronontheweb/dotnet-skills

Choose the right serialization format for .NET applications. Prefer schema-based formats (Protobuf, MessagePack) over reflection-based (Newtonsoft.Json). Use System.Text.Json with AOT source generators for JSON scenarios.

How to install serialization

install serialization
# install the dotnet-skills pack with the skills CLI
npx skills add Aaronontheweb/dotnet-skills

# or add only this skill to Claude Code: copy the folder

skills/serialization/

# into

~/.claude/skills/serialization/ (all projects)

.claude/skills/serialization/ (one project)

skills/serialization/SKILL.md

MITFull file
1# Serialization in .NET
2
3## When to Use This Skill
4
5Use this skill when:
6- Choosing a serialization format for APIs, messaging, or persistence
7- Migrating from Newtonsoft.Json to System.Text.Json
8- Implementing AOT-compatible serialization
9- Designing wire formats for distributed systems
10- Optimizing serialization performance
11
12---
13
14## Schema-Based vs Reflection-Based
15
16| Aspect | Schema-Based | Reflection-Based |
17|--------|--------------|------------------|
18| **Examples** | Protobuf, MessagePack, System.Text.Json (source gen) | Newtonsoft.Json, BinaryFormatter |
19| **Type info in payload** | No (external schema) | Yes (type names embedded) |
20| **Versioning** | Explicit field numbers/names | Implicit (type structure) |
21| **Performance** | Fast (no reflection) | Slower (runtime reflection) |
22| **AOT compatible** | Yes | No |
23| **Wire compatibility** | Excellent | Poor |
24
25**Recommendation**: Use schema-based serialization for anything that crosses process boundaries.
26
27---
28
29## Format Recommendations
30
31| Use Case | Recommended Format | Why |
32|----------|-------------------|-----|
33| **REST APIs** | System.Text.Json (source gen) | Standard, AOT-compatible |
34| **gRPC** | Protocol Buffers | Native format, excellent versioning |
35| **Actor messaging** | MessagePack or Protobuf | Compact, fast, version-safe |
36| **Event sourcing** | Protobuf or MessagePack | Must handle old events forever |
37| **Caching** | MessagePack | Compact, fast |
38…

Excerpt shown under the repository's MIT license.

More skills in dotnet-skills

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates