[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79YA3A1WR78DBM7Y577VNGN":3,"skill-same:01M79YA3A1WR78DBM7Y577VNGN":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M79YA3A1WR78DBM7Y577VNGN","serialization",null,"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.","Blind-Striker\u002Fagent-skills-and-plugins","Blind-Striker","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1965259?v=4","01M79WFXTE5PH0C1VB7B54ANMN","Deniz İrgin","01M79WFXV5KZ5GST1K8G035DM5",1,"MIT","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fplugins\u002Fdeniz-dotnet-general\u002Fskills\u002Fserialization\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: serialization\ndescription: Choose the right serialization format for .NET applications. Prefer\n  schema-based formats (Protobuf, MessagePack) over reflection-based\n  (Newtonsoft.Json). Use System.Text.Json with AOT source generators for JSON\n  scenarios.\nuser-invocable: false\n---\n\n# Serialization in .NET\n\n## When to Use This Skill\n\nUse this skill when:\n- Choosing a serialization format for APIs, messaging, or persistence\n- Migrating from Newtonsoft.Json to System.Text.Json\n- Implementing AOT-compatible serialization\n- Designing wire formats for distributed systems\n- Optimizing serialization performance\n\n---\n\n## Schema-Based vs Reflection-Based\n\n| Aspect | Schema-Based | Reflection-Based |\n|--------|--------------|------------------|\n| **Examples** | Protobuf, MessagePack, System.Text.Json (source gen) | Newtonsoft.Json, BinaryFormatter |\n| **Type info in payload** | No (external schema) | Yes (type names embedded) |\n| **Versioning** | Explicit field numbers\u002Fnames | Implicit (type structure) |\n| **Performance** | Fast (no reflection) | Slower (runtime reflection) |\n| **AOT compatible** | Yes | No |\n| **Wire compatibility** | Excellent | Poor |\n\n**Recommendation**: Use schema-based serialization for anything that crosses process boundaries.\n\n---\n\n## Format Recommendations\n\n| Use Case | Recommended Format | Why |\n|----------|-------------------|-----|\n| **REST APIs** | System.Text.Json (source gen) | Standard, AOT-compatible |\n| **gRPC** | Protocol Buffers | Native format, excellent versioning |\n| **Actor messaging** | MessagePack or Protobuf | Compact, fast, version-safe |\n| **Event sourcing** | Protobuf or MessagePack | Must handle old events forever |\n| **Caching** | MessagePack | Compact, fast |\n| **Configuration** | JSON (System.Text.Json) | Human-readable |\n| **Logging** | JSON (System.Text.Json) | Structured, parseable |\n\n### Formats to Avoid\n\n| Format | Problem |\n|--------|---------|\n| **BinaryFormatter** | Security vulnerabilities, deprecated, never use |\n| **Newtonsoft.Json default** | Type names in payload break on rename |\n| **DataContractSerializer** | Complex, poor versioning |\n| **XML** | Verbose, slow, complex |\n\n---\n\n## System.Text.Json with Source Generators\n\nFor JSON serialization, use System.Text.Json with source generators for AOT compatibility and performance.\n\n### Setup\n\n```csharp\n\u002F\u002F Define a JsonSerializerContext with all your types\n[JsonSerializable(typeof(Order))]\n[JsonSerializable(typeof(OrderItem))]\n[JsonSerializable(typeof(Customer))]\n[JsonSerializable(typeof(List\u003COrder>))]\n[JsonSourceGenerationOptions(\n    PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,\n    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]\npublic partial class AppJsonContext : JsonSerializerContext { }\n```\n\n### Usage\n\n```csharp\n\u002F\u002F Serialize with context\nvar json = JsonSerializer.Serialize(order, AppJsonContext.Default.Order);\n\n\u002F\u002F Deserialize with context\nvar order = JsonSerializer.Deserialize(json, AppJsonContext.Default.Order);\n\n\u002F\u002F Configure in ASP.NET Core\nbuilder.Services.ConfigureHttpJsonOptions(options =>\n{\n    options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonContext.Default);\n});\n```\n\n### Benefits\n\n- **No reflection at runtime** - All type info generated at compile time\n- **AOT compatible** - Works with Native AOT publishing\n- **Faster** - No runtime type analysis\n- **Trim-safe** - Linker knows exactly what's needed\n\n---\n\n## Protocol Buffers (Protobuf)\n\nBest for: Actor systems, gRPC, event sourcing, any long-lived wire format.\n\n### Setup\n\n```bash\ndotnet add package Google.Protobuf\ndotnet add package Grpc.Tools\n```\n\n### Define Schema\n\n```protobuf\n\u002F\u002F orders.proto\nsyntax = \"proto3\";\n\nmessage Order {\n    string id = 1;\n    string customer_id = 2;\n    repeated OrderItem items = 3;\n    int64 created_at_ticks = 4;\n\n    \u002F\u002F Adding new fields is always safe\n    string notes = 5;  \u002F\u002F Added in v2 - old readers ignore it\n}\n\nmessage OrderItem {\n    string product_id = 1;\n    int32 quantity = 2;\n    int64 price_cents = 3;\n}\n```\n\n### Versioning Rules\n\n```protobuf\n\u002F\u002F SAFE: Add new fields with new numbers\nmessage Order {\n    string id = 1;\n    string customer_id = 2;\n    string shipping_address = 5;  \u002F\u002F NEW - safe\n}\n\n\u002F\u002F SAFE: Remove fields (old readers ignore unknown, new readers use default)\n\u002F\u002F Just stop using the field, keep the number reserved\nmessage Order {\n    string id = 1;\n    \u002F\u002F customer_id removed, but field 2 is reserved\n    reserved 2;\n}\n\n\u002F\u002F UNSAFE: Change field types\nmessage Order {\n    int32 id = 1;  \u002F\u002F Was: string - BREAKS!\n}\n\n\u002F\u002F UNSAFE: Reuse field numbers\nmessage Order {\n    reserved 2;\n    string new_field = 2;  \u002F\u002F Reusing 2 - BREAKS!\n}\n```\n\n---\n\n## MessagePack\n\nBest for: High-performance scenarios, compact payloads, actor messaging.\n\n### Setup\n\n```bash\ndotnet add package MessagePack\ndotnet add package MessagePack.Annotations\n```\n\n### Usage with Contracts\n\n```csharp\n[MessagePackObject]\npublic sealed class Order\n{\n    [Key(0)]\n    public required string Id { get; init; }\n\n    [Key(1)]\n    public required string CustomerId { get; init; }\n\n    [Key(2)]\n    public required IReadOnlyList\u003COrderItem> Items { get; init; }\n\n    [Key(3)]\n    public required DateTimeOffset CreatedAt { get; init; }\n\n    \u002F\u002F New field - old readers skip unknown keys\n    [Key(4)]\n    public string? Notes { get; init; }\n}\n\n\u002F\u002F Serialize\nvar bytes = MessagePackSerializer.Serialize(order);\n\n\u002F\u002F Deserialize\nvar order = MessagePackSerializer.Deserialize\u003COrder>(bytes);\n```\n\n### AOT-Compatible Setup\n\n```csharp\n\u002F\u002F Use source generator for AOT\n[MessagePackObject]\npublic partial class Order { }  \u002F\u002F partial enables source gen\n\n\u002F\u002F Configure resolver\nvar options = MessagePackSerializerOptions.Standard\n    .WithResolver(CompositeResolver.Create(\n        GeneratedResolver.Instance,  \u002F\u002F Generated\n        StandardResolver.Instance));\n```\n\n---\n\n## Migrating from Newtonsoft.Json\n\n### Common Issues\n\n| Newtonsoft | System.Text.Json | Fix |\n|------------|------------------|-----|\n| `$type` in JSON | Not supported by default | Use discriminators or custom converters |\n| `JsonProperty` | `JsonPropertyName` | Different attribute |\n| `DefaultValueHandling` | `DefaultIgnoreCondition` | Different API |\n| `NullValueHandling` | `DefaultIgnoreCondition` | Different API |\n| Private setters | Requires `[JsonInclude]` | Explicit opt-in |\n| Polymorphism | `[JsonDerivedType]` (.NET 7+) | Explicit discriminators |\n\n### Migration Pattern\n\n```csharp\n\u002F\u002F Newtonsoft (reflection-based)\npublic class Order\n{\n    [JsonProperty(\"order_id\")]\n    public string Id { get; set; }\n\n    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]\n    public string? Notes { get; set; }\n}\n\n\u002F\u002F System.Text.Json (source-gen compatible)\npublic sealed record Order(\n    [property: JsonPropertyName(\"order_id\")]\n    string Id,\n\n    string? Notes  \u002F\u002F Null handling via JsonSerializerOptions\n);\n\n[JsonSerializable(typeof(Order))]\n[JsonSourceGenerationOptions(\n    PropertyNamingPolicy = JsonKnownNamingPolicy.SnakeCaseLower,\n    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]\npublic partial class OrderJsonContext : JsonSerializerContext { }\n```\n\n### Polymorphism with Discriminators\n\n```csharp\n\u002F\u002F .NET 7+ polymorphism\n[JsonDerivedType(typeof(CreditCardPayment), \"credit_card\")]\n[JsonDerivedType(typeof(BankTransferPayment), \"bank_transfer\")]\npublic abstract record Payment(decimal Amount);\n\npublic sealed record CreditCardPayment(decimal Amount, string Last4) : Payment(Amount);\npublic sealed record BankTransferPayment(decimal Amount, string AccountNumber) : Payment(Amount);\n\n\u002F\u002F Serializes as:\n\u002F\u002F { \"$type\": \"credit_card\", \"amount\": 100, \"last4\": \"1234\" }\n```\n\n---\n\n## Wire Compatibility Patterns\n\n### Tolerant Reader\n\nOld code must safely ignore unknown fields:\n\n```csharp\n\u002F\u002F Protobuf\u002FMessagePack: Automatic - unknown fields skipped\n\u002F\u002F System.Text.Json: Configure to allow\nvar options = new JsonSerializerOptions\n{\n    UnmappedMemberHandling = JsonUnmappedMemberHandling.Skip\n};\n```\n\n### Introduce Read Before Write\n\nDeploy deserializers before serializers for new formats:\n\n```csharp\n\u002F\u002F Phase 1: Add deserializer (deployed everywhere)\npublic Order Deserialize(byte[] data, string manifest) => manifest switch\n{\n    \"Order.V1\" => DeserializeV1(data),\n    \"Order.V2\" => DeserializeV2(data),  \u002F\u002F NEW - can read V2\n    _ => throw new NotSupportedException()\n};\n\n\u002F\u002F Phase 2: Enable serializer (next release, after V1 deployed everywhere)\npublic (byte[] data, string manifest) Serialize(Order order) =>\n    _useV2Format\n        ? (SerializeV2(order), \"Order.V2\")\n        : (SerializeV1(order), \"Order.V1\");\n```\n\n### Never Embed Type Names\n\n```csharp\n\u002F\u002F BAD: Type name in payload - renaming class breaks wire format\n{\n    \"$type\": \"MyApp.Order, MyApp.Core\",\n    \"id\": \"123\"\n}\n\n\u002F\u002F GOOD: Explicit discriminator - refactoring safe\n{\n    \"type\": \"order\",\n    \"id\": \"123\"\n}\n```\n\n---\n\n## Performance Comparison\n\nApproximate throughput (higher is better):\n\n| Format | Serialize | Deserialize | Size |\n|--------|-----------|-------------|------|\n| MessagePack | ★★★★★ | ★★★★★ | ★★★★★ |\n| Protobuf | ★★★★★ | ★★★★★ | ★★★★★ |\n| System.Text.Json (source gen) | ★★★★☆ | ★★★★☆ | ★★★☆☆ |\n| System.Text.Json (reflection) | ★★★☆☆ | ★★★☆☆ | ★★★☆☆ |\n| Newtonsoft.Json | ★★☆☆☆ | ★★☆☆☆ | ★★★☆☆ |\n\nFor hot paths, prefer MessagePack or Protobuf.\n\n---\n\n## Akka.NET Serialization\n\nFor Akka.NET actor systems, use schema-based serialization:\n\n```hocon\nakka {\n  actor {\n    serializers {\n      messagepack = \"Akka.Serialization.MessagePackSerializer, Akka.Serialization.MessagePack\"\n    }\n    serialization-bindings {\n      \"MyApp.Messages.IMessage, MyApp\" = messagepack\n    }\n  }\n}\n```\n\nSee [Akka.NET Serialization Docs](https:\u002F\u002Fgetakka.net\u002Farticles\u002Fnetworking\u002Fserialization.html).\n\n---\n\n## Best Practices\n\n### DO\n\n```csharp\n\u002F\u002F Use source generators for System.Text.Json\n[JsonSerializable(typeof(Order))]\npublic partial class AppJsonContext : JsonSerializerContext { }\n\n\u002F\u002F Use explicit field numbers\u002Fkeys\n[MessagePackObject]\npublic class Order\n{\n    [Key(0)] public string Id { get; init; }\n}\n\n\u002F\u002F Use records for immutable message types\npublic sealed record OrderCreated(OrderId Id, CustomerId CustomerId);\n```\n\n### DON'T\n\n```csharp\n\u002F\u002F Don't use BinaryFormatter (ever)\nvar formatter = new BinaryFormatter();  \u002F\u002F Security risk!\n\n\u002F\u002F Don't embed type names in wire format\nsettings.TypeNameHandling = TypeNameHandling.All;  \u002F\u002F Breaks on rename!\n\n\u002F\u002F Don't use reflection serialization for hot paths\nJsonConvert.SerializeObject(order);  \u002F\u002F Slow, not AOT-compatible\n```\n\n---\n\n## Resources\n\n- **System.Text.Json Source Generation**: https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fstandard\u002Fserialization\u002Fsystem-text-json\u002Fsource-generation\n- **Protocol Buffers**: https:\u002F\u002Fprotobuf.dev\u002F\n- **MessagePack-CSharp**: https:\u002F\u002Fgithub.com\u002FMessagePack-CSharp\u002FMessagePack-CSharp\n- **Akka.NET Serialization**: https:\u002F\u002Fgetakka.net\u002Farticles\u002Fnetworking\u002Fserialization.html\n- **Wire Compatibility**: https:\u002F\u002Fgetakka.net\u002Fcommunity\u002Fcontributing\u002Fwire-compatibility.html\n","# Serialization in .NET\n\n## When to Use This Skill\n\nUse this skill when:\n- Choosing a serialization format for APIs, messaging, or persistence\n- Migrating from Newtonsoft.Json to System.Text.Json\n- Implementing AOT-compatible serialization\n- Designing wire formats for distributed systems\n- Optimizing serialization performance\n\n---\n\n## Schema-Based vs Reflection-Based\n\n| Aspect | Schema-Based | Reflection-Based |\n|--------|--------------|------------------|\n| **Examples** | Protobuf, MessagePack, System.Text.Json (source gen) | Newtonsoft.Json, BinaryFormatter |\n| **Type info in payload** | No (external schema) | Yes (type names embedded) |\n| **Versioning** | Explicit field numbers\u002Fnames | Implicit (type structure) |\n| **Performance** | Fast (no reflection) | Slower (runtime reflection) |\n| **AOT compatible** | Yes | No |\n| **Wire compatibility** | Excellent | Poor |\n\n**Recommendation**: Use schema-based serialization for anything that crosses process boundaries.\n\n---\n\n## Format Recommendations\n\n| Use Case | Recommended Format | Why |\n|----------|-------------------|-----|\n| **REST APIs** | System.Text.Json (source gen) | Standard, AOT-compatible |\n| **gRPC** | Protocol Buffers | Native format, excellent versioning |\n| **Actor messaging** | MessagePack or Protobuf | Compact, fast, version-safe |\n| **Event sourcing** | Protobuf or MessagePack | Must handle old events forever |\n| **Caching** | MessagePack | Compact, fast |\n| **Configuration** | JSON (System.Text.Json) | Human-readable |\n| **Logging** | JSON (System.Text.Json) | Structured, parseable |\n\n### Formats to Avoid\n\n| Format | Problem |\n|--------|---------|\n| **BinaryFormatter** | Security vulnerabilities, deprecated, never use |\n| **Newtonsoft.Json default** | Type names in payload break on rename |\n| **DataContractSerializer** | Complex, poor versioning |\n| **XML** | Verbose, slow, complex |\n\n---\n\n## System.Text.Json with Source Generators\n\nFor JSON serialization, use System.Text.Json with source generators for AOT compatibility and performance.\n\n### Setup\n\n```csharp\n\u002F\u002F Define a JsonSerializerContext with all your types\n[JsonSerializable(typeof(Order))]\n[JsonSerializable(typeof(OrderItem))]\n[JsonSerializable(typeof(Customer))]\n[JsonSerializable(typeof(List\u003COrder>))]\n[JsonSourceGenerationOptions(\n    PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,\n    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]\npublic partial class AppJsonContext : JsonSerializerContext { }\n```\n\n### Usage\n\n```csharp\n\u002F\u002F Serialize with context\nvar json = JsonSerializer.Serialize(order, AppJsonContext.Default.Order);\n\n\u002F\u002F Deserialize with context\nvar order = JsonSerializer.Deserialize(json, AppJsonContext.Default.Order);\n\n\u002F\u002F Configure in ASP.NET Core\nbuilder.Services.ConfigureHttpJsonOptions(options =>\n{\n    options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonContext.Default);\n});\n```\n\n### Benefits\n\n- **No reflection at runtime** - All type info generated at compile time\n- **AOT compatible** - Works with Native AOT publishing\n- **Faster** - No runtime type analysis\n- **Trim-safe** - Linker knows exactly what's needed\n\n---\n\n## Protocol Buffers (Protobuf)\n\nBest for: Actor systems, gRPC, event sourcing, any long-lived wire format.\n\n### Setup\n\n```bash\ndotnet add package Google.Protobuf\ndotnet add package Grpc.Tools\n```\n\n### Define Schema\n\n```protobuf\n\u002F\u002F orders.proto\nsyntax = \"proto3\";\n\nmessage Order {\n    string id = 1;\n    string customer_id = 2;\n    repeated OrderItem items = 3;\n    int64 created_at_ticks = 4;\n\n    \u002F\u002F Adding new fields is always safe\n    string notes = 5;  \u002F\u002F Added in v2 - old readers ignore it\n}\n\nmessage OrderItem {\n    string product_id = 1;\n    int32 quantity = 2;\n    int64 price_cents = 3;\n}\n```\n\n### Versioning Rules\n\n```protobuf\n\u002F\u002F SAFE: Add new fields with new numbers\nmessage Order {\n    string id = 1;\n    string customer_id = 2;\n    string shipping_address = 5;  \u002F\u002F NEW - safe\n}\n\n\u002F\u002F SAFE: Remove fields (old readers ignore unknown, new readers use default)\n\u002F\u002F Just stop using the field, keep the number reserved\nmessage Order {\n    string id = 1;\n    \u002F\u002F customer_id removed, but field 2 is reserved\n    reserved 2;\n}\n\n\u002F\u002F UNSAFE: Change field types\nmessage Order {\n    int32 id = 1;  \u002F\u002F Was: string - BREAKS!\n}\n\n\u002F\u002F UNSAFE: Reuse field numbers\nmessage Order {\n    reserved 2;\n    string new_field = 2;  \u002F\u002F Reusing 2 - BREAKS!\n}\n```\n\n---\n\n## MessagePack\n\nBest for: High-performance scenarios, compact payloads, actor messaging.\n\n### Setup\n\n```bash\ndotnet add package MessagePack\ndotnet add package MessagePack.Annotations\n```\n\n### Usage with Contracts\n\n```csharp\n[MessagePackObject]\npublic sealed class Order\n{\n    [Key(0)]\n    public required string Id { get; init; }\n\n    [Key(1)]\n    public required string CustomerId { get; init; }\n\n    [Key(2)]\n    public required IReadOnlyList\u003COrderItem> Items { get; init; }\n\n    [Key(3)]\n    public required DateTimeOffset CreatedAt { get; init; }\n\n    \u002F\u002F New field - old readers skip unknown keys\n    [Key(4)]\n    public string? Notes { get; init; }\n}\n\n\u002F\u002F Serialize\nvar bytes = MessagePackSerializer.Serialize(order);\n\n\u002F\u002F Deserialize\nvar order = MessagePackSerializer.Deserialize\u003COrder>(bytes);\n```\n\n### AOT-Compatible Setup\n\n```csharp\n\u002F\u002F Use source generator for AOT\n[MessagePackObject]\npublic partial class Order { }  \u002F\u002F partial enables source gen\n\n\u002F\u002F Configure resolver\nvar options = MessagePackSerializerOptions.Standard\n    .WithResolver(CompositeResolver.Create(\n        GeneratedResolver.Instance,  \u002F\u002F Generated\n        StandardResolver.Instance));\n```\n\n---\n\n## Migrating from Newtonsoft.Json\n\n### Common Issues\n\n| Newtonsoft | System.Text.Json | Fix |\n|------------|------------------|-----|\n| `$type` in JSON | Not supported by default | Use discriminators or custom converters |\n| `JsonProperty` | `JsonPropertyName` | Different attribute |\n| `DefaultValueHandling` | `DefaultIgnoreCondition` | Different API |\n| `NullValueHandling` | `DefaultIgnoreCondition` | Different API |\n| Private setters | Requires `[JsonInclude]` | Explicit opt-in |\n| Polymorphism | `[JsonDerivedType]` (.NET 7+) | Explicit discriminators |\n\n### Migration Pattern\n\n```csharp\n\u002F\u002F Newtonsoft (reflection-based)\npublic class Order\n{\n    [JsonProperty(\"order_id\")]\n    public string Id { get; set; }\n\n    [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]\n    public string? Notes { get; set; }\n}\n\n\u002F\u002F System.Text.Json (source-gen compatible)\npublic sealed record Order(\n    [property: JsonPropertyName(\"order_id\")]\n    string Id,\n\n    string? Notes  \u002F\u002F Null handling via JsonSerializerOptions\n);\n\n[JsonSerializable(typeof(Order))]\n[JsonSourceGenerationOptions(\n    PropertyNamingPolicy = JsonKnownNamingPolicy.SnakeCaseLower,\n    DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]\npublic partial class OrderJsonContext : JsonSerializerContext { }\n```\n\n### Polymorphism with Discriminators\n\n```csharp\n\u002F\u002F .NET 7+ polymorphism\n[JsonDerivedType(typeof(CreditCardPayment), \"credit_card\")]\n[JsonDerivedType(typeof(BankTransferPayment), \"bank_transfer\")]\npublic abstract record Payment(decimal Amount);\n\npublic sealed record CreditCardPayment(decimal Amount, string Last4) : Payment(Amount);\npublic sealed record BankTransferPayment(decimal Amount, string AccountNumber) : Payment(Amount);\n\n\u002F\u002F Serializes as:\n\u002F\u002F { \"$type\": \"credit_card\", \"amount\": 100, \"last4\": \"1234\" }\n```\n\n---\n\n## Wire Compatibility Patterns\n\n### Tolerant Reader\n\nOld code must safely ignore unknown fields:\n\n```csharp\n\u002F\u002F Protobuf\u002FMessagePack: Automatic - unknown fields skipped\n\u002F\u002F System.Text.Json: Configure to allow\nvar options = new JsonSerializerOptions\n{\n    UnmappedMemberHandling = JsonUnmappedMemberHandling.Skip\n};\n```\n\n### Introduce Read Before Write\n\nDeploy deserializers before serializers for new formats:\n\n```csharp\n\u002F\u002F Phase 1: Add deserializer (deployed everywhere)\npublic Order Deserialize(byte[] data, string manifest) => manifest switch\n{\n    \"Order.V1\" => DeserializeV1(data),\n    \"Order.V2\" => DeserializeV2(data),  \u002F\u002F NEW - can read V2\n    _ => throw new NotSupportedException()\n};\n\n\u002F\u002F Phase 2: Enable serializer (next release, after V1 deployed everywhere)\npublic (byte[] data, string manifest) Serialize(Order order) =>\n    _useV2Format\n        ? (SerializeV2(order), \"Order.V2\")\n        : (SerializeV1(order), \"Order.V1\");\n```\n\n### Never Embed Type Names\n\n```csharp\n\u002F\u002F BAD: Type name in payload - renaming class breaks wire format\n{\n    \"$type\": \"MyApp.Order, MyApp.Core\",\n    \"id\": \"123\"\n}\n\n\u002F\u002F GOOD: Explicit discriminator - refactoring safe\n{\n    \"type\": \"order\",\n    \"id\": \"123\"\n}\n```\n\n---\n\n## Performance Comparison\n\nApproximate throughput (higher is better):\n\n| Format | Serialize | Deserialize | Size |\n|--------|-----------|-------------|------|\n| MessagePack | ★★★★★ | ★★★★★ | ★★★★★ |\n| Protobuf | ★★★★★ | ★★★★★ | ★★★★★ |\n| System.Text.Json (source gen) | ★★★★☆ | ★★★★☆ | ★★★☆☆ |\n| System.Text.Json (reflection) | ★★★☆☆ | ★★★☆☆ | ★★★☆☆ |\n| Newtonsoft.Json | ★★☆☆☆ | ★★☆☆☆ | ★★★☆☆ |\n\nFor hot paths, prefer MessagePack or Protobuf.\n\n---\n\n## Akka.NET Serialization\n\nFor Akka.NET actor systems, use schema-based serialization:\n\n```hocon\nakka {\n  actor {\n    serializers {\n      messagepack = \"Akka.Serialization.MessagePackSerializer, Akka.Serialization.MessagePack\"\n    }\n    serialization-bindings {\n      \"MyApp.Messages.IMessage, MyApp\" = messagepack\n    }\n  }\n}\n```\n\nSee [Akka.NET Serialization Docs](https:\u002F\u002Fgetakka.net\u002Farticles\u002Fnetworking\u002Fserialization.html).\n\n---\n\n## Best Practices\n\n### DO\n\n```csharp\n\u002F\u002F Use source generators for System.Text.Json\n[JsonSerializable(typeof(Order))]\npublic partial class AppJsonContext : JsonSerializerContext { }\n\n\u002F\u002F Use explicit field numbers\u002Fkeys\n[MessagePackObject]\npublic class Order\n{\n    [Key(0)] public string Id { get; init; }\n}\n\n\u002F\u002F Use records for immutable message types\npublic sealed record OrderCreated(OrderId Id, CustomerId CustomerId);\n```\n\n### DON'T\n\n```csharp\n\u002F\u002F Don't use BinaryFormatter (ever)\nvar formatter = new BinaryFormatter();  \u002F\u002F Security risk!\n\n\u002F\u002F Don't embed type names in wire format\nsettings.TypeNameHandling = TypeNameHandling.All;  \u002F\u002F Breaks on rename!\n\n\u002F\u002F Don't use reflection serialization for hot paths\nJsonConvert.SerializeObject(order);  \u002F\u002F Slow, not AOT-compatible\n```\n\n---\n\n## Resources\n\n- **System.Text.Json Source Generation**: https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fdotnet\u002Fstandard\u002Fserialization\u002Fsystem-text-json\u002Fsource-generation\n- **Protocol Buffers**: https:\u002F\u002Fprotobuf.dev\u002F\n- **MessagePack-CSharp**: https:\u002F\u002Fgithub.com\u002FMessagePack-CSharp\u002FMessagePack-CSharp\n- **Akka.NET Serialization**: https:\u002F\u002Fgetakka.net\u002Farticles\u002Fnetworking\u002Fserialization.html\n- **Wire Compatibility**: https:\u002F\u002Fgetakka.net\u002Fcommunity\u002Fcontributing\u002Fwire-compatibility.html\n",{"name":5,"description":7,"user-invocable":20},"master","b30b1c1908dbc56a8184128f18803053d762ccb5","plugins\u002Fdeniz-dotnet-general\u002Fskills\u002Fserialization",0,"https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins","https:\u002F\u002Fgithub.com\u002FBlind-Striker","denizirgin.com","VP of Engineering - \r\n@armutcom @homeruntech @prontopro\r\n |  Speaker \r\n@CodeFiction\r\n, http:\u002F\u002Fcodefiction.tech | Developer, gamer, blogger, maiden iron fan","2026-11-13 00:23:18",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add Blind-Striker\u002Fagent-skills-and-plugins --skill serialization",{"tool":39,"command":40},"bunx","bunx skills add Blind-Striker\u002Fagent-skills-and-plugins --skill serialization",{"tool":42,"command":43},"pnpm","pnpm dlx skills add Blind-Striker\u002Fagent-skills-and-plugins --skill serialization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fplugins\u002Fdeniz-dotnet-general\u002Fskills\u002Fserialization\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M79YGWBJ52PHMSTKJ3RJ3AWR","writing-tunit-tests","Write tests in TUnit — the attributes, the async assertion model, data-driven cases, lifecycle hooks, and the parallelism rules. USE FOR writing or fixing a test in a TUnit project, translating a test idea into TUnit syntax, or reviewing TUnit test code for API mistakes. DO NOT USE FOR deciding what to test, judging whether a test is any good, or running tests.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-dotnet-general\u002Fwriting-tunit-tests\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M79YGR3Y9RCRS6TD71D0KKP8","dotnet-walls","Walls for a .NET change in a repository without its own quality gates — pinned, ephemeral analyzer, format, clone and scanner commands for the verify step, their identity ratchet, and the build traps. Use during a walls preflight, or when a worker's verify step needs .NET quality gates.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-dotnet-general\u002Fdotnet-walls\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M79YGFNJBST7D803NQW3SBYM","csharp-15","Write, review and modernize C# 15 (.NET 11) code correctly. Covers every C# 15 feature - collection expression arguments (`[with(...), ...]`), union types (`union`, `[Union]`, `IUnion`, custom unions), closed class hierarchies (`closed`), extension indexers, labeled `break`\u002F`continue`, non-virtual static interface members on runtimes without default interface methods, and the preview memory-safety model (`unsafe(expr)`, `safe`, requires-unsafe members). Use when code targets net11.0 or LangVersion 15\u002Fpreview, when the user mentions any of these features, when replacing marker interfaces, OneOf-style results, `goto`\u002Fflag loop exits or capacity\u002Fcomparer boilerplate, or when the build reports CS8121, CS8509, CS8655, CS8510, CS0121\u002FCS0411 on a `with(...)` element, CS9370, CS9380 or CS9363.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-dotnet-general\u002Fcsharp-15\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M79YGAV031473HSX6FN87ENH","verified-waves","Run one task as verified multi-agent waves. Plans the fan-out, sends findings to fresh skeptics, keeps a ledger, and reports N of M done; small tasks stay solo.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-coordination\u002Fverified-waves\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M79YG6QXNND4WRPP3GATSY8J","harness","The bundled dispatch harness, which runs a task file on worker models through OpenCode or Codex, fences their writes, escalates their asks to the operator, settles each result from git and its verify commands, and records every step in a ledger. Its commands, task file, modes and write fence, configuration, runs and their recovery, ledger and exit codes.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-coordination\u002Fharness\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M79YG2P5S91SDTA5912XJ4FV","delegating-to-worker-models","Use when you hand off implementation, a plan, research a decision will rely on, or a review, and you brief the worker and check what comes back. A subagent that searches, reads in parallel, or keeps your context small is ordinary tool use. Covers what stays with you, the mechanism, assigning work by strength, the walls preflight, prompts without contradictions, the worker contract and model profiles, evidence from your own run, review, and the fix-up loop.","https:\u002F\u002Fgithub.com\u002FBlind-Striker\u002Fagent-skills-and-plugins\u002Fblob\u002Fmaster\u002Fskills\u002Fdeniz-coordination\u002Fdelegating-to-worker-models\u002FSKILL.md",[],[]]