dotnet-techne-qa-pipel…
Use when the user asks to verify a story or ticket implementation against its spec - per-AC verdicts, code reuse and design…
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.
Claude Code
$ npx -y skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-serialisation --agent claude-code
Codex
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-serialisation -a codex -y
Cursor
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-serialisation -a cursor -y
Gemini CLI
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-serialisation -a gemini-cli -y
GitHub Copilot
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-serialisation -a github-copilot -y
OpenCode
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-serialisation -a opencode -y
Windsurf
$ npx skills add Metalnib/dotnet-episteme-skills --skill dotnet-techne-serialisation -a windsurf -y
name: dotnet-techne-serialisation
description: "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."
disable-model-invocation: false
user-invocable: true
metadata:
author: Metalnib
version: "1.0.0"
trigger_keywords:
- serialisation
- system.text.json
- source generator
- protobuf
- messagepack
- wire compatibility
- aotUse this skill when:
---
| 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.
---
| 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.Json) | Human-readable | | **Logging** | JSON (System.Text.Json) | Structured, parseable |
| Format | Problem | |--------|---------| | **BinaryFormatter** | Security vulnerabilities, deprecated, never use | | **Newtonsoft.Json default** | Type names in payload break on rename | | **DataContractSerializer** | Complex, poor versioning | | **XML** | Verbose, slow, complex |
---
For JSON serialisation, use System.Text.Json with source generators for AOT compatibility and performance.
// Define a JsonSerializerContext with all your types
[JsonSerializable(typeof(Order))]
[JsonSerializable(typeof(OrderItem))]
[JsonSerializable(typeof(Customer))]
[JsonSerializable(typeof(List<Order>))]
[JsonSourceGenerationOptions(
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
public partial class AppJsonContext : JsonSerializerContext { }// Serialize with context
var json = JsonSerializer.Serialize(order, AppJsonContext.Default.Order);
// Deserialize with context
var order = JsonSerializer.Deserialize(json, AppJsonContext.Default.Order);
// Configure in ASP.NET Core
builder.Services.ConfigureHttpJsonOptions(options =>
{
options.SerializerOptions.TypeInfoResolverChain.Insert(0, AppJsonContext.Default);
});---
Best for: Actor systems, gRPC, event sourcing, any long-lived wire format.
dotnet add package Google.Protobuf dotnet add package Grpc.Tools
// orders.proto
syntax = "proto3";
message Order {
string id = 1;
string customer_id = 2;
repeated OrderItem items = 3;
int64 created_at_ticks = 4;
// Adding new fields is always safe
string notes = 5; // Added in v2 - old readers ignore it
}
message OrderItem {
string product_id = 1;
int32 quantity = 2;
int64 price_cents = 3;
}// SAFE: Add new fields with new numbers
message Order {
string id = 1;
string customer_id = 2;
string shipping_address = 5; // NEW - safe
}
// SAFE: Remove fields (old readers ignore unknown, new readers use default)
// Just stop using the field, keep the number reserved
message Order {
string id = 1;
// customer_id removed, but field 2 is reserved
reserved 2;
}
// UNSAFE: Change field types
message Order {
int32 id = 1; // Was: string - BREAKS!
}
// UNSAFE: Reuse field numbers
message Order {
reserved 2;
string new_field = 2; // Reusing 2 - BREAKS!
}---
Best for: High-performance scenarios, compact payloads, actor messaging.
dotnet add package MessagePack dotnet add package MessagePack.Annotations
[MessagePackObject]
public sealed class Order
{
[Key(0)]
public required string Id { get; init; }
[Key(1)]
public required string CustomerId { get; init; }
[Key(2)]
public required IReadOnlyList<OrderItem> Items { get; init; }
[Key(3)]
public required DateTimeOffset CreatedAt { get; init; }
// New field - old readers skip unknown keys
[Key(4)]
public string? Notes { get; init; }
}
// Serialize
var bytes = MessagePackSerializer.Serialize(order);
// Deserialize
var order = MessagePackSerializer.Deserialize<Order>(bytes);// Use source generator for AOT
[MessagePackObject]
public partial class Order { } // partial enables source gen
// Configure resolver
var options = MessagePackSerializerOptions.Standard
.WithResolver(CompositeResolver.Create(DotNet Episteme Skills - a curated, manual-first .NET AI skills library rooted in systematic knowledge (episteme) and shaped by disciplined craft (techne), designed for engineers who prioritise precision over hype.
Use when the user asks to verify a story or ticket implementation against its spec - per-AC verdicts, code reuse and design…
Use when the user asks for a phase-gated refactoring or redesign loop - session-blind workers map and trace the area, empirical…
Use when the user asks for a multi-agent .NET code review - five parallel reviewers (correctness, performance,…
Use when reviewing PRs/diffs/branches/documents for .NET quality, correctness, performance, security, data access, messaging, and…
Use when you need CRAP score and coverage risk analysis to find high-risk code before refactoring or release. Keywords: CRAP…
Use when reviewing a .NET pull request for breaking changes that may affect other microservice repositories. Detects cross-repo…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.